Create a simple checkout flow with Solana Pay

Create a simple checkout flow with Solana Pay

(Draft)

Our Goal

By the end of this article, you will know how to:

  • Set up a QR Code that a compatible Solana wallet can scan.

  • Return a valid base64 Solana Transaction that a wallet owner can approve and sign.

Dependencies:

  • @solana/pay

  • @solana/web3js

  • @solana/spl-token

API Challenge

Background: as merchant, we will need to provide 2 API endpoint that a solana crypto wallet can make a request to:

  • GET /api/checkout request to retrieve information about the merchant.

  • POST /api/checkout?total=${amount} request to retrieve a valid base64 transaction for the wallet owner to sign. Once it is signed, the wallet then submits this transaction to the blockchain to proceed the transaction.