This guide assumes you’re familiar with the Pandabase API and have a store set
up. If you haven’t already, complete the Quickstart first.
Enable onchain payments
Enable onchain payments for your store in the dashboard under Settings → Payment Methods → Onchain Payments.
Create a checkout session
Onchain payments work through the same checkout flow as card payments. When you create a checkout session, the customer can choose to pay with crypto at checkout.
const response = await fetch(
`https://api.pandabase.io/v2/stores/${storeId}/checkouts`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
items: [
{
name: "Pro License",
amount: 4999,
quantity: 1,
},
],
}),
},
);
const { data } = await response.json();
// Redirect customer to data.checkout_url
No additional parameters are needed. If onchain payments are enabled on your store, the crypto option appears automatically at checkout.
Handle webhooks
Onchain payments fire the same webhook events as card payments. The data.order object includes onchain-specific fields:
{
"event": "PAYMENT_COMPLETED",
"data": {
"order": {
"id": "ord_xxx",
"status": "COMPLETED",
"amount": 4999,
"currency": "USD",
"paymentMethod": "ONCHAIN",
"onchain": {
"chain": "ETH",
"token": "USDC",
"tokenAmount": "49.99",
"txHash": "0xabc123...",
"fromAddress": "0xdef456...",
"toAddress": "0x789abc...",
"confirmations": 12,
"exchangeRate": "1.0001"
}
}
}
}
Onchain-specific fields
| Field | Type | Description |
|---|
chain | string | Blockchain network (e.g. ETH, SOL, BTC) |
token | string | Token symbol (e.g. USDC, ETH, SOL) |
tokenAmount | string | Amount in the token’s native decimals |
txHash | string | On-chain transaction hash |
fromAddress | string | Customer’s wallet address |
toAddress | string | Pandabase deposit address |
confirmations | integer | Number of block confirmations at the time of completion |
exchangeRate | string | USD exchange rate at the time the payment was locked |
Underpayment and overpayment
Crypto payments may not arrive in the exact expected amount due to wallet UI rounding or network fees.
| Scenario | Default behavior |
|---|
| Underpayment (within 1%) | Accepted — the order is completed |
| Underpayment (over 1%) | Payment marked as failed, customer refunded to their wallet |
| Overpayment | Accepted — excess amount is credited to your balance |
You can configure the underpayment tolerance in your store settings.
Payment expiry
Once a customer selects a chain and token, they have 30 minutes to send the payment. The exchange rate is locked for this window. If no payment is detected within 30 minutes, the checkout session expires and the customer must start over.
The exchange rate lock protects both you and the customer from price
volatility during the payment window.