Skip to content
Solana Pay is the standard for payment requests on Solana. Your checkout puts the order’s recipient, amount, token, and a unique reference into a transfer request URL and shows it as a QR code. The customer scans it, and their walletWallets & signaturesA wallet holds a key pair: a public address that anyone can pay, and a private key that signs approvals and never leaves the device.Learn more (Wallets & signatures: A wallet holds a key pair: a public address that anyone can pay, and a private key that signs approvals and never leaves the device.) builds the transfer, asks them to approve it, and sends it. Adding the QR code to your own app is optional: the rest of the tutorial runs without it.

​Add the payment QR code

@solana/pay is currently in beta. APIs may change before the stable release.
You need Node.js 20.18 or higher, a React or Next.js app (a fresh create-next-app is fine), and a mobile wallet set to devnet. Fund it with devnet USDC from the Circle faucet and devnet SOL from faucet.solana.com to cover transaction fees. Install Solana Pay:
The component creates a unique reference for the order, encodes it into a transfer request URL, and renders the URL as a QR code. It then watches for a transaction that includes the reference and validates the recipient, amount, and token before marking the order paid. Set MERCHANT_WALLET to an address you control:
amount is in token units, so 1 requests 1 USDC. Leave out splToken to request SOL instead.

​Take a payment

Run your app, scan the QR code with your wallet, and approve the payment. Once the transactionTransactionsA transaction is a signed request to change the shared ledger. It either fully happens or doesn't happen at all, and once confirmed anyone can look it up.Learn more (Transactions: A transaction is a signed request to change the shared ledger. It either fully happens or doesn’t happen at all, and once confirmed anyone can look it up.) confirms and passes validation, the component shows the transaction signature. That signature is your receipt: look it up with getTransaction or in any explorer.
Don’t ship orders from a browser check alone. Validation in the browser is fine for a demo, but anything that runs in the browser can be faked. In the next step your server looks the signature up on the network and checks the amount, the recipient, and the order itself.

​The transfer the wallet sends

A USDC payment is one TransferChecked instruction: move this many base units of this mint from the customer’s USDC accountToken accountsWallets don't hold tokens directly. Each token (USDC, or your own asset) gets a small account owned by the wallet, and transfers move between these accounts.Learn more (Token accounts: Wallets don’t hold tokens directly. Each token (USDC, or your own asset) gets a small account owned by the wallet, and transfers move between these accounts.) to the store’s. The wallet that scans the QR code builds it from the URL. Here’s the same payment with @solana/kit, the code behind step 1. Like the wallet, it adds the order’s reference as an extra read-only account, following the Solana Pay reference convention, so your server can match the payment to its order.
checkout/pay.ts
What Node prints for the order and the signature payStore() returns, on a local test network (Surfpool)Local test network (Surfpool)
order
{
id: 'order-1001',
storeOwner: 'DVxMtF9M6EAQ8CjqH9omYUTXdJU7hu4M8G94udRyr1m6',
amount: 1000000n,
reference: '47venn787GZLWUcgUU3QM1CpT11JHQMs8hyYQMPXKN2W'
}
const signature = await payStore(customer, order)
signature
'paxK3zbseZEZpGrmGrzm3p3VYF5XN6aTAGKS1sVt2CmkcJ2afLCTB5C84rFT8VFX6LboNFty2pzcTCiVJw5DAtJ'
Payment sent · not verified yet
The rest of the tutorial uses this code. Call payStore from your checkout when the customer pays from a wallet connected to your app rather than by scanning a QR code: it takes the customer’s signer and the order, and works in any frontend or on a server.