Accept DGB in one line.
First-party client libraries for Node.js, Python, and .NET. Same surface, same error model, same webhook verifier behaviour — pick the stack you already run.
What's included
| Feature | Node | Python | .NET |
|---|---|---|---|
| Self-serve merchant registration | ✓Yes | ✓Yes | ✓Yes |
| Sessions: create / get / list | ✓Yes | ✓Yes | ✓Yes |
| Stores: CRUD + webhook test + replay | ✓Yes | ✓Yes | ✓Yes |
| CSV bookkeeping export | ✓Yes | ✓Yes | ✓Yes |
| Webhook HMAC verifier (constant-time) | ✓Yes | ✓Yes | ✓Yes |
| Typed DTOs for every endpoint | ✓Yes | ✓Yes | ✓Yes |
| Zero runtime dependencies | ✓Yes | ✓Yes | ✓Yes |
| Identical 8-test parity suite | ✓Yes | ✓Yes | ✓Yes |
Error mapping (DigiPayError w/ HTTP status) | ✓Yes | ✓Yes | ✓Yes |
Create a session
import { DigiPay } from '@dgbwallet/digipay';
const dp = new DigiPay({ apiKey: process.env.DIGIPAY_KEY });
const session = await dp.sessions.create({
amount: 5,
label: 'Order #1234',
});
console.log(session.checkoutUrl);
Verify a webhook
Every state change POSTs signed JSON to your webhookUrl. The SDKs ship a framework-agnostic verifier — hand it the raw bytes, the X-DigiPay-Signature header, and the secret; get back a parsed event or a typed error on mismatch.
Always verify the raw bytes before your framework parses the body — reserialization breaks the HMAC.
import express from 'express';
import { verifyWebhook, DigiPayError } from '@dgbwallet/digipay';
app.post('/webhook',
express.raw({ type: 'application/json' }),
(req, res) => {
try {
const event = verifyWebhook({
rawBody: req.body,
signature: req.headers['x-digipay-signature'],
secret: process.env.DIGIPAY_SECRET,
});
if (event.event === 'session.paid') {
// mark paid, fulfil, send receipt…
}
res.status(200).end();
} catch (err) {
if (err instanceof DigiPayError) res.status(err.status).end();
}
});
Error handling
Every failure raises DigiPayError with the HTTP status preserved on err.status. Branch on the number, not the message — the message is for humans, the status is for your retry policy.
| status | Meaning | Retry? |
|---|---|---|
| 0 | Network / DNS / TLS / timeout | With backoff |
| 400 | Validation — err.body.error has the field | No — fix input |
| 401 | Missing or invalid API key | No — rotate |
| 404 | Not found or not owned by this merchant | No |
| 409 | Wrong state, for example refunding a session that isn't paid | No — check the status |
| 429 | Rate-limited (store, account and key endpoints: 120/min per key; sign-up, sign-in and sandbox: per client address). See limits | Yes, after the window resets, with backoff |
| ≥ 500 | Server-side | Yes, with backoff |
End-to-end samples
A one-product mini-store per language. Each is a single-file app showing session creation, hosted-checkout redirect, and HMAC-verified webhooks — the three steps every integration needs.
WooCommerce plugin
Drop-in WordPress plugin for the ~40% of e-commerce sites that run on WooCommerce. Hosted-checkout MVP, WC Blocks-checkout integration, fiat-priced orders (USD/EUR/GBP/PHP/JPY), HMAC-signed webhooks with replay protection, and an auto-redirect back to the WC thank-you page once payment confirms.
Read the install guide (merchant — install, configure, verify in ~10 min), the customer flow (buyer — cart through thank-you page), or browse the plugin source on GitHub.
Postman / Insomnia
Prefer a UI to curl? Import the collection — it covers register, sessions (create / get / list / refund / void), stores, webhooks, audit, and the sandbox, with auto-populated variables so chained requests just work.
Source + docs
Prefer the REST API directly? The full endpoint reference lives on the API page — including the live Scalar explorer and an OpenAPI 3.1 download. All three SDKs are generated against the same spec.