Skip to content
Tokens land in your wallet the moment a transaction confirms. There is no action required by the recipient. Solana atomically increments the receiver’s token account balance and decrements the sender’s balance. In this guide, we cover some helpful tools for understanding your token account balance and watching for incoming payments.

​Query Token Balance

Check your stablecoin balance using the getTokenAccountBalance RPC method:

​Watch for Incoming Transfers

Subscribe to your token account for real-time payment notifications using the accountNotifications RPC method:
Note here that we are using RPC Subscriptions and a websocket connection to the Solana network. Each notification contains a base64 encoded string of the token account data. Because we know the account we are looking at is a token account, we can decode the data using the getTokenCodec method from the @solana-program/token package. The function reads the current balance before it subscribes, so each payment is the difference from the previous balance, not the account’s whole balance. A balance change tells you that funds arrived, not who sent them or which order they pay for, and two transfers that land close together can arrive as one change. To match each payment to an order, read its transaction, as in Parsing Transaction History below. Note that for production applications, you should consider a more robust streaming solution. Some options include:

​Parsing Transaction History

Solana has RPC methods that allow you to fetch an account’s transaction history (getSignaturesForAddress) and get the details of a transaction (getTransaction). To parse transaction history, we fetch recent signatures for our token account, then retrieve each transaction’s pre/post token balances. By comparing our ATA’s balance before and after each transaction, we can determine the payment amount and direction (incoming vs outgoing).
To identify the counterparty, you can scan the transaction’s token balances for another account whose balance changed in the opposite direction—if you received funds, look for an account whose balance decreased by the same amount. Because SPL token transfers can exist beyond just payments between users, this approach might yield some transactions that are not payments. A good alternative here is to use Memos.

​Limitations of Pre/Post Balance Parsing

The approach above works well for simple payment flows. However, companies processing payments at scale often need more granular and real-time data:
  • Per-instruction breakdown: A single transaction can contain multiple transfers. Pre/post balances only show the net change, not individual transfers.
  • Multi-party transactions: Complex transactions (swaps, batch payments) involve multiple accounts. Balance diffs don’t reveal the complete flow of funds.
  • Audit requirements: Financial compliance often requires reconstructing exact transfer sequences, not just final balances.
For production systems handling high volumes, consider dedicated indexing solutions that parse individual transfer instructions and provide transaction-level detail.

​Reconcile Payments with Memos

When senders include memos (invoice IDs, order numbers), you can extract them from the transaction’s message using the getTransaction RPC method and the jsonParsed encoding. The RPC only parses memos from some Memo program versions. For others, such as the program @solana-program/memo uses, the instruction carries just programId and base58 data, so match on the program id and decode the data yourself:

​Protections

A few failure modes to avoid. The checkout tutorial’s Confirm payments from your backend step implements all of them in one confirm endpoint, and its go-live step covers the edge cases real customers hit.
  • Trusting the frontend. A checkout page says “payment complete”—but did the transaction actually land? Always verify server-side by querying the RPC. Frontend confirmations can be spoofed.
  • Acting on “processed” status. Solana transactions go through three stages: processed → confirmed → finalized. A “processed” transaction can still be dropped if its block is skipped. Fulfill an order only once its payment is finalized. On mainnet that takes roughly 150 milliseconds, and confirmed reports the same block, so code that checks confirmed (as the checkout tutorial does) is equally safe. See settlement and finality.
  • Ignoring the mint. Anyone can create a token called “USDC”. Validate that the token account’s mint matches the real stablecoin mint address and token program, not just the token name.
  • Double-fulfillment. Your webhook fires, you ship the order. Network hiccup, webhook fires again. Now you’ve shipped twice. Store processed transaction signatures and check before fulfilling.
  • Matching by amount alone. Transactions are public, so anyone who sees a payment of the right amount to your address could claim it for their own order. Match each payment to its order by a unique reference (a fresh address added to the transfer as a read-only account), not by the amount.