v1

latestOpenAPI 3.0.1MIT2026-07-26336777.7 KB

This API is the first API to be called when the payment flow begins. Through this API, you inform xPay of the intent of the user to pay with all the requisite info about the user.

post/payments/create-intent

Headers

Idempotency-Keystring

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

x-connect-merchant-idstring

A Connect merchant ID owned by the authenticated Platform. Required when a Platform merchant creates a payment intent on behalf of a Connect merchant. See Platform Connect.

Request body

amountinteger required

The amount in lowest count unit. e.g.: For USD 1, amount is 100 representing 100 cents (The minimum amount should be greater than 1 USD)

currencystring required

Three letter abbreviation of the currency. Refer supported currencies

receiptIdstring

Your identifier of the order

customerReferenceIdstring

Your unique identifier for the customer. This can be used to associate the payment with a specific customer in your system.

descriptionstring

The description of the order, if any

callbackUrlstring required

The URL we will callback to with the xIntentId once it finishes.

cancelUrlstring

The URL to redirect the customer to when they cancel the payment. If not provided, the callbackUrl will be used as fallback.

paymentMethodsstring[]

List of payment methods to be enabled for the link. supported payment methods

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

metadataobject

A collection of key-value pairs that can be attached to an object for storing additional structured information. This is useful for capturing custom data or context-specific attributes.

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.
phoneNumberRequiredboolean

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

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

🔵 Beta Feature - The unique identifier for your storefront. This ID is used to associate the payment with a specific storefront in your account. When provided, it will replace the default DBA and logo with the corresponding storefront's branding. This feature is currently in beta testing and may be subject to changes.

To enable this feature, please contact hello@xpaycheckout.com

tokeniseboolean

This boolean tokenises and stores the card to showcase the same card in future. If sending this value, corresponding customerId is also required. You will receive payment_method_token.created webhook every time a new payment method token is created.

allowedCardInstallmentTenuresstring[]

Optional. Restricts which Card Installment (EMI) tenures (in months) are offered at checkout. If omitted, all tenures enabled on your account are offered.

platformFeeInBpsinteger

Optional additional fee in basis points (1 bps = 0.01%). Only available to Platform merchants when creating a payment intent on behalf of a Connect merchant (requires the x-connect-merchant-id header). See Platform Connect.

Example request

{
  "amount": 100,
  "currency": "USD",
  "receiptId": "order123",
  "customerDetails": {
    "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"
    }
  },
  "customerReferenceId": "eTfd3Jq1tZxPjYVhRQW2r3",
  "description": "Order for 2 items",
  "callbackUrl": "https://example.com/callback",
  "cancelUrl": "https://example.com/cancel",
  "paymentMethods": [
    "CARD",
    "GOOGLE_PAY",
    "APPLE_PAY"
  ],
  "metadata": {
    "orderId": "12345",
    "customerNote": "Deliver after 5 PM"
  },
  "customerId": "cus_Tfd3Jq1tZxPjYVhRQW2r3",
  "storeFrontId": "sf_sK8d3Jq1tZxPjYVhRQW2rf",
  "productPage": {
    "name": "Premium Subscription",
    "description": "Access to premium features and content"
  },
  "allowedCardInstallmentTenures": [
    "three",
    "six"
  ],
  "platformFeeInBps": 100
}

Response

Create Intent response

amountinteger

The amount in lowest count unit (e.g., cents for USD)

currencystring

Three-letter currency code

presentmentCurrencystring

The currency that the customer paid in

receiptIdstring

Your identifier for the order

descriptionstring

Description of the order, if any

callbackUrlstring

Callback URL to notify order status

cancelUrlstring

The URL to redirect the customer to when they cancel the payment.

createdAtstring date-time

Timestamp of when the intent was created

statusstring

Current status of the intent. Refer payment statuses

xIntentIdstring

Unique identifier of the intent

fwdUrlstring

The URL to redirect the customer to the xPay payment gateway for payment.

metadataobject

A collection of key-value pairs that were provided when the object was created. These metadata values are echoed back in the response, allowing you to store and retrieve custom information such as context-specific attributes, references, or tags. This can be useful for correlating records in your system or attaching meaningful context to transactions.

Example response

{
  "amount": 100,
  "currency": "USD",
  "presentmentCurrency": "USD",
  "receiptId": "order123",
  "customerDetails": {
    "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"
    }
  },
  "description": "Order for 2 items",
  "callbackUrl": "https://example.com/callback",
  "cancelUrl": "https://example.com/cancel",
  "createdAt": "2024-09-26T10:41:50.472+00:00",
  "status": "CREATED",
  "xIntentId": "in_fooBOwYsaK50AEfK",
  "fwdUrl": "https://pay.xpaycheckout.com/?xpay_intent_id=67f53a6e2097773e4f0112c8",
  "metadata": {
    "orderId": "12345",
    "customerNote": "Deliver after 5 PM"
  }
}