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-merchantYesYour merchant ID from the dashboard
data-amountYesPayment amount (e.g., "0.1" for 0.1 SOL or "5.00" for $5 USDC)
data-currencyNoSOL (default) or USDC
data-labelNoButton label (default: "Pay with SOL/USDC")
data-themeNo"dark" (default) or "light"
data-on-successNoGlobal 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

  1. Customer clicks the "Pay with SOL" button on your site
  2. A modal opens showing the payment amount and options: connect Phantom wallet or scan QR code
  3. Customer sends payment to the Relay402 deposit wallet
  4. The script polls the payment status endpoint until the transaction is confirmed on-chain
  5. Relay402 verifies the transaction, takes a 1% fee, and forwards the remainder to your wallet
  6. Your data-on-success callback 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.