---
title: Get default payment method
slug: reference/get-default-payment-method
docTags: 
createdAt: 2024-09-30T17:03:00.667Z
---

{
  "id": "VRKJQj5W2irOFHgAObs-b",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://app.amberflo.io/customer-portal/payment-method",
    "servers": [
      {
        "url": "https://app.amberflo.io/customer-portal/payment-method"
      }
    ],
    "name": "Get default payment method",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [
        {
          "kind": "required",
          "name": "provider",
          "type": "string",
          "description": "",
          "default": "stripe"
        },
        {
          "kind": "required",
          "name": "sessionToken",
          "type": "string",
          "description": "<p>A required session token used to authenticate API calls made on behalf of a customer. This token is obtained from the <code>Create a session</code> endpoint and must be included with every request to authorize access.</p>"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "api_key",
          "name": "x-api-key",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful response",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "payment-method-get-response",
            "schema": [
              {
                "name": "provider",
                "kind": "optional",
                "type": "string<stripe>",
                "example": "",
                "default": "stripe"
              },
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "brand",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "expMonth",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "expYear",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "last4",
                "kind": "optional",
                "type": "string",
                "example": ""
              }
            ],
            "modelRef": "#/components/schemas/payment-method-get-response",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "rSqbmc3JFZdgCq_4QCeFu",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url 'https://app.amberflo.io/customer-portal/payment-method?provider=stripe&sessionToken=string' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "Ibma7zt-_ahm3fHNgfBEh",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/customer-portal/payment-method?provider=stripe&sessionToken=string\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "g2rCSaB48sq8It6O0e_XG",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/customer-portal/payment-method?provider=stripe&sessionToken=string\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "7_uOBCsQt8BLmXm6hhfIp",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/customer-portal/payment-method?provider=stripe&sessionToken=string\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "rSqbmc3JFZdgCq_4QCeFu"
    },
    "results": {
      "languages": [
        {
          "id": "6AhZL8dIrZMkgrUw3FxGS",
          "language": "200",
          "code": "// Successful response\n{\n  \"provider\": \"\",\n  \"id\": \"\",\n  \"brand\": \"\",\n  \"expMonth\": \"\",\n  \"expYear\": \"\",\n  \"last4\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "6AhZL8dIrZMkgrUw3FxGS"
    }
  },
  "children": [
    {
      "text": "",
      "id": "bJb88EBgLlBwgazfNTtqe"
    }
  ]
}