Developers

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.

Before you start

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.

01Test keys

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.

02Payout wallet

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.

03Address or invoice

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

POST/api/v1/deposit-addressesPermanent address

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

POST/api/v1/invoicesInvoice

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: false is 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/chains instead 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-addresses returns the 200 most recent at most. Find one user with ?reference=.
04Webhook

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.

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.
05Verify and credit

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.

HOOKWebhook handlerNode.js

Walletspine-Signature: t=<unix>,v1=<hmac>

  1. 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. 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. 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. 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. 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. 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. 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. 8

    Answer 2xx

    Within 10 seconds. Any other answer is retried, up to 12 attempts over about 16 hours.

      res.status(200).send("OK");
    });
GET/api/v1/invoices/verify/:txRefInvoices
  1. 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.
  • amount on 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 sequence you have processed for an invoice and discard anything lower.
  • The signing secret (whsec_…) is one per account and is shown only in the dashboard.
06Go live

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.

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.

Coming soonTron and subscriptions