Skip to main content
POST
/
setup-method
/
s2s
/
create
cURL
curl --request POST \
  --url https://api.xpaycheckout.com/setup-method/s2s/create \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "currency": "USD",
  "billingDetails": {
    "name": "John Doe",
    "email": "john.doe@example.com",
    "contactNumber": "+919123456789",
    "customerAddress": {
      "country": "IN",
      "postalCode": "123456"
    }
  },
  "callbackUrl": "https://example.com/callback",
  "cardDetails": {
    "cardNumber": "4000002500000003",
    "expiryMonth": 1,
    "expiryYear": 28,
    "cvv": "123",
    "cardHolderName": "John Doe",
    "country": "US",
    "postalCode": "2424"
  },
  "customerId": "cus_Tfd3Jq1tZxPjYVhRQW2r3",
  "customerReferenceId": "eTfd3Jq1tZxPjYVhRQW2r3",
  "storeFrontId": "sf_sK8d3Jq1tZxPjYVhRQW2rf",
  "phoneNumberRequired": false,
  "metadata": {
    "orderId": "12345",
    "customerNote": "Setup for recurring payments"
  }
}
'
{
  "setupMethodId": "sm_sK8d3Jq1tZxPjYVhRQW2rf",
  "fwdUrl": "https://pay.xpaycheckout.com/setup-method?id=sm_sK8d3Jq1tZxPjYVhRQW2rf&secret=4b5PyxKSOuunnnFruohoiF"
}
This endpoint is currently only available for card payments
  • Use this endpoint when you already gathered card details and consent within your PCI DSS compliant environment
  • You must obtain explicit approval from hello@xpaycheckout.com before using this API

Authorizations

Authorization
string
header
required

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

Headers

Idempotency-Key
string

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

Maximum string length: 255
Pattern: ^[a-zA-Z0-9\-_:\.]+$

Body

application/json

Create S2S Setup Method

currency
string
required

Three letter abbreviation of the currency. Refer supported currencies

Example:

"USD"

billingDetails
object
required

Billing details for the customer.

callbackUrl
string
required

The URL we will callback to once the setup is complete

Example:

"https://example.com/callback"

cardDetails
object
required

Payment card information collected by you

customerId
string

The unique identifier for the customer, generated via the create-customer API.

⚠️ Please note: Provide either customerReferenceId or this field, not both, as they are mutually exclusive.

Example:

"cus_Tfd3Jq1tZxPjYVhRQW2r3"

customerReferenceId
string

Your unique identifier for the customer.

⚠️ Please note: Provide either customerId or this field, not both, as they are mutually exclusive.

Example:

"eTfd3Jq1tZxPjYVhRQW2r3"

storeFrontId
string

The unique identifier for your storefront

Example:

"sf_sK8d3Jq1tZxPjYVhRQW2rf"

phoneNumberRequired
boolean

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

Example:

false

metadata
object

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

Constraints:

  • Maximum of 50 key-value pairs allowed.
  • Each key must be no longer than 40 characters.
  • Each value must be a string and cannot exceed 500 characters.
Example:
{
"orderId": "12345",
"customerNote": "Setup for recurring payments"
}

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"