X402 payment endpoint
Authorize a single x402 payment for a specific resource using the agent's JWT.
Request:
bash
curl -X POST https://walletapi.fluxapay.xyz/api/payment/x402V1Payment \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $JWT_TOKEN" \
-d '{
"scheme": "exact",
"network": "base",
"amount": "10000",
"currency": "USDC",
"assetAddress": "0x833589fCD6Edb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0xfA0eE7B2F13D80680F31771abc93D06a2C749150",
"host": "x402whois.com",
"resource": "https://x402whois.com/api/v1/whois?domain=fluxapay.xyz",
"description": "WHOIS lookup for fluxapay.xyz",
"tokenName": "USD Coin",
"tokenVersion": "2",
"validityWindowSeconds": 60
}'Notes:
- Set
Authorization: Bearer $JWT_TOKENusing the JWT from agent registration. - Body parameters should mirror the bill you're paying:
scheme,network,amount(base units),assetAddress,payTo,host,resource,description,tokenName,tokenVersion,validityWindowSeconds.
Attach X‑Payment and retry the original call
When POST /api/payment/x402V1Payment succeeds, the response contains xPaymentB64. Attach it to the retried request as an X-Payment header.
Example:
bash
curl -H "X-Payment: {xPaymentB64}" \
"https://x402whois.com/api/v1/whois?domain=fluxapay.xyz"Validity:
- The signature expires quickly (see
validityWindowSeconds). If the resource returns an expiration error, call the payment endpoint again to obtain a fresh authorization. - If you previously received an
approvalId, include it on the nextx402V1Paymentcall so the server can skip approval again.
