SolPay Docs
Everything you need to accept Solana payments on your website โ from a sneaker store to a SaaS platform.
๐ What is SolPay?
SolPay is an open-source checkout toolkit for the Solana blockchain. Think of it like Stripe, but for crypto. Instead of setting up a merchant account, dealing with bank transfers, or waiting 3 days for settlement โ you add one React component to your site, pass it your Solana wallet address, and your customers can pay you in SOL, USDC, or BONK instantly.
You do not need to know anything about blockchain to use SolPay. If you can build a website with Next.js, you can accept Solana payments in under 5 minutes.
< 1 second
Settlement
$0.00025
Fee per tx
1 component
Integration
โ๏ธ How it works
Here is the exact sequence of events when a customer pays on your site:
Merchant adds the SolPayButton to their site
Customer clicks the button
Your server builds the transaction
Buyer approves in their wallet
Solana confirms in under 1 second
๐ Quick Start
This gets you from zero to a working payment button in under 5 minutes.
# 1. Clone or download the SolPay project
git clone https://github.com/your-username/solpay
cd solpay
# 2. Install dependencies
npm install
# 3. Copy the environment file
cp .env.example .env.local
# 4. Fill in your values (see Environment Setup section below)
# 5. Run the dev server
npm run dev
# Open http://localhost:3000/demo and dashboard at /dashboard are ready to use immediately on devnet.๐ฆ Installation
Option A โ Use SolPay as a full project (recommended for hackathon)
Download the complete SolPay project and run it as your own Next.js app. Customise the demo store, add your products, change the branding โ it is all yours.
npm install
npm run devOption B โ Add SolPay to an existing Next.js project
If you already have a Next.js site (like a sneaker store), you can copy just the components and API routes you need into your existing project.
# Install required dependencies into your existing project
npm install @solana/web3.js @solana/wallet-adapter-react \
@solana/wallet-adapter-react-ui @solana/wallet-adapter-phantom \
@solana/pay qrcode.react canvas-confettiThen copy these files from the SolPay project into yours:
Files to copy into your project:
โโโ components/
โ โโโ CheckoutModal.tsx โ The full checkout UI
โ โโโ SolPayButton.tsx โ The button you add to product pages
โ โโโ WalletProvider.tsx โ Wrap your app layout with this
โโโ lib/
โ โโโ solana.ts โ RPC connection helper
โ โโโ tokens.ts โ SOL / USDC / BONK config
โโโ app/api/
โโโ create-transaction/route.ts โ Builds the Solana tx
โโโ verify-transaction/route.ts โ Confirms on-chainroute.ts convention.๐ Environment Setup
You need two things: a Helius RPC key (for fast Solana access) and your wallet address (where payments go). Both are free.
# .env.local (create this file in your project root)
# Your Helius RPC key โ get free at https://helius.dev
NEXT_PUBLIC_HELIUS_RPC_URL=https://devnet.helius-rpc.com/?api-key=YOUR_KEY
# Your Solana wallet address (from Phantom)
NEXT_PUBLIC_MERCHANT_WALLET=YOUR_WALLET_ADDRESS
# "devnet" for testing (free), "mainnet-beta" for real money
NEXT_PUBLIC_SOLANA_NETWORK=devnet
# Optional: fires a POST to your backend when a payment confirms
MERCHANT_WEBHOOK_URL=https://yoursite.com/api/payment-confirmedGetting your Helius RPC key
Go to helius.dev
Sign up with Google
Create a project
https://devnet.helius-rpc.com/?api-key=abc123Getting your Solana wallet address
Install Phantom
Create a wallet
Copy your address
NEXT_PUBLIC_MERCHANT_WALLET.๐ SolPayButton
This is the component you add to any product page. It opens the full checkout modal when clicked.
Basic usage
import { SolPayButton } from '@/components/SolPayButton';
// On any page โ a sneaker product page, a SaaS pricing page, etc.
<SolPayButton
merchantWallet="YourSolanaWalletAddress"
amount={0.5}
token="SOL"
label="Buy Air Max 95"
/>With USDC (stablecoin โ recommended for products)
<SolPayButton
merchantWallet="YourSolanaWalletAddress"
amount={89.99}
token="USDC"
label="Buy Sneaker Bundle"
description="Air Max 95 + socks, size 42"
onSuccess={(signature) => {
console.log('Payment confirmed!', signature);
// redirect to order confirmation, send email, etc.
}}
/>Sizes
<SolPayButton ... size="sm" /> {/* small โ fits inside a card */}
<SolPayButton ... size="md" /> {/* medium โ default */}
<SolPayButton ... size="lg" /> {/* large โ hero section CTA */}Props reference
| Prop | Type | Default | Description |
|---|---|---|---|
merchantWalletrequired | string | โ | Your Solana wallet address โ where payments land. |
amountrequired | number | โ | The price in the chosen token (e.g. 89.99 for USDC). |
token | string | "SOL" | Which token to accept. Options: "SOL", "USDC", "BONK". |
label | string | "Pay with SOL" | Button text and modal heading. |
description | string | โ | Subtitle shown in the checkout modal (e.g. product details). |
onSuccess | (sig: string) => void | โ | Called with the transaction signature when payment confirms. |
size | "sm"|"md"|"lg" | "md" | Controls the button padding and font size. |
className | string | โ | Extra Tailwind classes for the button wrapper. |
๐ณ CheckoutModal
If you want more control โ for example, triggering the checkout from your own button โ you can use CheckoutModal directly.
'use client';
import { useState } from 'react';
import { CheckoutModal } from '@/components/CheckoutModal';
export default function ProductPage() {
const [open, setOpen] = useState(false);
return (
<>
{/* Your own custom button */}
<button onClick={() => setOpen(true)}>
Buy Now โ 0.5 SOL
</button>
<CheckoutModal
isOpen={open}
onClose={() => setOpen(false)}
amount={0.5}
token="SOL"
merchantWallet="YourWalletAddress"
label="Air Max 95"
description="Size 42 ยท Black colourway"
onSuccess={(signature) => {
setOpen(false);
alert('Payment done! Sig: ' + signature);
}}
/>
</>
);
}๐ช Supported Tokens
SolPay currently supports three tokens. USDC is recommended for e-commerce because its value is stable.
Native Solana token. Fast, ultra-cheap ($0.00025/tx). Price fluctuates with market.
Best for: Donations, tips, micro-payments
1 USDC = 1 USD always. Stablecoin. Perfect for product sales where you need a fixed price.
Best for: Products, services, subscriptions
Popular Solana meme coin. Fun for community-driven stores and NFT drops.
Best for: NFTs, community stores, fun demos
๐ Webhooks
Webhooks let you run code on your server when a payment confirms โ send a confirmation email, mark an order as paid, trigger shipping, etc.
# In .env.local โ set your backend endpoint
MERCHANT_WEBHOOK_URL=https://yoursite.com/api/payment-confirmedSolPay will POST this payload to your URL when a payment confirms:
{
"signature": "5xV9kJME8qP3nRtYw...",
"amount": 89.99,
"token": "USDC",
"fromWallet": "BuyerWalletAddress",
"toWallet": "YourWalletAddress",
"label": "Air Max 95",
"timestamp": 1716912345678
}Example webhook handler (Next.js)
// app/api/payment-confirmed/route.ts
import { NextRequest, NextResponse } from 'next/server';
export async function POST(req: NextRequest) {
const { signature, amount, token, label } = await req.json();
// Do whatever you need:
// - Send confirmation email
// - Mark order as paid in your database
// - Trigger Shopify fulfillment
// - Send a WhatsApp message
console.log(`Payment of ${amount} ${token} confirmed for: ${label}`);
console.log(`Verify at: https://solscan.io/tx/${signature}`);
return NextResponse.json({ ok: true });
}๐ Deployment
Deploy to Vercel (recommended โ free)
# Install Vercel CLI
npm install -g vercel
# Deploy from your project folder
cd solpay
vercel
# Follow the prompts โ it will ask for your env variables.
# Add these three when prompted:
# NEXT_PUBLIC_HELIUS_RPC_URL
# NEXT_PUBLIC_MERCHANT_WALLET
# NEXT_PUBLIC_SOLANA_NETWORKAfter deployment Vercel gives you a URL like solpay.vercel.app. Share this with hackathon judges so they can test it live.
Switch from devnet to mainnet (real money)
# In .env.local (or Vercel env vars)
NEXT_PUBLIC_SOLANA_NETWORK=mainnet-beta
NEXT_PUBLIC_HELIUS_RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_KEYโ FAQ
Ready to accept crypto?
Try the live demo store or check the merchant dashboard.