Is it possible to integrate Solana Pay with a program written in Rust + Anchor? I have functions written in my Rust Program code, and I want users to scan a QR code and interact with those functions. Can Solana Pay be used to make RPC calls is all I am asking.

3 Answers 3


Can Solana Pay be used to make RPC calls is all I am asking.

Yes, if by "make RPC calls" you mean "send any kind of transaction". Solana Pay transaction requests can be used to create any kind of transaction on Solana. Therefore, you can

  1. Create an API that follows this spec, returning a transaction with instruction(s) to your program(s).
  2. Encode a URL that follows this spec, targeting your API.
  3. Create a QR code that encodes the link.
  4. Scan the QR code with a wallet app that supports transaction requests. Phantom, Solflare, and Glow support them today, Slope is waiting on app store review.

Solana Pay cannot instruct a wallet to make arbitrary RPC calls, but it can instruct a wallet to send arbitrary transactions.

  • 1
    what could you possibly know about Solana Pay Jul 14, 2022 at 1:18
  • Is there any implementation example of how to implement this? There seems to have nothing related to this into the Solana docs nor in the Anchor ones Aug 8, 2022 at 22:05

You can use any transaction (any sequence of instructions to any programs, including your own) with transaction requests: https://github.com/solana-labs/solana-pay/blob/master/SPEC.md#specification-transaction-request

You'd basically need to write an API that takes a public key of the user who scanned as input, and outputs a serialized transaction, and then you can encode the URL of that API in the QR code.

You'd encode the URL by passing TransactionRequestURLFields to encodeURL. Here's an example: https://github.com/pointer-gg/solana-pay-tutorial/blob/5-coupon-v2/pages/shop/checkout.tsx#L59


SolanaPay's [createTransfer][1] function returns a transaction of type Transaction.

Using Anchor's methods builder you should be able to construct an array of transactions, including the createTransfer transaction, and pass to sendAndConfirm method of the AnchorProvider.

Not the answer you're looking for? Browse other questions tagged or ask your own question.