One endpoint, one method. Unpaid requests get a 402 describing what payment is required. Retry with a signed Circle Gateway authorization in the PAYMENT-SIGNATURE header and the mint executes on Arc. Payment comes from the payer's Gateway balance, so it needs a one-time USDC deposit into Gateway first. Retrying the same payment is safe: it never mints twice. No API keys, no accounts, no wallet connect. Payment is the only credential.
{
"to": "0x…" // required, recipient of the NFT
}
{
"x402Version": 2,
"resource": { "url": "https://the402s.xyz/mint", … },
"accepts": [{
"scheme": "exact",
"network": "eip155:5042002",
"asset": "0x3600…0000",
"amount": "1000000",
"payTo": "0x…",
"maxTimeoutSeconds": 604900,
"extra": {
"name": "GatewayWalletBatched", "version": "1",
"verifyingContract": "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"
}
}],
"limits": { "perWallet": 5 }
}
{
"success": true,
"to": "0x…",
"tokenId": 219,
"mintTxHash": "0x7f2a…",
"paymentTxHash": "0x1a9d…",
"explorer": "https://…/tx/0x7f2a…"
}
import { GatewayClient } from "@circle-fin/x402-batching/client";
const gateway = new GatewayClient({ chain: "arcTestnet", privateKey });
// once: move USDC from the wallet into Gateway (1 USDC per mint)
await gateway.deposit("1");
const { data } = await gateway.pay("https://the402s.xyz/mint", {
method: "POST",
body: { to: gateway.address },
});
// the 402 round trip is handled for you