---
title: Create a setup intent
slug: reference/create-a-setup-intent
docTags: 
createdAt: 2024-09-30T17:03:00.667Z
---

{
  "id": "xsFPGyK7LU61yISadqR72",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/customer-portal/setup-intent",
    "servers": [
      {
        "url": "https://app.amberflo.io/customer-portal/setup-intent"
      }
    ],
    "name": "Create a setup intent",
    "description": "<p>Use this endpoint when registering the customer's payment credentials for future payments.</p>\n<p>For more information, see: <a href=\"https://stripe.com/docs/payments/setup-intents\" target=\"_blank\">Stripe's SetupIntent</a>.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [
        {
          "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": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "setup-intent-request",
          "schema": [
            {
              "name": "provider",
              "kind": "required",
              "type": "string<stripe>",
              "example": "",
              "default": "stripe"
            }
          ],
          "modelRef": "#/components/schemas/setup-intent-request",
          "isExpanded": true
        }
      ],
      "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": "setup-intent-response",
            "schema": [
              {
                "name": "id",
                "kind": "optional",
                "type": "string",
                "example": ""
              },
              {
                "name": "clientSecret",
                "kind": "optional",
                "type": "string",
                "example": ""
              }
            ],
            "modelRef": "#/components/schemas/setup-intent-response",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "0xK5e9hb1egQLNoQFvLJV",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url 'https://app.amberflo.io/customer-portal/setup-intent?sessionToken=string' \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"provider\": \"stripe\"\n     }'"
        },
        {
          "id": "Kxgs7lKQTYoWFh1_H0qvV",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"provider\": \"stripe\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/customer-portal/setup-intent?sessionToken=string\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "TwrwHF_tLNROIhCid8w_W",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/customer-portal/setup-intent?sessionToken=string\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"provider\": \"stripe\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "LrxcknBa2YX6bj8G22HOx",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/customer-portal/setup-intent?sessionToken=string\"\n\npayload = json.dumps({\n   \"provider\": \"stripe\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "0xK5e9hb1egQLNoQFvLJV"
    },
    "results": {
      "languages": [
        {
          "id": "7yia0pbNz8VpVhgKu8ytP",
          "language": "200",
          "code": "// Successful response\n{\n  \"id\": \"\",\n  \"clientSecret\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "7yia0pbNz8VpVhgKu8ytP"
    }
  },
  "children": [
    {
      "id": "DmdHJsV07JxodCyLfNbg4",
      "type": "paragraph",
      "children": [
        {
          "text": "Use this endpoint when registering the customer's payment credentials for future payments.",
          "id": "jSuBtYn9up48Wki2BqKAI"
        }
      ]
    },
    {
      "id": "qqsFKJDbrViKwFijtpFEM",
      "type": "paragraph",
      "children": [
        {
          "text": "For more information, see: ",
          "id": "WxtvSV1-baVlWnR8Nlqyd"
        },
        {
          "id": "bAn9qQbgvnqwo7MuzatDh",
          "type": "link",
          "data": {
            "href": "https://stripe.com/docs/payments/setup-intents"
          },
          "children": [
            {
              "text": "Stripe's SetupIntent",
              "id": "e2IXj7PVmRLNVjq3CY-B4"
            }
          ]
        },
        {
          "text": ".",
          "id": "rvOPI5CDpjQYd7MR3u5C5"
        }
      ]
    }
  ]
}