Skip to main content
POST
/
s2s
/
payments
/
charge
/
token
cURL
curl --request POST \
  --url https://api.xpaycheckout.com/s2s/payments/charge/token \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '{
  "amount": 10000,
  "currency": "USD",
  "customer_id": "cus_Tfd3Jq1tZxPjYVhRQW2r3",
  "card_token": "tok_4xK2Nm1tYwOiXUgPQV1r2",
  "receiptId": "receipt_abc123",
  "channel": "web",
  "description": "",
  "callback_url": "https://yourserver.com/webhook",
  "metadata": {}
}'
{
  "payment_id": "pay_8Ks3Jq1tZxPjYVhRQW2r5",
  "status": "SUCCESS",
  "transaction_id": "txn_9Ls4Kp2uAxQkZWiSRX3s6",
  "amount": 10000,
  "currency": "USD",
  "customer_id": "cus_Tfd3Jq1tZxPjYVhRQW2r3",
  "receiptId": "receipt_abc123",
  "channel": "web",
  "payment_method": "CARD",
  "card_token": "tok_4xK2Nm1tYwOiXUgPQV1r2",
  "processed_at": 1728128160000,
  "created_at": 1728128100000
}
Charges a payment using a saved card token. Returns a payment_id with the transaction result.

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

Charge with Token Request

amount
integer
required

Amount in smallest currency unit (e.g., cents)

Example:

10000

currency
string
required

Three-letter currency code

Example:

"USD"

customer_id
string
required

Unique customer identifier

Example:

"cus_Tfd3Jq1tZxPjYVhRQW2r3"

card_token
string
required

Saved card token

Example:

"tok_4xK2Nm1tYwOiXUgPQV1r2"

receiptId
string
required

Client's receipt identifier

Example:

"receipt_abc123"

callback_url
string
required

Webhook URL for payment status updates

Example:

"https://yourserver.com/webhook"

channel
string

Channel identifier (e.g., "web", "ios", "android")

Example:

"web"

description
string

Payment description

Example:

""

metadata
object

Additional key-value pairs (max 50 pairs)

Response

Payment charged successfully

payment_id
string
Example:

"pay_8Ks3Jq1tZxPjYVhRQW2r5"

status
enum<string>
Available options:
SUCCESS,
FAILED
Example:

"SUCCESS"

transaction_id
string

Transaction ID (returned for successful payments)

Example:

"txn_9Ls4Kp2uAxQkZWiSRX3s6"

amount
integer
Example:

10000

currency
string
Example:

"USD"

customer_id
string
Example:

"cus_Tfd3Jq1tZxPjYVhRQW2r3"

receiptId
string
Example:

"receipt_abc123"

channel
string
Example:

"web"

payment_method
string
Example:

"CARD"

card_token
string

Card token if card was saved

Example:

"tok_4xK2Nm1tYwOiXUgPQV1r2"

processed_at
integer

Epoch timestamp in milliseconds of when payment was processed

Example:

1728128160000

created_at
integer

Epoch timestamp in milliseconds of when payment was created

Example:

1728128100000