v1

latestOpenAPI 3.0.1MIT2026-07-26336777.7 KB

Create a new setup method for storing payment methods

post/setup-method/create

Headers

Idempotency-Keystring

A unique key for making the request idempotent. Must match pattern: ^[a-zA-Z0-9\-_:\.]+$. See Idempotent Requests for more details.

Request body

currencystring required

Three letter abbreviation of the currency. Refer supported currencies

paymentMethodsstring[]

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.

customerIdstring

The unique identifier for the customer, generated via the create-customer API. This can be used to associate the payment with a specific customer in your system.

storeFrontIdstring

The unique identifier for your storefront

callbackUrlstring required

The URL we will callback to once the setup is complete

metadataobject

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

phoneNumberRequiredboolean

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

Example request

{
  "currency": "USD",
  "paymentMethods": [
    "CARD",
    "GOOGLE_PAY",
    "APPLE_PAY"
  ],
  "customerId": "cus_Tfd3Jq1tZxPjYVhRQW2r3",
  "billingDetails": {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "contactNumber": "+919123456789",
    "customerAddress": {
      "addressLine1": "123 Main St",
      "addressLine2": "Apt 1",
      "city": "New York",
      "state": "NY",
      "country": "US",
      "postalCode": "2424"
    }
  },
  "storeFrontId": "sf_sK8d3Jq1tZxPjYVhRQW2rf",
  "callbackUrl": "https://example.com/callback",
  "metadata": {
    "orderId": "12345",
    "customerNote": "Setup for recurring payments"
  }
}

Response

Setup Method created successfully

setupMethodIdstring

Unique identifier of the setup method

fwdUrlstring

The URL to redirect the customer to complete the setup

Example response

{
  "setupMethodId": "sm_sK8d3Jq1tZxPjYVhRQW2rf",
  "fwdUrl": "https://pay.xpaycheckout.com/setup-method?id=sm_sK8d3Jq1tZxPjYVhRQW2rf&secret=4b5PyxKSOuunnnFruohoiF"
}