One call per user. A signed webhook when they pay.
Ask Walletspine for a deposit address for each user, or create an invoice for a fixed amount. We watch the chain, tell your server who paid, and collect the money to a wallet you control. The node, the indexer and the sweeper are ours to run.
Free account. Test keys run on BNB Smart Chain Testnet and Ethereum Sepolia.
Your server
your code
Walletspine
the API
The chain
USDT · USDC
Your registered wallet
where your share is collected
The four systems this API replaces
Deposits per user usually mean key storage, a chain indexer, reorg handling and a sweeper that needs gas. Here that work is two endpoints, one webhook and collection to your wallet.
Build it yourself
- HD wallets and key storagekeys to guard
- A chain indexernodes to run
- Confirmations and reorgsper chain
- A sweeper with gashot keys
Yours to build, then to run on every chain you add.
One API
- POST/deposit-addressesan address per user
- POST/invoicesbill a fixed amount
- HOOKpayment.confirmedwho paid, signed
- AUTOsettlementto your wallet
Two calls and a webhook. No user keys anywhere.
Start on a test network with a test key
Create an account and generate an sk_test_ key in the dashboard. It works on BNB Smart Chain Testnet and Ethereum Sepolia, where the tokens are worthless and the code is the code you will ship.
The secret is shown once, so store it when it appears. Send it as a Bearer token from your server and keep it out of frontend code.
A test key on a live network gets 403, so test code cannot touch real money.
livemode: false · worthless tokens
livemode: true · real money
A test key on a live network, or the reverse: 403
// which networks can this key use?
GET /api/v1/invoices/chains
Register the wallet you are paid into
In the dashboard, connect your wallet and sign once per network. The registration is recorded on-chain, and every address you issue can pay your share to that wallet and to no other.
An API key cannot do this step, because it needs a signature from the wallet itself. Until it is done, creating an invoice or an address on that network returns 400.
Changing the wallet later needs your signature and a 24-hour delay you can cancel.
- 1
Connect your wallet
Dashboard → Payout wallet
- 2
Sign once per network
with the wallet itself
- 3
Recorded on-chain
wallet.registered is sent
- 4
Every address pays this wallet
your share, nowhere else
Until you register
POST /invoices → 400
With an API key
403 dashboard_only
Issue an address per user, or bill an amount
Both are one POST. A permanent address belongs to one of your users, never expires, and tags every payment with your reference. An invoice asks for a fixed amount in one token and has its own checkout page.
For deposits and top-ups
Request
curl -X POST https://api.walletspine.com/api/v1/deposit-addresses \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"reference": "user_12345",
"chain": "bsc-testnet",
"label": "Wallet top-up",
"metadata": { "plan": "pro" }
}'Response
{
"id": "uuid",
"chain": "bsc-testnet",
"address": "0x9c1E...b27A",
"kind": "user",
"reference": "user_12345",
"label": "Wallet top-up",
"metadata": { "plan": "pro" },
"isDeployed": false
}Ask twice with the same reference and you get the same address. Nothing is deployed until money arrives, so an address nobody pays costs nothing.
For a fixed amount
Request
curl -X POST https://api.walletspine.com/api/v1/invoices \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"title": "Order #123",
"amount": 50,
"currency": "USDT",
"chain": "bsc-testnet"
}'Response
{
"id": "uuid",
"slug": "xfmzFA9g4qXr",
"url": "/pay/xfmzFA9g4qXr",
"txRef": "VXP_abc123def456",
"amount": "50.000000000000000000",
"currency": "USDT",
"status": "PENDING",
"depositAddress": "0x7a3F...4d9b"
}Redirect the customer to walletspine.com/pay/{slug}. They pay from their wallet, or send the exact token on the named network to the address shown.
Fine print for addresses and invoices
isDeployed: falseis normal. The contract is deployed at the first collection.- An invoice names its token, USDT or USDC, and the customer pays in exactly that.
- Each token has a minimum amount. Read it, and each network's rate, from
GET /api/v1/invoices/chainsinstead of hardcoding them. - An invoice fixes its fee rate when it is created. A permanent address is charged the network's rate at the time it is collected, because it can keep receiving.
- Money fields in invoice responses are decimal strings with 18 places. Parse them as decimals.
- When a network moves to new contracts, the same reference gets a new address. The old one still pays your registered wallet.
GET /api/v1/deposit-addressesreturns the 200 most recent at most. Find one user with?reference=.
Your server is told who paid
Register an endpoint and pick its events. Walletspine reads each new block, sends payment.detected when a transfer appears and payment.confirmed once it is final. The payload carries the reference you gave the address.
Signed
HMAC-SHA256 with your account’s webhook secret, on every delivery.
Retried
Up to 12 attempts over about 16 hours, until you answer 2xx.
Safe to repeat
The event id is the same on every retry, and sequence only goes up.
Test stays in test
A test endpoint receives only test-network events.
POST your-server/webhooks
"type": "payment.confirmed"
"reference": "user_1042"
"asset": "USDC"
All 13 webhook events, and when each fires
Payments
- payment.detected
- A transfer was seen on-chain, not yet deep enough to trust.
- payment.confirmed
- Past the confirmation depth. Credit a permanent address on this. For invoices, act on invoice.completed instead.
- payment.orphaned
- A chain reorganisation reversed it. Undo any credit given.
Invoices
- invoice.completed
- Paid in full (within any tolerance), or accepted short by you. Fulfil on this.
- invoice.underpaid
- Money arrived, but not enough yet.
- invoice.overpaid
- Paid in full and then some. Sent alongside completed.
- invoice.expired
- The deadline passed without enough arriving.
- invoice.cancelled
- You cancelled it.
Collection
- sweep.completed
- Funds were collected into your payout wallet.
Payout wallet
- wallet.registered
- A payout wallet was registered on a chain.
- wallet.change_requested
- A change was requested. Cancel it if it was not you.
- wallet.change_applied
- The change took effect after its timelock.
- wallet.change_cancelled
- A pending change was cancelled.
Check the signature, then credit the user
Recompute the HMAC over the raw body, compare it in constant time, and skip any event id you have seen. Credit a permanent address on payment.confirmed. Fulfil an invoice on invoice.completed, and only on that.
Walletspine-Signature: t=<unix>,v1=<hmac>
- 1
Take the raw body
The signature covers the exact bytes sent, so read them before any JSON parser does.
const crypto = require("crypto"); app.post("/webhooks", express.raw({ type: "application/json" }), (req, res) => { const header = req.headers["walletspine-signature"]; if (typeof header !== "string") return res.status(401).send("Missing signature"); const rawBody = req.body.toString("utf8"); const parts = header.split(",").map((p) => p.split("=")); const timestamp = parts.find(([k]) => k === "t")?.[1]; const signatures = parts.filter(([k]) => k === "v1").map(([, v]) => v); - 2
Is it fresh?
Reject a timestamp more than five minutes from now. That bounds replay.
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) { return res.status(401).send("Stale signature"); } - 3
Is it ours?
HMAC-SHA256 of the timestamp, a dot and the raw body, keyed with your webhook secret and compared in constant time.
const expected = crypto .createHmac("sha256", YOUR_WEBHOOK_SECRET) .update(timestamp + "." + rawBody) .digest("hex"); const valid = signatures.some( (sig) => sig.length === expected.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected)), ); if (!valid) return res.status(401).send("Invalid signature"); - 4
Is it new?
The event id is the same on every retry. Record it and answer a repeat without acting twice.
const event = JSON.parse(rawBody); if (alreadyProcessed(event.id)) return res.status(200).send("OK"); - 5
An invoice was paid
Fulfil on invoice.completed, and only on that. payment.* events also fire for partial payments.
if (event.type === "invoice.completed") { fulfillOrder(event.data.txRef); } - 6
A user’s deposit confirmed
A permanent address has no invoice. Credit your reference, and never a token marked isSupportedToken: false.
if ( event.type === "payment.confirmed" && event.data.kind === "user" && event.data.isSupportedToken ) { const { reference, asset, amount, decimals } = event.data; creditCustomer(reference, asset, amount, decimals); } - 7
A payment was reversed
A chain reorganisation took back a payment you were told about. Undo what you credited.
if (event.type === "payment.orphaned" && event.data.kind === "user") { undoCredit(event.data.paymentId); } - 8
Answer 2xx
Within 10 seconds. Any other answer is retried, up to 12 attempts over about 16 hours.
res.status(200).send("OK"); });
Confirm before you ship
A webhook is a notification. Ask the API from your server, and fulfil when status is COMPLETED.
curl https://api.walletspine.com/api/v1/invoices/verify/VXP_abc123 \ -H "Authorization: Bearer sk_test_..." # status: "COMPLETED" = payment confirmed. Safe to fulfill.
Details that catch people out
- Verify against the raw body. Re-serialising parsed JSON does not reliably reproduce the bytes that were signed.
amounton payment events is in the token's base units. Divide by 10^decimals, which the event carries: 18 for USDT and USDC on BNB Smart Chain, 6 on Ethereum.- Events are delivered at least once and can arrive out of order. Keep the highest
sequenceyou have processed for an invoice and discard anything lower. - The signing secret (
whsec_…) is one per account and is shown only in the dashboard.
Go live by changing the key and the network
Generate an sk_live_ key, register your payout wallet on the live network, add a live webhook endpoint and change chain. The handler you tested is the one that runs.
- API keysk_test_…sk_live_…
- "chain""bsc-testnet""bsc"
- Payout wallettest networklive network
- Webhook endpointmode: "test"mode: "live"
- livemode in payloadsfalsetrue
Your handler code: unchanged
Live today
USDT and USDC, settling on two networks
- Networks
- BNB Smart ChainEthereum
- Stablecoins
- USDTUSDC
- Test networks
- BNB Smart Chain TestnetEthereum Sepolia
Limits to plan for
- 120 requests a minute from one IP address, counted across every key using it. Past that you get
429. - Answer a webhook with any 2xx within 10 seconds. Anything else is retried, and an endpoint that fails 10 times in a row is paused for 15 minutes.
- Balances under the collection threshold for their token and network are batched and collected within 24 hours.
- An API key takes payments. Creating keys, reading the webhook secret and moving your payout wallet need you signed in to the dashboard.
- If a key leaks, revoke it in the dashboard, then check your webhook endpoints.
You pay a percentage of each payment, taken on-chain when it is collected.