Authentication & API key scope
All server-side payment creation requests authenticate with a workspace Secret API key passed in the HTTP Authorization header. Generate or rotate your key anytime inside Dashboard → Developers → API keys.
API keys are strictly least-privilege: they are scoped exclusively to POST /api/payments and cannot modify payout wallets, business approval settings, or webhook endpoints. Never expose your bp_live_ key in frontend browser bundles or mobile apps.
Authorization: Bearer bp_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
Idempotency-Key: order_1043_attempt_1
Create a payment intent (POST /api/payments)
Call POST https://blockpaynow.com/api/payments from your backend when a shopper clicks Pay with crypto. Blockpay returns a payment object and a hosted checkoutUrl on https://blockpaynow.com/checkout/pay_… where the shopper selects USDC, USDT, or ETH and executes the transfer.
| Field | Type | Required | Description |
|---|---|---|---|
| amountCents | integer | Yes | USD order total in cents. Safe integer between 1 ($0.01) and 10000000 ($100,000). |
| description | string | Yes | Order summary shown on the hosted checkout screen (max 120 bytes). |
| orderNumber | string | Optional | Your store order reference (max 64 bytes). Defaults to BP-XXXXXXXXXXXX. |
| returnUrl | string (HTTPS) | Optional | URL on your approved merchant website origin where buyers return after settlement. |
| channel | string | Optional | Sales channel tag: api, woocommerce, shopify, magento, bigcommerce, pos, invoice. |
| customer | string | Optional | Optional label stored in workspace ledger (max 120 chars; avoid PII if unnecessary). |
| mode | string | Optional | Must be "mainnet" when provided. All Blockpay settlements execute on Ethereum Mainnet. |
curl -X POST https://blockpaynow.com/api/payments \
-H "Authorization: Bearer $BLOCKPAY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order_1043_v1" \
-d '{
"amountCents": 15000,
"description": "Studio order #1043",
"orderNumber": "ORD-1043",
"channel": "api",
"returnUrl": "https://your-store.com/thank-you/ORD-1043",
"mode": "mainnet"
}'
export async function createCryptoCheckout(order) {
const res = await fetch('https://blockpaynow.com/api/payments', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BLOCKPAY_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': `order-${order.id}-v1`,
},
body: JSON.stringify({
amountCents: order.totalCents,
description: `Order #${order.number}`,
orderNumber: order.number,
channel: 'api',
returnUrl: `https://your-store.com/orders/${order.number}/thanks`,
mode: 'mainnet',
}),
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.error || `Blockpay API error (${res.status})`);
}
const { payment, checkoutUrl } = await res.json();
// Save payment.id alongside order.id before redirecting shopper
return { paymentId: payment.id, checkoutUrl };
}
{
"payment": {
"id": "pay_449be60499b54b559e8d722911460dd2",
"merchantId": "m_8c2a1f94...",
"orderNumber": "ORD-1043",
"amountCents": 15000,
"feeCents": 104,
"status": "pending",
"chain": "ethereum",
"token": "USDC",
"tokenUnits": "0",
"decimals": 6,
"description": "Studio order #1043",
"source": "api",
"createdAt": 1764258120412
},
"checkoutUrl": "https://blockpaynow.com/checkout/pay_449be60499b54b559e8d722911460dd2"
}
Idempotency & retry safety
Pass an Idempotency-Key header (8–128 characters) on every POST /api/payments request. If a network timeout causes your backend to retry with the same key and identical order parameters, Blockpay returns the original checkout without creating a duplicate invoice. Reusing an idempotency key with different order parameters returns HTTP 409 Conflict.
A buyer can close their tab before returning, or manually visit your thank-you URL. Always fulfill orders when your server verifies a signed payment.settled webhook (or confirms status === "settled" via GET /api/checkouts/:id).
Checkout endpoints & status lifecycle
The hosted checkout UI handles asset selection, live pricing, wallet invocation, and transaction confirmation automatically. If you need to poll status or reconcile an order from your backend, query the public checkout status endpoint.
| Method & Path | Auth | Purpose |
|---|---|---|
| POST /api/payments | Bearer API key | Create a new hosted checkout intent and receive checkoutUrl |
| GET /api/checkouts/:id | Public (by pay_ ID) | Fetch current checkout status, quote details, and finalized settlementHash |
| POST /api/checkouts/:id/price | Public (hosted UI) | Fetch live offchain Chainlink/Kraken price offer for ETH, USDC, or USDT |
| POST /api/checkouts/:id/invoice | Public (hosted UI) | Lock a 5-minute quote and compute the deterministic EIP-1167 deposit vault |
| POST /api/checkouts/:id/transaction | Public (hosted UI) | Submit buyer Ethereum tx hash for immediate onchain receipt verification |
import requests
def fetch_payment_status(payment_id: str) -> dict:
resp = requests.get(
f"https://blockpaynow.com/api/checkouts/{payment_id}",
timeout=15,
)
resp.raise_for_status()
payload = resp.json()["payment"]
return {
"status": payload["status"], # pending | confirming | settled | expired | review
"tx_hash": payload.get("settlementHash"),
"token": payload.get("token"),
"token_units": payload.get("tokenUnits"),
}
HTTP status codes & rate limits
| Status | Meaning | Common Cause |
|---|---|---|
| 200 / 201 | Success | Checkout fetched or created cleanly |
| 400 Bad Request | Validation failed | amountCents out of range, non-HTTPS returnUrl, or returnUrl origin differs from approved website |
| 401 Unauthorized | Missing/invalid key | Secret API key invalid or rotated |
| 403 Forbidden | Scope or approval error | Business awaiting approval or API key used on non-payment route |
| 409 Conflict | State conflict | Idempotency-Key reused with mismatched payload or quote already locked |
| 429 Too Many Requests | Quote rate limit | Per-IP (6/hr) or per-business (30/hr) quote creation limit exceeded |