Skip to main content

x402 v2 purchase of credits (`deposit` / `depositFor`). Unpaid request -> 402 challenge, paid retry -> settle before serve.

POST 

/v1/x402/topup

These rules hold on both API hosts, and the same rules apply to /v1/x402/purchase:

  • accepted is verified by recomputing extra.quoteMac, never by a lookup, because the challenge may have been issued by the other API host.
  • The payment record keyed by extensions["payment-identifier"].id is written to the database before anything is co-signed. If the database is unreachable the answer is 503 UPSTREAM_UNAVAILABLE and nothing is co-signed. The same id with the same payload returns the stored result; the same id with another payload gives 402 PAYMENT_INVALID.
  • 503 CONTRACT_PAUSED / 503 SWAP_VENUE_PAUSED are answered before any co-signature.
  • asset, network and payTo are the values of the serving network (USDC-c76f1f / multiversx:1 on mainnet, USDC-350c4e / multiversx:D on devnet staging).

Request​

Responses​

Payment executed successfully on chain and the deposit event was mirrored.

Response Headers
    PAYMENT-RESPONSE

    x402 v2 - base64 of a JSON X402SettlementResponse.