๐Ÿ“– Documentation ยท v0.1.0

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

๐Ÿ’ก
Real-world example: You sell custom sneakers at KES 8,000. A buyer in Dubai wants to pay with crypto. You add one SolPayButton to your product page. They click it, approve in Phantom wallet, and in under a second โ€” the equivalent in USDC lands in your wallet. No intermediary, no conversion fee, no waiting.

โš™๏ธ How it works

Here is the exact sequence of events when a customer pays on your site:

1

Merchant adds the SolPayButton to their site

You copy one component tag into your website code. You pass it three things: your wallet address, the price, and the token (SOL, USDC, or BONK).
2

Customer clicks the button

A beautiful checkout modal pops up showing the amount, a QR code, and a Connect Wallet button. The customer can pay from desktop (Phantom browser extension) or mobile (Phantom app via QR scan).
3

Your server builds the transaction

SolPay's API route creates a Solana transaction instruction: "transfer X from buyer to merchant." This is sent to the browser. Importantly โ€” your server cannot sign or steal funds. Only the buyer's wallet can authorise it.
4

Buyer approves in their wallet

Phantom shows the buyer exactly what they are approving โ€” amount, destination, fee. They click Approve. Their private key signs the transaction. It is broadcast to Solana.
5

Solana confirms in under 1 second

Thousands of validators agree the transaction is valid. The funds move from buyer to your wallet. SolPay detects the confirmation and shows a success animation.
โœ…
The money is in your wallet before the confetti animation finishes. No bank. No hold. No fees beyond $0.00025.

๐Ÿš€ Quick Start

This gets you from zero to a working payment button in under 5 minutes.

bash
# 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
โ„น๏ธ
That is all you need to see SolPay running locally. The demo store at /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.

bash
npm install
npm run dev

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

bash
# 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-confetti

Then copy these files from the SolPay project into yours:

text
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-chain
โš ๏ธ
Make sure your project uses Next.js 13+ with the App Router and TypeScript. The API routes use the route.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.

bash
# .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-confirmed

Getting your Helius RPC key

1

Go to helius.dev

Visit helius.dev and click Get Started Free.
2

Sign up with Google

Takes about 30 seconds. No credit card needed.
3

Create a project

Select Devnet. Copy the RPC URL that looks like: https://devnet.helius-rpc.com/?api-key=abc123

Getting your Solana wallet address

1

Install Phantom

Go to phantom.app and install the browser extension (Chrome, Firefox, Brave) or the mobile app.
2

Create a wallet

Follow the setup. Write down your seed phrase โ€” this is your password and cannot be recovered.
3

Copy your address

Click your wallet name at the top of Phantom. It copies your public address โ€” paste it as NEXT_PUBLIC_MERCHANT_WALLET.
๐Ÿ’ก
For testing, switch Phantom to Devnet mode: Settings โ†’ Developer Settings โ†’ Testnet Mode. Then get free devnet SOL at faucet.solana.com.

๐Ÿ”˜ SolPayButton

This is the component you add to any product page. It opens the full checkout modal when clicked.

Basic usage

tsx
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)

tsx
<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

tsx
<SolPayButton ... size="sm" />   {/* small โ€” fits inside a card */}
<SolPayButton ... size="md" />   {/* medium โ€” default */}
<SolPayButton ... size="lg" />   {/* large โ€” hero section CTA */}

Props reference

PropTypeDefaultDescription
merchantWalletrequiredstringโ€”Your Solana wallet address โ€” where payments land.
amountrequirednumberโ€”The price in the chosen token (e.g. 89.99 for USDC).
tokenstring"SOL"Which token to accept. Options: "SOL", "USDC", "BONK".
labelstring"Pay with SOL"Button text and modal heading.
descriptionstringโ€”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.
classNamestringโ€”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.

tsx
'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.

SO
SOLSolana

Native Solana token. Fast, ultra-cheap ($0.00025/tx). Price fluctuates with market.

Best for: Donations, tips, micro-payments

US
USDCUSD Coin

1 USDC = 1 USD always. Stablecoin. Perfect for product sales where you need a fixed price.

Best for: Products, services, subscriptions

BO
BONKBonk

Popular Solana meme coin. Fun for community-driven stores and NFT drops.

Best for: NFTs, community stores, fun demos

๐Ÿ’ก
For a sneaker store or any physical product โ€” always use USDC. Price in USDC means your buyer pays exactly $89.99 and you receive exactly $89.99. No exchange rate risk.

๐Ÿ”” 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.

bash
# In .env.local โ€” set your backend endpoint
MERCHANT_WEBHOOK_URL=https://yoursite.com/api/payment-confirmed

SolPay will POST this payload to your URL when a payment confirms:

json
{
  "signature": "5xV9kJME8qP3nRtYw...",
  "amount": 89.99,
  "token": "USDC",
  "fromWallet": "BuyerWalletAddress",
  "toWallet": "YourWalletAddress",
  "label": "Air Max 95",
  "timestamp": 1716912345678
}

Example webhook handler (Next.js)

tsx
// 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)

bash
# 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_NETWORK

After 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)

bash
# 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
โš ๏ธ
On mainnet, transactions use real money. Test everything thoroughly on devnet first. A confirmed transaction on Solana cannot be reversed.

โ“ FAQ

Ready to accept crypto?

Try the live demo store or check the merchant dashboard.