Developer Documentation

Paygent API

Accept Solana payments on any website with a few lines of code. REST API + embeddable widget + real-time webhooks.

Quick Start

Create a storefront in one API call
curl -X POST https://paygent-solana.vercel.app/api/storefront \
  -H "Content-Type: application/json" \
  -d '{"businessName":"My Store","walletAddress":"YOUR_WALLET","products":[...]}'

Embeddable Widget

Add a Solana Pay button to any website with a single script tag. The widget opens a modal with your storefront — no redirect needed.

HTML
<!-- Add to any website -->
<script src="https://paygent-solana.vercel.app/api/widget/YOUR-STORE-SLUG"></script>

<!-- Or target a specific element -->
<div data-paygent data-paygent-text="Buy Now with SOL"></div>
<script src="https://paygent-solana.vercel.app/api/widget/YOUR-STORE-SLUG"></script>

<!-- Listen for payment events -->
<script>
  window.addEventListener('paygent:payment', (e) => {
    console.log('Payment complete!', e.detail);
  });
</script>

API Endpoints

Base URL: https://paygent-solana.vercel.app

POST/api/storefront

Create Storefront

Create a new payment storefront with AI-generated theme and products.

Request Body
{
  "businessName": "My Coffee Shop",
  "businessDescription": "Premium specialty coffee",
  "tagline": "Wake up to web3",
  "logo": "https://example.com/logo.png",
  "walletAddress": "YOUR_SOLANA_WALLET",
  "products": [
    {
      "name": "Ethiopian Blend",
      "description": "250g whole bean",
      "price": 0.08,
      "currency": "SOL"
    }
  ],
  "links": {
    "website": "https://example.com",
    "twitter": "https://x.com/you"
  }
}
Response
{
  "success": true,
  "data": {
    "slug": "my-coffee-shop-a1b2",
    "businessName": "My Coffee Shop",
    "walletAddress": "YOUR_SOLANA_WALLET",
    "products": [...],
    "theme": { "accentColor": "#D97706", "style": "bold" },
    "createdAt": 1707000000000
  }
}
GET/api/storefront/:slug

Get Storefront

Retrieve storefront details including products, theme, and branding.

Response
{
  "success": true,
  "data": {
    "slug": "my-coffee-shop-a1b2",
    "businessName": "My Coffee Shop",
    "tagline": "Wake up to web3",
    "logo": "https://example.com/logo.png",
    "products": [...],
    "links": { "website": "...", "twitter": "..." },
    "theme": { "accentColor": "#D97706", "style": "bold" }
  }
}
POST/api/pay

Create Payment

Generate a Solana Pay transaction for a specific product. Returns a reference key for tracking.

Request Body
{
  "storefrontSlug": "my-coffee-shop-a1b2",
  "productId": "prod_abc123",
  "currency": "SOL"
}
Response
{
  "success": true,
  "data": {
    "paymentId": "pay_xyz789",
    "reference": "BASE58_PUBLIC_KEY",
    "amount": 0.08,
    "currency": "SOL",
    "recipient": "MERCHANT_WALLET",
    "memo": "Paygent:my-coffee-shop-a1b2:prod_abc123"
  }
}
GET/api/quote

Get Token Quote

Get a real-time SOL↔USDC quote via Jupiter aggregator.

Response
// GET /api/quote?amount=1&direction=sol-to-usdc
{
  "success": true,
  "data": {
    "inputToken": "SOL",
    "outputToken": "USDC",
    "inputAmount": 1,
    "outputAmount": 178.42,
    "rate": 178.42,
    "priceImpact": "0.01%"
  }
}
GET/api/dashboard/:slug

Get Dashboard

Retrieve merchant analytics — payment stats, revenue breakdown, notifications.

Response
{
  "success": true,
  "data": {
    "storefront": {...},
    "stats": {
      "totalPayments": 12,
      "confirmedPayments": 10,
      "pendingPayments": 2,
      "totalSOL": 3.45,
      "totalUSDC": 250.00,
      "feesSOL": 0.026,
      "feesUSDC": 1.88,
      "merchantSOL": 3.424,
      "merchantUSDC": 248.12,
      "recentPayments": [...]
    },
    "notifications": [...],
    "unreadCount": 3
  }
}
GET/api/fees

Get Fee Schedule

Returns current platform fee structure.

Response
{
  "success": true,
  "data": {
    "platformFeeBps": 75,
    "platformFeePercent": "0.75%",
    "swapSpreadBps": 20,
    "swapSpreadPercent": "0.20%",
    "totalMaxBps": 95,
    "totalMaxPercent": "0.95%",
    "comparison": {
      "stripe": "2.90%",
      "paygent": "0.75%",
      "savings": "74%"
    }
  }
}
POST/api/webhooks/helius

Payment Webhook

Helius webhook endpoint for real-time payment confirmations. Automatically matches transactions to pending payments.

Request Body
// Sent by Helius when a transaction is confirmed
[{
  "signature": "TX_SIGNATURE",
  "type": "TRANSFER",
  "nativeTransfers": [...],
  "tokenTransfers": [...]
}]
Response
{ "received": true }

Real-Time Webhooks

Paygent uses Helius for real-time on-chain event monitoring. When a payment is detected, the system:

  1. Matches the transaction reference to a pending payment
  2. Calculates and routes the platform fee (0.75%)
  3. Updates payment status to confirmed
  4. Triggers merchant notification in the dashboard
  5. Emits paygent:payment-complete event via the widget

Zero-latency confirmations: Helius processes transactions within ~400ms of on-chain finality.

Ready to accept crypto?

Create your storefront in 60 seconds. No code required.