Skip to main content
Official SDKs · zero external deps · typed

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.

Node.js
@dgbwallet/digipay
$ npm install @dgbwallet/digipay
Node 18+ · zero deps · ESM + CJS
Python
digipay
$ pip install digipay
Python 3.10+ · zero deps · py.typed
.NET
DigiPay
$ dotnet add package DigiPay
net8.0 + net9.0 · SourceLink

What's included

Feature Node Python .NET
Self-serve merchant registrationYesYesYes
Sessions: create / get / listYesYesYes
Stores: CRUD + webhook test + replayYesYesYes
CSV bookkeeping exportYesYesYes
Webhook HMAC verifier (constant-time)YesYesYes
Typed DTOs for every endpointYesYesYes
Zero runtime dependenciesYesYesYes
Identical 8-test parity suiteYesYesYes
Error mapping (DigiPayError w/ HTTP status)YesYesYes

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?
0Network / DNS / TLS / timeoutWith backoff
400Validation — err.body.error has the fieldNo — fix input
401Missing or invalid API keyNo — rotate
404Not found or not owned by this merchantNo
409Wrong state, for example refunding a session that isn't paidNo — check the status
429Rate-limited (store, account and key endpoints: 120/min per key; sign-up, sign-in and sandbox: per client address). See limitsYes, after the window resets, with backoff
≥ 500Server-sideYes, 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.

DigiPay for WooCommerce
PHP 7.4+ · WooCommerce 7.0+ · GPL-2.0-or-later · GitHub release ZIP install

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.

An unhandled error has occurred. Reload 🗙

Reconnecting… Still reconnecting… Connection lost Session paused Couldn't resume

The live connection dropped. Nothing is lost; this page picks up where it left off.

Trying again in seconds. Check your internet connection.

We couldn't reach DigiPay. Payments are still watched on the server; try again or reload the page.

This page was paused to save resources. Resume to carry on.

The session couldn't be resumed. Reload the page to carry on.