Quartermaster

Guides / Accept Solana USDC in your API with x402

Accept Solana USDC in your API with x402

Solana settles a USDC micropayment in one to two seconds for a fraction of a cent, and with x402 your buyers never need to hold SOL at all. This guide covers what it actually takes to add a Solana rail to an HTTP API — the exact fields your 402 challenge must carry, the token-account gotcha that breaks first payments, an honest look at facilitators, and a devnet-first test plan.

The x402 flow, briefly

x402 v2 is a small loop over plain HTTP. Your server answers an unpaid request with 402 and a PAYMENT-REQUIRED header containing base64-encoded JSON. The client pays, retries with a PAYMENT-SIGNATURE header, and your server returns 200 plus a PAYMENT-RESPONSE receipt. On Solana (SVM), only the exact scheme exists today; EVM additionally has upto and batch settlement. The protocol now lives at the x402 Foundation under the Linux Foundation, with the Solana Foundation as a member — the Solana rail is a first-class part of the spec, not a side fork.

What the 402 challenge must contain on Solana

The accepts array in your challenge lists every way a client may pay. A Solana entry needs five things done precisely:

HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: base64 of:
{
  "x402Version": 2,
  "accepts": [
    {
      "scheme": "exact",
      "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
      "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "payTo": "YOUR_OWNER_WALLET_BASE58",
      "amount": "10000",
      "extra": { "feePayer": "FACILITATOR_FEE_PAYER_PUBKEY" }
    },
    { "...": "your existing Base USDC entry stays here" }
  ]
}

Why pin the exact mint address?

USDC on Solana is Circle-issued, but nothing stops anyone from minting a token named USDC. A verifier that matches on symbol instead of mint address can be paid in worthless tokens. Every check in your stack — challenge, facilitator, your own receipt verification — should compare against the one pinned mint.

The token account that must already exist

The most common first-payment failure on Solana is not a code bug. The on-chain destination is your wallet's USDC Associated Token Account, and the x402 payment flow cannot create it. A fresh wallet that has never held USDC has no ATA, so every payment to it fails until one exists.

The two-minute fix: before going live, send any tiny USDC transfer to your payTo wallet from another wallet. The sender's transfer auto-creates the ATA, and it exists permanently after that. Do this once on devnet and once on mainnet, and the failure mode disappears.

Which facilitator should you use?

The facilitator verifies the payment, co-signs as fee payer, and submits the transaction. Solana support as live-verified in mid-July 2026:

FacilitatorSolana networksSetupCost and notes
PayAI (facilitator.payai.network)Mainnet + devnetKeyless, no accountSponsors all gas; fastest path from zero to live
Coinbase CDPMainnet + devnetCDP API keys1,000 free tx/month, then $0.001/tx; CDP is the fee payer; settlements with discovery metadata get indexed in the Bazaar
thirdwebMainnetthirdweb secret keyNo keyless mode
x402.org / x402.rsDevnet onlyNoneTesting only, not production

The honest tradeoff: keyless PayAI has the least friction and no per-transaction bill, but you are trusting a third party to keep sponsoring gas. CDP costs money past the free tier and requires key management, but it is the route into Bazaar discovery. thirdweb makes sense mainly if you are already on that stack. There is no wrong answer for a first deployment; there is a wrong answer for never testing a second one.

Registering the SVM scheme next to your EVM scheme

The client library is @x402/svm on npm, built on Solana Kit, and it composes with @x402/fetch exactly like the EVM scheme does:

// buyer side
const client = new x402Client()
  .register("solana:*", new ExactSvmScheme(svmSigner))
  .register("eip155:*", new ExactEvmScheme(evmSigner));

// seller side: @x402/hono and the other server middlewares
// take the same scheme registrations, so one handler
// serves both rails from a single accepts array

This is the point of the accepts array: publish a Base entry and a Solana entry side by side, and each agent pays on whichever rail its wallet supports. You price once, in atomic units per rail, and the client chooses.

How do buyers pay with zero SOL?

