System Requirements
- Node.js: Version 20.18 or higher, the floor
@solana/kitdeclares (Node.js 20 or later also provides the Ed25519crypto.subtlesupport) - Package manager: npm, which ships with Node.js
- TypeScript: Version 5+ (recommended but not required)
Install Solana Pay SDK
Peer Dependencies
@solana/pay declares all of these packages as required peer dependencies. npm
7 and later installs them with @solana/pay:
| Package | Version |
|---|---|
@solana/kit | ^6.5.0 |
@solana/keys | ^6.5.0 |
@solana/rpc-subscriptions-api | ^6.5.0 |
@solana/rpc-subscriptions-spec | ^6.5.0 |
@solana-program/system | ^0.12 |
@solana-program/token | ^0.12 |
@solana-program/token-2022 | ^0.9 |
@solana-program/memo | ^0.11 |
@solana/kit-plugin-rpc | ^0.8 |
@solana/kit-plugin-payer | ^0.8 |
@solana/kit-plugin-instruction-plan | ^0.8 |
Packages Your Code Imports
Add the peers your own code imports to yourpackage.json, so their versions
stay pinned. For transfer creation and validation (SOL and SPL token
transfers):
createMerchantClient, createWalletClient), also
install the kit plugins:
Use ES Modules
Many examples in these guides use top-levelawait, which only works in an ES
module. In a default npm init project ("type": "commonjs"),
npx tsx file.ts fails with Top-level await is currently not supported with the "cjs" output format. Set the package type to module, or name your files
with the .mts extension:
TypeScript Configuration
If using TypeScript, ensure yourtsconfig.json includes:
Environment Setup
Development Environment
Set up environment variables for development:Production Environment
For production, use mainnet endpoints:Verify Installation
Create a simple test to verify everything is working:Common Issues and Solutions
Module Resolution Errors
If you see errors like “Cannot resolve module ‘@solana/pay’”:-
Clear the npm cache:
-
Delete
node_modulesand reinstall:
TypeScript Errors
If you encounter TypeScript errors:- Update to the latest TypeScript version (5+)
- Ensure
moduleResolutionis set to"bundler"or"nodenext"in yourtsconfig.json
Next Steps
Now that you have Solana Pay installed, choose your integration path:- Transfer Requests - Simple payment URLs for basic transfers
- Transaction Requests - Interactive payment flows
- QR Code Integration - Generate QR codes for mobile payments
Development Tools
Consider installing these helpful development tools:Resources
- GitHub Repository - Source code and examples
- Solana Cookbook - Solana development recipes