How to automate stablecoin payment reconciliation with webhooks (developer runbook)
Source: Dev.to
How to automate stable‑coin payment reconciliation with Webhooks + deterministic IDs
If your team already has a Web2 backend and wants to avoid manual crypto reconciliation, here is a practical flow:
- Create checkout (payment link)
- Receive webhook events (
payment.created,payment.confirmed,payment.rejected) - Pull order proof for audit
- Write deterministic ledger keys in your internal DB
Resources
- GitHub starter pack
- Postman docs
Run the API flow in 10 minutes (Postman)
Import the following files into Postman
NUVO-Verify-Developer-Inbound.postman_collection.jsonNUVO-Verify-Sandbox.postman_environment.json
Then execute the sequence
- Merchant Login
- Create Payment Link
- Create Webhook
- Send Test Webhook
- Get Order Proof
Sample webhook handler (Node.js)
import express from "express";
import crypto from "crypto";
const app = express();
app.use(express.raw({ type: "*/*" }));
const WEBHOOK_SECRET = process.env.NUVO_WEBHOOK_SECRET;
function verifySignature(rawBody, signatureHeader, secret) {
const expected =
"sha256=" +
crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
const a = Buffer.from(signatureHeader || "");
const b = Buffer.from(expected);
return a.length === b.length && crypto.timingSafeEqual(a, b);
}
app.post("/webhooks/nuvo", (req, res) => {
const sig =
req.header("x-nuvo-signature") ||
req.header("x-signature") ||
"";
if (!verifySignature(req.body, sig, WEBHOOK_SECRET)) {
return res.status(401).json({ ok: false, error: "invalid signature" });
}
const payload = JSON.parse(req.body.toString("utf8"));
const ledgerKey = `${payload?.data?.orderId}:${payload?.data?.tokenSymbol}:${payload?.event}`;
// upsert to your internal ledger table
// upsertLedger({ ledgerKey, payload });
return res.json({ ok: true });
});
app.listen(8787, () => console.log("listening on :8787"));
Recommended minimum table fields
| Column | Description |
|---|---|
ledger_key (unique) | Deterministic key (orderId:tokenSymbol:event) |
order_id | Original order identifier |
event_type | Webhook event (created, confirmed, rejected) |
token_symbol | Stable‑coin symbol (e.g., USDC) |
amount | Transaction amount |
tx_hash | Blockchain transaction hash |
traffic_light | Status indicator (e.g., green/yellow/red) |
received_at | Timestamp when webhook was received |
raw_payload_json | Full webhook payload for audit |
Key takeaways
- No manual transaction‑by‑transaction matching required.
- Deterministic keys prevent duplicate posting.
- The proof endpoint provides auditable evidence for completed orders.
- Keep your existing Web2 backend; simply add a webhook endpoint with an idempotent writer.
- Start with the sandbox environment, then move to production.