On Solana the payment payload is a base64-encoded, partially signed versioned transaction the client builds: SetComputeUnitLimit, SetComputeUnitPrice, a TransferChecked, and a Memo — three to six instructions, with only Memo or Lighthouse extras allowed. The client signs as the token owner; the facilitator co-signs as feePayer and submits. Because the sponsor pays the network fee, a buyer holding only USDC and no SOL can pay you. Contrast with Base, where the client signs an EIP-3009 transferWithAuthorization struct rather than a full transaction, and the recipient is a wallet address with no token-account indirection.

How long does the payment window last?

A Solana transaction references a recent blockhash with a lifetime of roughly 60–90 seconds (about 150 slots), and the exact scheme does not use durable nonces. The entire 402 → pay → settle round-trip must finish inside that window, or the transaction can never land. In practice: do not put slow work — queues, human approval, cold starts — between issuing the challenge and settling the payment.

Verifying a Solana settlement server-side

The settlement response carries a base58 transaction signature (87–88 characters), versus EVM's 0x plus 64 hex. To verify independently:

const tx = await rpc.getTransaction(signature, {
  encoding: "jsonParsed",
  commitment: "confirmed",
  maxSupportedTransactionVersion: 0
});
// 1. require tx.meta.err === null
// 2. diff meta.preTokenBalances vs meta.postTokenBalances
// 3. match the net delta where owner === your payTo wallet
//    and mint === the pinned USDC mint
// 4. compare amounts as integers in atomic units (never floats)

The balance-diff approach needs no ATA math and automatically nets out Token-2022 transfer fees. confirmed lands in about 1–2 seconds, and no optimistically-confirmed Solana block has ever been rolled back; finalized takes about 13 seconds if you want it. Two RPC caveats: api.mainnet-beta.solana.com blocks datacenter IPs and is not for production, and public nodes are non-archival, so old signatures return null. Verify payments promptly and persist your own receipt. If you would rather not run RPC checks yourself, Quartermaster's GET /v1/payment-proof ($0.003) and GET /v1/settlement-assurance ($0.03) accept a base58 Solana signature or a 0x Base hash interchangeably.

Will the Bazaar list your endpoint?

The Coinbase x402 Bazaar indexes Solana endpoints at scale — in a July 2026 sample, roughly a quarter of listed resources were Solana, all mainnet USDC. Indexing happens when settlements flow through the CDP facilitator with discovery metadata attached, which is the strongest argument for CDP over a keyless facilitator if discovery matters to you. A candid caveat on the market numbers: analyst estimates put Base ahead on cumulative value settled and Solana ahead on transaction count, but independent analyses also estimated that a large majority of peak-period x402 transactions were non-organic — bots and self-dealing. Raw counts overstate real demand, so build for actual buyers, not leaderboard position. You can watch per-rail activity on the Quartermaster ecosystem dashboard.

Test on devnet before mainnet

Everything above has a devnet twin: network solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1, USDC mint 4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU, and devnet support from PayAI, CDP, x402.org, and x402.rs. Run the full loop there first: pre-create the ATA with a tiny transfer, issue the challenge, pay from a SOL-less test wallet, and verify the settlement with the balance-diff check. When it passes end to end, going to mainnet is a three-string change — network id, mint, and facilitator URL.

Check your work before agents do. Point the free x402 Inspector at your endpoint — it understands both Base and Solana challenges and flags malformed fields before a buyer ever sees them. For a machine-readable grade, GET /v1/x402-audit scores any endpoint on any rail for $0.01. And when you want the full picture, the $9 AI-reviewed endpoint report walks your challenge, settlement, and discovery posture end to end. Quartermaster prices are the same whichever rail you pay on.

Last updated 2026-07-17. Written from the x402 specification, the x402-foundation reference implementation, facilitator /supported endpoints, and live Coinbase Bazaar data. Corrections: dev@surewhynot.app.

More guides: Base vs Solana for x402 sellers: an honest comparison · How to verify a Solana x402 settlement · Common Solana x402 mistakes (and how to fix them)