Crypto↔Crypto
Show deposit address, wait for on-chain funds, display balance in less than 1 day
Summary
Create a Customer, provision a custodial wallet, show the deposit address to the user ("waiting for deposit"), then surface funds once detected. Use webhooks for notifications and always re-verify via REST before updating UI. Today, balances reflect USDC only.
Problem → Solution mapping
Pain point | Capability | Mechanism |
---|---|---|
Need deposit address instantly | Customers + Wallet API | POST /v1/customers then POST /v1/customers/{id}/wallets → wallets[...] |
Show "awaiting deposit" | UI + polling | Display address/QR; poll GET /balances |
Push updates to app | Webhooks | Subscribe, validate HMAC; then REST re-verify |
Accurate final state | REST as truth | GET /v1/customers/{id}/balances before UI change |
Architecture
Implementation steps
Show wallet to end user + "waiting for deposit"
Poll the customer's balance from your server to avoid exposing API keys in the browser.
Expose an endpoint like /api/balances
that your frontend can call while showing "waiting for deposit".
Pull data or wait for webhook to update UI
Subscribe webhook URL and store the secret key:
Node.js HMAC-SHA256 verification + REST re-check:
Show the balance (REST is source of truth)
Sample response:
Display balance to the user. It represents total net worth across all supported networks in USD terms (per docs).
Webhooks (subscribe, validate, verify)
Set URL via PATCH /v1/webhooks; store secretKey.
Validate X-Webhook-Signature using HMAC-SHA256 over the raw body.
Always re-fetch via REST (GET /v1/customers/{id}/balances, and GET /v1/transfers/{id} if a transfer event is referenced) before updating UI or ledgers.
UX notes
Show address + QR and a deterministic "Waiting for deposit…" state.
Use polling (e.g., 5s backoff) until webhook arrives, then switch to REST-confirmed balance.
KPIs
Time from address display → first positive balance.
% deposits recognized without manual refresh.
Webhook validation success rate.
Note: If a webhook is missed, polling balances is sufficient to update UI.