Documentation
Everything you need to integrate Relay402 into your website.
Quick Start
1. Sign up at /signup to get your merchant ID and API key.
2. Add the script tag to any page where you want to accept payments:
<script src="http://localhost:3402/relay402.js"
data-merchant="YOUR_MERCHANT_ID"
data-amount="0.1"
data-currency="SOL">
</script>
3. Done. A "Pay with SOL" button will appear. Customers can pay via Phantom wallet or QR code.
Script Tag Attributes
| Attribute | Required | Description |
|---|---|---|
| data-merchant | Yes | Your merchant ID from the dashboard |
| data-amount | Yes | Payment amount (e.g., "0.1" for 0.1 SOL or "5.00" for $5 USDC) |
| data-currency | No | SOL (default) or USDC |
| data-label | No | Button label (default: "Pay with SOL/USDC") |
| data-theme | No | "dark" (default) or "light" |
| data-on-success | No | Global callback function name, called with payment data on success |
REST API
Authenticate with your API key via the x-api-key header.
POST
/api/payments/create
Create a payment intent programmatically.
{
"amount": 0.1,
"currency": "SOL",
"metadata": "Order #123"
}
Returns: { "payment_id": "...", "payment_url": "...", "status": "pending" }
GET
/api/payments/:id
Get the current status of a payment. No auth required.
POST
/api/payments/:id/verify
Submit a transaction signature for on-chain verification.
{
"tx_signature": "5UfD8s...",
"payer_wallet": "7xKX..."
}
GET
/api/merchant/stats
Get your payment volume and statistics. Requires auth.
Payment Flow
- Customer clicks the "Pay with SOL" button on your site
- A modal opens showing the payment amount and options: connect Phantom wallet or scan QR code
- Customer sends payment to the Relay402 deposit wallet
- The script polls the payment status endpoint until the transaction is confirmed on-chain
- Relay402 verifies the transaction, takes a 1% fee, and forwards the remainder to your wallet
- Your
data-on-successcallback fires with the payment details
Note: This MVP uses Solana devnet. Payments use devnet SOL/USDC which have no real value. Switch to mainnet-beta for production.