Integration guide

Accept crypto with Delvapay

This guide takes you from an API key to a settled payment: create a payment intent on your server, open the hosted Link widget in your page, and fulfil the order when a signed webhook arrives. Customers can pay in USDC or any supported coin; you always receive USDC.

On this page

Early access. The API is pre-1.0. Sections tagged evolving describe behaviour that is being rolled out now and may change shape; everything else reflects the current API.

Overview & flow

Every payment gets its own Delvapay deposit address. The customer sends USDC to it from any wallet or exchange, or pays in another coin that a swap provider converts and delivers there as USDC (see Any-asset payments). Once the payment is confirmed, the amount minus the Delvapay fee lands in your Delvapay balance in USDC, and you withdraw it to your own wallet whenever you want. Delvapay runs the checkout, matches the on-chain transfer to the right payment, keeps a double-entry ledger, and notifies your backend.

The API base URL is http://localhost:3000 in local development; production hostnames are issued with live keys. Examples below use $DELVAPAY_API_URL.

  1. Your server → API
    1. POST /payments/intents with amount, currency, network.
  2. Your server → API
    2. POST /link/sessions returns a single-use authCode (10 min).
  3. Your page → Widget
    3. openLink({ clientId, authCode }) opens the hosted widget in an iframe.
  4. Customer → Widget
    4. Picks a wallet and sends USDC, or picks another coin and pays a one-time deposit address.
  5. Delvapay → Chain
    5. Watches the transfer and waits for the required confirmations.
  6. Delvapay → Your server
    6. Signed payment.settled webhook, your balance is credited. Fulfil the order.

Your API key never reaches the browser: the browser only ever sees the short-lived authCode, and the widget exchanges it for its own session token.

Authentication

Merchant endpoints use API keys sent as a Bearer token. Create keys in the dashboard. Keys are shown once; Delvapay stores only a SHA-256 hash.

  • dp_test_…: test mode. Creates testnet payments only (Base Sepolia, Ethereum Sepolia).
  • dp_live_…: live mode. Creates mainnet payments only (Base, Ethereum).

The mode is enforced: asking a test key for a mainnet network (or a live key for a testnet) returns 403, so a test integration can never take real payments.

HTTP header
Authorization: Bearer dp_test_xxxxxxxxxxxxxxxxxxxxxxxx

A missing or malformed header returns 401 Missing Authorization: Bearer <api-key>; an unknown or revoked key returns 401 Invalid API key; a suspended merchant gets 403 Merchant not active. Keep keys server-side only.

Object IDs

Every object has a prefixed ID that tells you what it is, for example pi_3Nf1FbR5jFwNLiigHqLodT for a payment intent. IDs are case sensitive: store them as opaque strings of up to 64 characters.

PrefixObject
pi_Payment intent
txn_Transaction (a payment attempt on an intent)
mer_Merchant, used as the widget clientId
key_API key (the ID, never the secret: secrets stay dp_test_… / dp_live_…)
we_Webhook endpoint
evt_Webhook event (the id of a webhook body)
whd_Webhook delivery (dashboard delivery log)
cp_Card payment
scr_Compliance finding (riskId in payment.risk_flagged)
flag_Risk flag
usr_Dashboard user
wd_Withdrawal
wa_Withdrawal address (address book entry)
dep_Deposit address (your top-up address)
tu_Top-up

Every endpoint also accepts the plain UUID form that IDs had before prefixes were introduced, so stored IDs and existing embed code (a UUID clientId) keep working. An ID with the wrong prefix (for example a mer_ ID where a payment intent is expected) is treated like an unknown ID.

Create a payment intent

A payment intent represents one amount you want to collect. It expires 30 minutes after creation. The Idempotency-Key header is required. Use your order ID.

POST /payments/intents

FieldTypeNotes
amountstringDecimal string, e.g. "25.00". Never a float. Up to 18 decimals (USDC uses 6).
currency"USDC"Only USDC today.
networkstring?base, ethereum (live keys; default base) or base-sepolia, ethereum-sepolia (test keys; default base-sepolia).
curl
curl -X POST "$DELVAPAY_API_URL/payments/intents" \
  -H "Authorization: Bearer $DELVAPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_1042" \
  -d '{"amount":"25.00","currency":"USDC","network":"base-sepolia"}'
TypeScript (Node 18+ / Bun)
const API = process.env.DELVAPAY_API_URL!;
const KEY = process.env.DELVAPAY_API_KEY!;

