Skip to main content
POST
/
payments
/
x
/
pay
Pay to X user
curl --request POST \
  --url https://api.example.com/payments/x/pay \
  --header 'Content-Type: application/json' \
  --data '
{
  "amount": 1,
  "receiver": "snackmoneyapp"
}
'
import requests

url = "https://api.example.com/payments/x/pay"

payload = {
"amount": 1,
"receiver": "snackmoneyapp"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({amount: 1, receiver: 'snackmoneyapp'})
};

fetch('https://api.example.com/payments/x/pay', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
{
  "code": 200,
  "msg": "<string>",
  "data": {
    "txn_id": 1762890982975,
    "amount": 0.01,
    "receipt": "https://snack.money/twitter/0xmesuthere?txn=1762890982975"
  }
}
{
"code": 400,
"msg": "Validation failed",
"error": null
}
{
"code": 402,
"accepts": [
{
"maxAmountRequired": "1030000",
"extra": {
"name": "USD Coin",
"version": "2"
},
"scheme": "exact",
"network": "base",
"resource": "https://snack.money",
"description": "<string>",
"mimeType": "<string>",
"payTo": "0x1223d566f05Ea54E5854434C4552c9f5C2259e0f",
"maxTimeoutSeconds": 60,
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}
],
"x402Version": 1,
"msg": "PAYMENT-SIGNATURE header is required"
}
{
"code": 500,
"msg": "Internal server error",
"error": "Something went wrong"
}

Body

application/json
amount
number
required
Required range: 0.01 <= x <= 10
Example:

1

receiver
string
required
Minimum string length: 1
Example:

"snackmoney"

currency
enum<string>
default:USDC
Available options:
USDC
Example:

"USDC"

description
string | null
Example:

"Description about the payment"

transaction_hash
string | null
Example:

"Transaction Hash"

meta
object

Response

Success

code
enum<number>
required
Available options:
200
msg
string
required
data
object
required