Paygent API
Accept Solana payments on any website with a few lines of code. REST API + embeddable widget + real-time webhooks.
Quick Start
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.
<!-- 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
/api/storefrontCreate Storefront
Create a new payment storefront with AI-generated theme and products.
{
"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"
}
}{
"success": true,
"data": {
"slug": "my-coffee-shop-a1b2",
"businessName": "My Coffee Shop",
"walletAddress": "YOUR_SOLANA_WALLET",
"products": [...],
"theme": { "accentColor": "#D97706", "style": "bold" },
"createdAt": 1707000000000
}
}/api/storefront/:slugGet Storefront
Retrieve storefront details including products, theme, and branding.
{
"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" }
}
}/api/payCreate Payment
Generate a Solana Pay transaction for a specific product. Returns a reference key for tracking.
{
"storefrontSlug": "my-coffee-shop-a1b2",
"productId": "prod_abc123",
"currency": "SOL"
}{
"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"
}
}/api/quoteGet Token Quote
Get a real-time SOL↔USDC quote via Jupiter aggregator.
// 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%"
}
}/api/dashboard/:slugGet Dashboard
Retrieve merchant analytics — payment stats, revenue breakdown, notifications.
{
"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
}
}/api/feesGet Fee Schedule
Returns current platform fee structure.
{
"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%"
}
}
}/api/webhooks/heliusPayment Webhook
Helius webhook endpoint for real-time payment confirmations. Automatically matches transactions to pending payments.
// Sent by Helius when a transaction is confirmed
[{
"signature": "TX_SIGNATURE",
"type": "TRANSFER",
"nativeTransfers": [...],
"tokenTransfers": [...]
}]{ "received": true }Real-Time Webhooks
Paygent uses Helius for real-time on-chain event monitoring. When a payment is detected, the system:
- Matches the transaction reference to a pending payment
- Calculates and routes the platform fee (0.75%)
- Updates payment status to
confirmed - Triggers merchant notification in the dashboard
- Emits
paygent:payment-completeevent via the widget
Zero-latency confirmations: Helius processes transactions within ~400ms of on-chain finality.