Before you take real money
- Use a production RPC provider. Public endpoints are rate-limited and not meant for production traffic. See RPC providers.
- Swap devnet values for mainnet ones. Set
RPC_URL,RPC_SUBSCRIPTIONS_URLandUSDC_MINTfrom the table below. If you also show the Solana Pay QR code from step 2, point its RPC URLs andsplTokenat mainnet too. - Create the store’s USDC account first. The payment goes to the store wallet’s USDC token account. If that account doesn’t exist, the transfer fails. Opening it costs a small refundable deposit (see rent below).
- Match payments to orders with a reference. Give every order a fresh
reference, attach it to the payment as
payStoredoes, and check it, asverifyPaymentdoes. Never match by amount alone: two customers can pay $20 at the same moment. - Record each signature once. Enforce it in your database with a unique constraint, so a reused signature can’t confirm a second order.
- Handle expired and failed transactions. A transaction expires if it isn’t confirmed within 150 blocks of its recent blockhash, about 30 seconds at 200ms slots. Let the customer retry, which builds a new transaction.
- Fulfill only finalized payments. Never act on
processed: its block can still be skipped. Fulfill an order once its payment isfinalized. On mainnet that takes roughly 150 milliseconds, andconfirmed, whichverifyPaymentchecks, reports the same block, so that check already meets this rule. See settlement and finality. - Use notifications instead of polling. See Indexing and webhooks.
- Decide who pays network fees. See fee sponsorship below.
Devnet vs mainnet values
| Setting | Devnet (testing) | Mainnet (real money) |
|---|---|---|
RPC_URL | https://api.devnet.solana.com | Your RPC provider’s HTTPS URL |
RPC_SUBSCRIPTIONS_URL | wss://api.devnet.solana.com | Your RPC provider’s WebSocket URL |
USDC_MINT | 4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU (Explorer) | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v (Explorer) |
| USDC decimals | 6 | 6 |
| Money | Free test USDC from the Circle faucet | Real USDC |
verifyPayment, as the example does: anyone can create a token called “USDC”,
but only these mints are the real thing.