DOCS.MD
x402 v2 · exact

THE MINT ENDPOINT

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.

> ENDPOINT
POST https://the402s.xyz/mint
Content-Type
application/json
Price
1000000 (1.00 USDC, 6 decimals)
Chain
eip155:5042002 (Arc Testnet)
Asset
USDC · 0x3600…0000
Payment header
PAYMENT-SIGNATURE (x402 v2)
Settlement
Circle Gateway, batched. Payer needs a Gateway USDC balance.
Limit
5 per wallet, counted for both the payer and the recipient
> REQUEST BODY
{
  "to": "0x…"  // required, recipient of the NFT
}
> RESPONSES
402 Payment Required: no PAYMENT-SIGNATURE header sent. The same object is base64 encoded in the PAYMENT-REQUIRED response header.
{
  "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 }
}
200 OK: payment settled, token minted
{
  "success": true,
  "to": "0x…",
  "tokenId": 219,
  "mintTxHash": "0x7f2a…",
  "paymentTxHash": "0x1a9d…",
  "explorer": "https://…/tx/0x7f2a…"
}
400
Missing or malformed recipient address, or invalid JSON
402
No payment sent, or verification or settlement failed. Nothing was charged.
403
wallet_limit: this payer or recipient already has 5. Checked before any money moves.
409
sold_out: all 2,222 minted. Or payment_in_progress: this exact payment is already being processed.
429
rate_limited: too many requests from this address. Slow down.
500
mint_failed: payment settled but the mint failed. Recorded for manual resolution, keep the paymentTxHash.
502
settlement_unknown: the payment service timed out mid settlement. Do not retry. Recorded for manual resolution.
503
facilitator_unavailable: payment service unreachable. Nothing was charged. Retry later.
> CLIENT EXAMPLE
typescript
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
> NEXT