Solana Pay Basics
7 examples for payment requests and QR flows - 4 basic and 3 intermediate.
Search across all documentation pages
7 examples for payment requests and QR flows - 4 basic and 3 intermediate.
npm install @solana/pay @solana/kit@7.0.0Solana Pay URLs encode recipient, amount, and label.
import { encodeURL } from "@solana/pay";
import { address } from "@solana/kit";
const url = encodeURL({
recipient: address("MERCHANT_PUBKEY"),
amount: 1_000_000n,
label: "Coffee",
});Render URL as QR for in-person checkout.
import QRCode from "react-qr-code";
// <QRCode value={url.toString()} />Attach reference account to correlate payments.
// encodeURL({ ..., reference: [referencePubkey] })Label and message fields improve wallet UX.
encodeURL({ label: "Shop", message: "Order #1234", ... });Server returns partially built transaction instead of simple transfer.
// GET https://merchant.com/api/solana-pay?account=...import { createSolanaRpc } from "@solana/kit";
const rpc = createSolanaRpc(process.env.RPC_URL!);
// find tx mentioning reference + amountShareable action URLs embed in social posts.
https://actions.example.com/swap?...Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 19, 2026