export async function createIntent(orderId: string, amount: string) {
  const res = await fetch(`${API}/payments/intents`, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${KEY}`,
      "Content-Type": "application/json",
      "Idempotency-Key": orderId,
    },
    body: JSON.stringify({ amount, currency: "USDC", network: "base-sepolia" }),
  });
  if (!res.ok) throw new Error(`Delvapay ${res.status}: ${await res.text()}`);
  return (await res.json()) as PaymentIntent;
}

interface PaymentIntent {
  id: string;
  status: "CREATED" | "FUNDING_SELECTED" | "CONFIRMING" | "SETTLED" | "FAILED" | "EXPIRED";
  amount: string;
  currency: "USDC";
  network: string;
  depositAddress: string | null; // this payment's Delvapay deposit address
  settlement: "custodial" | "direct";
  expiresAt: string | null;      // ISO 8601
  createdAt: string;
}
Response · 200
{
  "id": "pi_3Nf1FbR5jFwNLiigHqLodT",
  "status": "CREATED",
  "amount": "25",
  "currency": "USDC",
  "network": "base-sepolia",
  "depositAddress": "0x7d3c9a4e1f52b80c6e9a1d0f4b2c8e5a3f6d1b90",
  "payerAddress": null,
  "settlement": "custodial",
  "feeAmount": null,
  "reference": "order_1042",
  "expiresAt": "2026-10-02T12:30:00.000Z",
  "createdAt": "2026-10-02T12:00:00.000Z"
}

depositAddress belongs to this payment alone. You can show it to the customer yourself (for example as a QR code): any USDC sent to it on the intent's network is matched to the payment, from any wallet or exchange. settlement is "custodial" when the payment lands in your Delvapay balance. It is "direct" only on networks where Delvapay balances are not available yet: there the deposit address is your settlement wallet, set when the widget opens.

amount is returned in normalized decimal form (trailing zeros may be dropped). Retrieve an intent at any time with GET /payments/intents/:id (same shape; 404 if it isn't yours).

Embed domains evolving

The hosted widget may only be framed by sites you allow. Add your production origins (for example https://shop.example.com) to your merchant's allowed domains in the dashboard. The widget server turns that list into a Content-Security-Policy: frame-ancestors … header for your clientId; browsers refuse to render the widget on any other origin.

  • No allowed domains (or an inactive merchant) means frame-ancestors 'none', so the widget won't load in production.
  • Localhost origins are allowed in development builds so you can test locally.
  • The policy is public and can be inspected at GET /link/embed-policy/:clientId → { "frameAncestors": [...] }.

Supported assets

Your customers can pay with any of the assets below. Whatever they pay with, you receive USDC on your settlement network (Base or Ethereum). USDC on your own settlement network is paid directly; every other row is converted by a swap provider.

AssetNetworkIdHow the payer paysPath
USDC USD CoinBaseusdc-baseWallet (one click) or QR codeDirect if you settle on Base, otherwise swapped
USDC USD CoinEthereumusdc-ethereumWallet (one click) or QR codeDirect if you settle on Ethereum, otherwise swapped
BTC BitcoinBitcoinbtcWallet (one click) or QR codeSwapped to USDC
ETH EtherEthereumeth-ethereumWallet (one click) or QR codeSwapped to USDC
ETH EtherBaseeth-baseWallet (one click) or QR codeSwapped to USDC
ETH EtherArbitrumeth-arbitrumWallet (one click) or QR codeSwapped to USDC
USDT Tether USDEthereumusdt-ethereumWallet (one click) or QR codeSwapped to USDC
USDT Tether USDTronusdt-tronWallet (one click) or QR codeSwapped to USDC
USDT Tether USDBNB Chainusdt-bscWallet (one click) or QR codeSwapped to USDC
USDT Tether USDSolanausdt-solanaWallet (one click) or QR codeSwapped to USDC
BNB BNBBNB Chainbnb-bscWallet (one click) or QR codeSwapped to USDC
XRP XRPXRP LedgerxrpCopy address + amountSwapped to USDC
SOL SolanaSolanasolWallet (one click) or QR codeSwapped to USDC
USDC USD CoinSolanausdc-solanaWallet (one click) or QR codeSwapped to USDC
USDC USD CoinArbitrumusdc-arbitrumWallet (one click) or QR codeSwapped to USDC
TRX TronTrontrxWallet (one click) or QR codeSwapped to USDC
DOGE DogecoinDogecoindogeQR code or copy addressSwapped to USDC
ADA CardanoCardanoadaQR code or copy addressSwapped to USDC
ZEC ZcashZcashzecQR code or copy addressSwapped to USDC
GRAM Gram (TON)TONgramWallet (TON Connect) or QR code, from the wallet you enterSwapped to USDC
  • Wallet (one click): the customer connects a wallet in the widget and approves the transfer there.
  • QR / copy address: the widget shows a QR code (a standard payment URI where the chain has one) plus the deposit address and exact amount; any wallet or exchange withdrawal works.
  • Conversions run on mainnet only. Intents on base-sepolia / ethereum-sepolia offer USDC only.

How any-asset payments work

You don't integrate anything extra: the same intent, Link session and widget handle it. When the customer picks a coin other than USDC, the widget runs this flow:

  1. Refund address. The customer enters an address on the coin's own chain where funds are returned if the swap can't complete. It's validated for that chain (for example a Cardano refund address must be a payment-only addr1v… address, and Zcash supports transparent t1…/t3… addresses only).
  2. Quote & deposit address. Delvapay requests an exact-output quote: the amount of the customer's coin needed so that exactly your intent amount arrives in USDC. The provider issues a one-time deposit address for that quote; it identifies the payment, so no wallet signature is needed.
  3. Payment. The customer sends the quoted amount to the deposit address, from a connected wallet, by scanning the QR code, or by copy-paste. The quote is valid for the intent's payment window; requesting a new quote replaces the old one in the widget.
  4. Swap & delivery. When the deposit is detected the intent moves to CONFIRMING; the provider converts the funds and sends the USDC to the payment's Delvapay deposit address. Delvapay verifies that delivery on-chain exactly like a direct USDC payment, then the intent becomes SETTLED, your balance is credited and you get payment.settled.

Refunds, minimums and timing

  • Underpayment: if less than the quote's minimum arrives, the provider refunds it to the customer's refund address; the payment isn't settled and the customer can try again.
  • Overpayment: the swap still delivers your exact amount and the excess is refunded to the customer.
  • Failure: if the swap can't complete, the deposit is refunded to the customer. Refunds are handled by the provider; they never pass through you or Delvapay.
  • Minimums: providers set per-asset minimums (commonly ≈ $12–25; currently around $100 for TRX and USDT on TRON and higher for BNB). The widget shows the minimum when an amount is too small.
  • Timing: settlement waits for the source chain to confirm the deposit (seconds on Solana, TRON and L2s; roughly 10–60 minutes for Bitcoin, Zcash and Dogecoin) plus the USDC delivery.
  • Late funds: a deposit that completes after the intent expired is still credited to your balance; it is flagged for reconciliation.

Fees

The swap provider charges a small conversion fee (about 0.2–0.25%) plus origin-network costs. It is part of the amount quoted to the customer, so exactly the USDC you charged arrives; your Delvapay fee is unchanged.

Providers

Conversions are executed by third-party swap protocols: NEAR Intents 1Click as the primary route, with Relay as a fallback for EVM chains and Solana. The provider used is recorded on each payment and visible in your dashboard.

GRAM (TON)

GRAM (Toncoin, renamed in 2026) is paid on the TON network. TON has no one-time deposit addresses, so the quote is made for the customer's own wallet: they connect it with TON Connect and approve one transfer, or enter their TON address and scan a QR code that carries the required comment. The deposit must come from that same wallet; GRAM sent from any other wallet is refunded. Quotes are short-lived (about 15 minutes) and refreshed automatically. Today GRAM is converted via Relay; NEAR Intents is used automatically when its TON route is available.

Choosing which assets you accept

In the dashboard, Settings → Accepted payment assets lets an owner switch individual assets off; disabled assets aren't offered in the widget. USDC on your settlement network is always accepted. The Payments list shows what each customer paid with, and the payment detail page shows the swap leg (deposit address, source transaction, provider, refund address) with explorer links.

Your balance

Confirmed payments land in your Delvapay balance in USDC, minus the Delvapay fee. One balance covers every network: a payment received on Base can be withdrawn on Ethereum. Test keys see a separate test balance (testnet payments only), live keys the live balance (mainnet only), so testnet money can never be withdrawn as real USDC.

  • Available: what you can withdraw now.
  • Pending: credited but not available yet (card payments, until they are released).
  • In withdrawal: requested withdrawals that are not confirmed on-chain yet.

GET /balance

curl
curl "$DELVAPAY_API_URL/balance" -H "Authorization: Bearer $DELVAPAY_API_KEY"
Response · 200
{
  "currency": "USDC",
  "pool": "live",
  "livemode": true,
  "available": "1240.5",
  "pending": "0",
  "inWithdrawal": "300",
  "custodyEnabled": true,
  "networks": [
    { "network": "base", "networkFee": "0.1" },
    { "network": "ethereum", "networkFee": "3" }
  ],
  "withdrawals": {
    "mode": "AUTOMATIC",
    "minAmount": "10",
    "maxAmount": "10000",
    "dailyMax": "25000",
    "maxPerDay": 10,
    "coolingOffHours": 24
  }
}

Anything sent to a payment's deposit address is credited, even when it doesn't settle the payment: a transfer that arrives after the intent expired, a second payment to a settled intent, or an amount below the intent amount. The Delvapay fee applies, the payment is flagged for review, and the dashboard balance history shows the credit. The dashboard also lists every credit, fee, top-up and withdrawal under Balance.

Withdraw to your wallet

You withdraw your available balance in USDC to an address in your withdrawal address book. Before you start:

  • Add addresses in the dashboard only. An owner of your account adds them under Balance → Withdrawal addresses with a two-factor code (Settings → Two-factor authentication). The API can list addresses and withdraw to them, but never create them, so a leaked API key can only send funds to addresses you already approved.
  • Cooling-off. A new address can be used after a waiting period (24 hours by default), and only once Delvapay's compliance screening has cleared it. If the address can't be screened, it stays unusable until it can.
  • Network fee. A flat fee per withdrawal, per network (shown in GET /balance), is taken from the amount: the recipient receives amount - fee.

Withdrawals within your limits are sent automatically when your account is in automatic mode. In manual mode, or when a request goes over a limit (maximum per withdrawal, daily maximum, number per day), it waits for approval by Delvapay operations first. Requests below the minimum are refused.

GET /withdrawal-addresses

Response · 200
{
  "items": [
    {
      "id": "wa_1kD8sQ2mVb7ZxR4tY9pLcE",
      "network": "base",
      "address": "0x4b2e9c1a7d3f50e6b8a2c4d1e9f07a3b5c6d8e21",
      "label": "Treasury (Ledger)",
      "status": "ACTIVE",
      "usable": true,
      "activatesAt": "2026-11-13T09:15:00.000Z",
      "createdAt": "2026-11-12T09:15:00.000Z"
    }
  ]
}

status is SCREENING, ACTIVE or BLOCKED. usable is true once the address is active and its cooling-off has passed.

POST /withdrawals

The Idempotency-Key header is required: a retry with the same key returns the same withdrawal and never sends twice.

FieldTypeNotes
amountstringUSDC to take from your available balance, up to 6 decimals.
addressIdstringA wa_ ID from GET /withdrawal-addresses.
curl
curl -X POST "$DELVAPAY_API_URL/withdrawals" \
  -H "Authorization: Bearer $DELVAPAY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: payout_2026_11_12" \
  -d '{"amount":"300","addressId":"wa_1kD8sQ2mVb7ZxR4tY9pLcE"}'
Response · 200
{
  "id": "wd_6pQmZ3cV9tB1nX8rL2kHsA",
  "status": "APPROVED",
  "amount": "300",
  "fee": "0.1",
  "netAmount": "299.9",
  "currency": "USDC",
  "network": "base",
  "address": "0x4b2e9c1a7d3f50e6b8a2c4d1e9f07a3b5c6d8e21",
  "addressId": "wa_1kD8sQ2mVb7ZxR4tY9pLcE",
  "addressLabel": "Treasury (Ledger)",
  "route": "AUTOMATIC",
  "txHash": null,
  "failureReason": null,
  "rejectReason": null,
  "createdAt": "2026-11-14T10:02:11.000Z",
  "approvedAt": "2026-11-14T10:02:11.000Z",
  "completedAt": null
}
StatusMeaning
PENDING_APPROVALWaiting for Delvapay operations (manual mode or over a limit).
HELDOn hold for review. The amount stays reserved.
APPROVEDApproved, about to be sent. Can wait here while withdrawals are paused.
PROCESSINGSent; waiting for confirmations. txHash is set.
COMPLETEDConfirmed on-chain. Final.
REJECTEDRejected by Delvapay (see rejectReason). The amount is back in your available balance.
FAILEDThe transfer failed on-chain (see failureReason). The amount is back in your available balance.

List withdrawals with GET /withdrawals (newest first, ?limit= up to 200) and fetch one with GET /withdrawals/{id}.

When a withdrawal is refused

StatusCause
400No Idempotency-Key header.
403A test key with a mainnet address, or a live key with a testnet address.
404Unknown addressId.
409The address is still in cooling-off or screening, blocked or removed, or withdrawals aren't available on its network.
422Below the minimum, not above the network fee, or more than your available balance.

Top up your balance

Each account has a permanent top-up address per network. USDC sent to it is added to your available balance after confirmations, with no Delvapay fee, and you get topup.completed. The dashboard shows it under Balance → Top up with a QR code.

GET /deposit-addresses/topup?network=base

Response · 200
{
  "id": "dep_2Hx7bN4qKc9vM1sP5tR8wA",
  "network": "base",
  "address": "0x91c4e7a2b5d80f3e6c1a9b7d2e4f05a8c3b6d1e7",
  "asset": "USDC",
  "usdcContract": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "warning": "Send only USDC on base. Other tokens or networks are not credited automatically."
}

Send only USDC, and only on the network you asked for. Other tokens, or USDC on another chain, are not credited automatically: contact Delvapay support to recover them.

Webhooks

Register an HTTPS endpoint in the dashboard. You'll get a signing secret that starts with whsec_. Store it like a password. Delvapay sends a POST with a JSON body on every payment state change, balance change and withdrawal change.

Event typeSent when
payment.confirmingA matching on-chain transfer was submitted/observed and is waiting for confirmations.
payment.settledThe transfer reached the required confirmations. Fulfil the order here.
payment.failedThe transfer reverted or didn't match the intent; see failureReason.
payment.expiredThe intent passed expiresAt without a payment.
payment.risk_flaggedDelvapay compliance flagged the payer or the received funds (AML). See Compliance.
balance.updatedYour balance changed (payment credited, withdrawal requested or returned, top-up, card release). data.reason says why.
withdrawal.createdA withdrawal was requested and the amount reserved.
withdrawal.approvedApproved (automatically or by Delvapay operations) and about to be sent.
withdrawal.completedConfirmed on-chain; withdrawal.txHash is set.
withdrawal.failedThe transfer failed on-chain; the amount is back in your balance.
withdrawal.rejectedRejected by Delvapay operations; the amount is back in your balance.
topup.completedUSDC sent to your top-up address was credited.
Webhook body
{
  "id": "evt_5ayJE86G6sk9XsQLVR2qVR",
  "type": "payment.settled",
  "createdAt": "2026-10-02T12:04:51.000Z",
  "data": {
    "paymentIntentId": "pi_3Nf1FbR5jFwNLiigHqLodT",
    "status": "SETTLED",
    "amount": "25",
    "currency": "USDC",
    "network": "base-sepolia",
    "txHash": "0x9c…e1",
    "feeAmount": "0.25",
    "method": "WALLET"
  }
}

data.method is how the customer paid: WALLET (USDC from a wallet), EXCHANGE (exchange account) or SWAP (another coin, converted). For swaps data.source describes what the customer sent; amount, currency, network and txHash always describe the USDC that reached the payment's deposit address. feeAmount is the Delvapay fee already deducted from what was credited to your balance.

Webhook body · balance.updated
{
  "id": "evt_2rT8kWq5Lm1Vc7Zb3Nx9Ya",
  "type": "balance.updated",
  "createdAt": "2026-10-02T12:04:51.000Z",
  "data": {
    "merchantId": "mer_4Fh2Kd9Lq3Wn6Xc1Vb8MzT",
    "currency": "USDC",
    "pool": "live",
    "livemode": true,
    "available": "1240.5",
    "pending": "0",
    "inWithdrawal": "0",
    "reason": "payment_settled"
  }
}
Webhook body · withdrawal.completed
{
  "id": "evt_7bH3nQ1xVk5Lp9Mc2Rt8Wd",
  "type": "withdrawal.completed",
  "createdAt": "2026-11-14T10:03:40.000Z",
  "data": {
    "merchantId": "mer_4Fh2Kd9Lq3Wn6Xc1Vb8MzT",
    "withdrawal": {
      "id": "wd_6pQmZ3cV9tB1nX8rL2kHsA",
      "status": "COMPLETED",
      "amount": "300",
      "fee": "0.1",
      "netAmount": "299.9",
      "currency": "USDC",
      "network": "base",
      "address": "0x4b2e9c1a7d3f50e6b8a2c4d1e9f07a3b5c6d8e21",
      "addressId": "wa_1kD8sQ2mVb7ZxR4tY9pLcE",
      "route": "AUTOMATIC",
      "txHash": "0x3f…a9",
      "failureReason": null,
      "rejectReason": null,
      "createdAt": "2026-11-14T10:02:11.000Z",
      "approvedAt": "2026-11-14T10:02:11.000Z",
      "completedAt": "2026-11-14T10:03:40.000Z"
    }
  }
}

Every withdrawal.* event carries the same withdrawal object; withdrawal.failed and withdrawal.rejected add a top-level reason. topup.completed carries topup: id (tu_), network, amount, currency, from and txHash.

Card payments (coming soon, by arrangement). When card payments are switched on for your account, data.method can also be CARD. Card payments have no txHash: Delvapay receives the card money and credits your balance in USDC. feeAmount is then the platform fee plus the card fee, and data.card holds fiatAmount, fiatCurrency, brand, last4, platformFee, cardFee and netAmount (the USDC you are owed). Ask your Delvapay contact to enable it.

Webhook body · paid in BTC
{
  "id": "evt_0OzWAhXsRUDCTsUsX8HEGG",
  "type": "payment.settled",
  "createdAt": "2026-10-02T12:41:07.000Z",
  "data": {
    "paymentIntentId": "pi_3Nf1FbR5jFwNLiigHqLodT",
    "status": "SETTLED",
    "amount": "25",
    "currency": "USDC",
    "network": "base",
    "txHash": "0x4a…7f",
    "feeAmount": "0.25",
    "method": "SWAP",
    "source": {
      "asset": "btc",
      "network": "bitcoin",
      "amount": "0.00031",
      "txHash": "b6f1…c09e"
    }
  }
}
  • id (evt_…) identifies the delivery and stays the same across retries. Use it to de-duplicate.
  • txHash, feeAmount, failureReason and source are present only when relevant. source.asset is an asset id from Supported assets.
  • Respond with any 2xx within 10 seconds. Do slow work asynchronously.
  • Failed deliveries are retried up to 5 attempts in total with exponential backoff (about 5 s, 25 s, 2 min, 10 min). After that the delivery is marked dead and can be replayed by Delvapay support.
  • Events may arrive out of order; treat data.status as the source of truth, or re-fetch the intent.

Verify signatures

Every request carries a delvapay-signature header:

Header
delvapay-signature: t=1791028800,v1=5f0c0e6b…a91d

t is the Unix timestamp (seconds) when the request was signed. v1 is the hex HMAC-SHA256 of the string "<t>.<raw body>", keyed with your full whsec_… secret as UTF-8. To verify:

  1. Read the raw request body, before any JSON parsing or re-serialisation.
  2. Reject the request if t is more than 5 minutes from your clock (replay protection).
  3. Compute the HMAC and compare it to v1 with a constant-time comparison.
verify.ts (Node / Bun)
import { createHmac, timingSafeEqual } from "node:crypto";

const TOLERANCE_SECONDS = 5 * 60;

export function verifyDelvapaySignature(
  rawBody: string,
  header: string | null,
  secret: string, // "whsec_…"
  nowSeconds = Math.floor(Date.now() / 1000),
): boolean {
  if (!header) return false;
  const parts = new Map(
    header.split(",").map((kv) => {
      const i = kv.indexOf("=");
      return [kv.slice(0, i).trim(), kv.slice(i + 1).trim()] as const;
    }),
  );
  const t = parts.get("t");
  const v1 = parts.get("v1");
  if (!t || !v1 || !/^\d+$/.test(t) || !/^[0-9a-f]+$/i.test(v1)) return false;
  if (Math.abs(nowSeconds - Number(t)) > TOLERANCE_SECONDS) return false;

  const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
  const received = Buffer.from(v1, "hex");
  return received.length === expected.length && timingSafeEqual(received, expected);
}

// Example: Bun.serve handler
Bun.serve({
  port: 8080,
  async fetch(req) {
    const raw = await req.text();
    const ok = verifyDelvapaySignature(
      raw,
      req.headers.get("delvapay-signature"),
      process.env.DELVAPAY_WEBHOOK_SECRET!,
    );
    if (!ok) return new Response("bad signature", { status: 400 });

    const event = JSON.parse(raw);
    if (await alreadyProcessed(event.id)) return new Response("ok");
    if (event.type === "payment.settled") await fulfilOrder(event.data.paymentIntentId);
    return new Response("ok");
  },
});

With Express, mount express.raw({ type: "application/json" }) on the webhook route so you receive the exact bytes that were signed.

Compliance (AML screening)

Delvapay screens payments with a blockchain-analytics provider (Scorechain). The first check happens before the customer pays: the paying wallet (or, for other coins, the refund/sending address) is checked when the customer verifies it in the widget. After a payment arrives, the incoming transaction is screened too. Your withdrawal addresses are screened before first use and again before every withdrawal: a withdrawal is only sent once its address has a clear screening result.

Risk levelBefore paymentAfter paymentWhat you see
LowAllowedRecordedNothing
MediumAllowed (declined if you chose Strict)Reviewed by Delvapay complianceOnly if compliance shares it with you
High (darknet, mixers, scams, stolen funds, ransomware…)DeclinedYou are notifiedBadge + payment.risk_flagged
Severe (sanctions exposure)DeclinedYou are notified; mandatory escalationBadge + payment.risk_flagged
  • Customers never learn why. A declined customer sees a neutral "We can't process this payment. Please contact the merchant." The API answers 403 {"error":{"code":"payment_declined","message":"We can't process this payment."}} for every risk level, and the widget emits error with payment_declined. Don't reveal the reason either; nothing was charged.
  • Settlement is never reversed. A payment flagged after it arrived stays SETTLED (the funds are already credited to your balance); the dashboard shows Settled · compliance review and a recommendation, e.g. hold the goods or credits.
  • Risk tolerance: dashboard → Settings. Standard declines high-risk and sanctioned payers; Strict also declines medium-risk ones. You can tighten Delvapay's baseline, never loosen it.
  • If the screening provider is unavailable, payments continue and are screened again in the background.
Webhook body · payment.risk_flagged
{
  "id": "evt_2Jj79Juu7D0jAUCvzLHeEB",
  "type": "payment.risk_flagged",
  "createdAt": "2026-10-03T15:12:09.000Z",
  "data": {
    "riskId": "scr_4hWZ2UOFqiraRSjcycbZGe",
    "paymentIntentId": "pi_3Nf1FbR5jFwNLiigHqLodT",
    "tier": "HIGH",
    "category": "Darknet market",
    "categories": ["Darknet market"],
    "stage": "post_payment",
    "outcome": "flagged",
    "recommendation": "Hold delivery of goods/credits until Delvapay compliance completes its review.",
    "flaggedAt": "2026-10-03T15:12:08.000Z",
    "status": "SETTLED",
    "amount": "25",
    "currency": "USDC",
    "network": "base"
  }
}

tier is MEDIUM, HIGH or SEVERE; outcome is blocked (a customer was declined before paying, nothing received) or flagged (funds received, under review). One event per finding (riskId); a payment can have several. Categories are a summary; raw analytics data is never shared.

Idempotency

POST /payments/intents requires an Idempotency-Key header (missing → 400). Keys are scoped to your merchant account and never expire: repeating a request with the same key returns the original intent instead of creating a new one, so network retries can never double-charge a customer.

  • Use a stable identifier from your system, such as the order ID.
  • The original intent is returned even if the retried body differs. Use a new key for a new amount.
  • Other writes are naturally idempotent: Link sessions are cheap and single-use, and re-reporting the same transaction hash returns the existing transaction.

Payment states

StatusMeaningWebhook
CREATEDIntent created; the widget hasn't been opened yet.-
FUNDING_SELECTEDThe widget opened and the customer can pay.-
CONFIRMINGA transfer was submitted and is waiting for confirmations or, for any-asset payments, the deposit was detected and is being converted. Further payments are refused.payment.confirming
SETTLEDTerminal. USDC confirmed at the deposit address; your balance is credited (net of the fee).payment.settled
FAILEDTerminal. The transfer reverted or didn't match.payment.failed
EXPIREDTerminal. No payment before expiresAt (30 min).payment.expired

QUOTED and EXECUTING are reserved and not used yet. If an any-asset swap is refunded or fails, the intent returns to FUNDING_SELECTED so the customer can retry (or expires as usual). Treat unknown statuses as non-terminal.

Errors & status codes

Errors use standard HTTP status codes. Business errors (e.g. 401, 404, 409) return a short plain-text message; read it with res.text(). Validation (422), rate-limit (429), unknown-route and server errors return JSON: {"error":{"code":"…","message":"…"}}. Every response carries an x-request-id header. Include it when contacting support.

CodeMeaningExamples
200SuccessIncluding an idempotent replay of an existing intent.
400Bad requestIdempotency-Key header is required
401Not authenticatedMissing/invalid API key; invalid or expired authCode.
403ForbiddenMerchant not active; payment_declined in the widget (compliance, see Compliance).
404Not foundIntent doesn't exist or belongs to another merchant.
409Conflict with current statePayment already confirming/completed, intent expired.
410GoneThe intent behind a session no longer exists.
422Validation failed / limit exceededMalformed amount, unsupported network, or an Idempotency-Key reused with a different body (idempotency_key_reused). limit_exceeded: see below.
429Rate limitedWait Retry-After seconds.
503Temporarily unavailableoffering_paused / maintenance, see below. Honour Retry-After when present.
5xxDelvapay errorRetry with backoff; intent creation is safe to retry with the same key.

Paused offerings & limits

Delvapay can temporarily pause a payment option (for example a network outage, an exchange delaying withdrawals, or scheduled maintenance) and enforces per-payment and daily limits. These come back as JSON with the affected scope (GLOBAL, MERCHANT, METHOD, NETWORK, ASSET, PROVIDER, EXCHANGE, WALLET), its key and a human-readable reason you can show your customer:

// 503, Retry-After: 840 (when the end is known)
{"error":{"code":"offering_paused","message":"Base network upgrade","scope":"NETWORK","key":"base",
          "reason":"Base network upgrade","until":"2026-10-03T14:30:00.000Z"}}

// 422: amounts are USD decimal strings (1 USDC = 1 USD)
{"error":{"code":"limit_exceeded","message":"Maximum payment is $10,000","scope":"GLOBAL","key":"payments",
          "reason":"Maximum payment is $10,000","limit":{"kind":"max","limit":"10000","value":"12500"}}}
CodeStatusWhat to do
offering_paused503Paused by Delvapay. Retry after until / Retry-After; other networks or methods may still work.
maintenance503Scheduled maintenance window; ends at until. Upcoming windows are shown in your dashboard 24h ahead.
limit_exceeded422limit.kind is min, max, daily_cap, payer_daily_cap or open_quotes. Use a different amount, or retry later for rolling 24h caps.
policy_unavailable503Transient; retry after a few seconds.

Where they can occur: POST /payments/intents and POST /link/sessions (so you can tell the customer before opening the widget), and inside the widget, which shows the reason to the payer. A pause never affects payments already sent; those always complete and fire webhooks as usual.

Test mode & testnets

Use a dp_test_ key with a testnet network to run the full flow with valueless tokens. Testnet intents accept USDC only: swap providers run on mainnet, so any-asset payments can only be tried with real (small) amounts on a live network.

NetworkChain IDUSDC contract
base-sepolia845320x036CbD53842c5426634e7929541eC2318f3dCF7e
ethereum-sepolia111551110x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238
base live84530x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
ethereum live10xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
  1. Test payments land in your test balance (dashboard → Balance, switch to Test). To try withdrawals, add a testnet address to your address book.
  2. Get test USDC from Circle's faucet at faucet.circle.com (pick Base Sepolia).
  3. The paying wallet also needs a little testnet ETH for gas on the same network.
  4. Create an intent with "network": "base-sepolia", open the widget and pay.

Settlement waits for a fixed number of block confirmations (3 by default), so expect payment.settled a few seconds after payment.confirming on Base Sepolia.

Rate limits

Limits use fixed one-minute windows. When exceeded, the API responds with 429 Too Many Requests, a Retry-After header (seconds) and the body {"error":{"code":"rate_limited","message":"…"}}. Back off on 429 and 5xx.

ScopeKeyed byLimit
Merchant API (/payments, /link/sessions)API key600 / min
Widget endpoints (/link/*)Client IP120 / min
Wallet registry (/registry/wallets)Client IP120 / min

Ready to build?

Create an account and grab a test key.

Get API keys