Skip to content

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_TOKEN using 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 next x402V1Payment call so the server can skip approval again.

Intent fields (optional)

You can attach intent metadata to help the system create or match a mandate:

  • intentNaturalLanguage — human-readable description of the spending intent.
  • intentCategory — category label (e.g. api-usage).
  • intentLimitAmount — total budget in atomic units.
  • intentMaxAmountPerTx — per-transaction cap in atomic units.
  • intentValidFrom / intentValidUntil — ISO timestamps bounding the intent window.

These fields are informational for V1. To use mandate-based automatic payments, see X402 V3 payment.

Released under the MIT License.