Create a simple checkout flow with Solana Pay

Nhi NguyenNhi Nguyen
1 min read

(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.

0
Subscribe to my newsletter

Read articles from Nhi Nguyen directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nhi Nguyen
Nhi Nguyen

Developer, builder for the future