Skip to main content
POST
/
setup-method
/
create
cURL
curl --request POST \
  --url https://api.xpaycheckout.com/setup-method/create \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '{
  "currency": "USD",
  "paymentMethods": [
    "CARD",
    "GOOGLE_PAY",
    "APPLE_PAY"
  ],
  "customerId": "cus_Tfd3Jq1tZxPjYVhRQW2r3",
  "storeFrontId": "sf_sK8d3Jq1tZxPjYVhRQW2rf",
  "callbackUrl": "https://example.com/callback",
  "metadata": {
    "orderId": "12345",
    "customerNote": "Setup for recurring payments"
  },
  "phoneNumberRequired": false
}'
{
  "setupMethodId": "sm_sK8d3Jq1tZxPjYVhRQW2rf",
  "fwdUrl": "https://pay.xpaycheckout.com/setup-method?id=sm_sK8d3Jq1tZxPjYVhRQW2rf&secret=4b5PyxKSOuunnnFruohoiF"
}

Authorizations

Authorization
string
header
required

Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.

Body

application/json

Create Setup Method

currency
string
required

Three letter abbreviation of the currency. Refer supported currencies

Example:

"USD"

customerId
string
required

Your unique identifier for the customer

Example:

"cus_Tfd3Jq1tZxPjYVhRQW2r3"

paymentMethods
string[]

List of payment methods to be enabled for setup. supported payment methods

šŸ’” If a selected payment method is unavailable, the system will automatically fallback to card payments to ensure a smooth checkout experience.

Example:
["CARD", "GOOGLE_PAY", "APPLE_PAY"]
storeFrontId
string

The unique identifier for your storefront

Example:

"sf_sK8d3Jq1tZxPjYVhRQW2rf"

callbackUrl
string

The URL we will callback to once the setup is complete

Example:

"https://example.com/callback"

metadata
object

A collection of key-value pairs that can be attached to an object for storing additional structured information

Example:
{
"orderId": "12345",
"customerNote": "Setup for recurring payments"
}
phoneNumberRequired
boolean

Flag to indicate whether phone number is required from the customer during checkout. By default, this is false.

Example:

false

Response

Setup Method created successfully

setupMethodId
string

Unique identifier of the setup method

Example:

"sm_sK8d3Jq1tZxPjYVhRQW2rf"

fwdUrl
string

The URL to redirect the customer to complete the setup

Example:

"https://pay.xpaycheckout.com/setup-method?id=sm_sK8d3Jq1tZxPjYVhRQW2rf&secret=4b5PyxKSOuunnnFruohoiF"

⌘I