Skip to main content
On this page

Developer docs

API reference

DigiPay speaks plain REST over HTTPS with JSON bodies. Every endpoint lives under /v1/pay on https://api.pay.dgbwallet.app. An account owns one or more stores; receive address, webhook and session defaults belong to a store. New here? Start with the quickstart.

On Node, Python or .NET? The official SDKs wrap these endpoints with types and a webhook verifier.

Try it in the browser

The server-to-server endpoints (sessions, stores and webhooks, public, sandbox) are published as OpenAPI 3.1 and rendered with Scalar, where you can send real requests. Dashboard-only endpoints (Digi-ID sign-in, account, API keys, POS pairing) are documented on this page only.

Authentication#

Send one header on every authenticated call: Authorization: Bearer <token>. Two kinds of token work:

  • dgp_… — API key. Long-lived, as many per account as you like, revocable one by one. For your server, CI and the SDKs. Create them in the dashboard's API keys tab.
  • dps_… — session token, minted when you sign in to the dashboard with Digi-ID. Expires after 30 days, revoked on sign-out. Used by the browser.

A token has three parts joined by underscores: its kind (dgp or dps), a 10-character public id, and the secret. Send the whole string exactly as you received it. DigiPay stores only a SHA-256 hash of the secret, so a lost key can't be shown again: revoke it and create a new one.

Authorization: Bearer dgp_a1b2c3d4e5_s3cr3tPartShownOnlyOnce

The example key is made up. In the docs, $DIGIPAY_KEY stands for your full key.

Register (headless)#

Creates an account, its first store and an API key in one call, for self-hosting and CI bootstrapping. People should sign in with Digi-ID from the dashboard instead.

POST /v1/pay/merchantsNo auth · 5 per hour
{
  "displayName": "My Shop",
  "addressOrXpub": "dgb1q...",
  "network": "mainnet",
  "webhookUrl": "https://shop.example/digipay/webhook"
}

Body

displayNamestringrequired
Account and store name.
addressOrXpubstringrequired
A DigiByte address (single-address mode) or a BIP84 account xpub (a fresh address per session).
networkstring
mainnet (default), testnet or regtest.
webhookUrlstring
If given, a webhook secret is generated and returned. Must be a public HTTPS URL.

Returns id, displayName, storeId, network, mode (address or xpub), apiKey and webhookSecret (null without a webhook URL). Both secrets appear only in this response.

Sessions#

A session is one invoice: an amount, an address to pay, and a status that moves from pending to confirmed (or expired, underpaid, refunded, voided). See how a payment flows.

POST /v1/pay/sessionsAPI key

Create a payment session.

{
  "amount": 12.5,
  "storeId": "sto_4fj8w2k9m3n7p5q1",
  "label": "Order #4201",
  "memo": "inv-001",
  "fiatCurrency": "USD",
  "fiatAmount": 5.00,
  "dgbPriceAtCreation": 0.0098,
  "expiresInSeconds": 1800,
  "returnUrl": "https://shop.example/orders/42/thanks"
}

Body

amountnumber
Amount in DGB. Required for DGB sessions (must be greater than 0).
storeIdstring
Which store gets paid. Defaults to the account's first store.
labelstring
Shown to the buyer on the checkout and in the wallet request.
memostring
Your own reference. Added to the payment request as its message.
fiatCurrencystring
The currency you priced the order in, for example USD. Recorded for your books and shown on the checkout.
fiatAmountnumber
The order total in fiatCurrency.
dgbPriceAtCreationnumber
The DGB price you quoted. The checkout warns the buyer if the live price has moved noticeably since.
expiresInSecondsinteger
1 to 86400. Overrides the store's default expiry (30 minutes if unset).
returnUrlstring
Where the checkout sends the buyer after payment confirms (a Return to merchant button and a 5-second redirect). HTTPS, or HTTP on localhost only. Up to 2048 characters.
currencystring
DGB (default) or DD for a DigiDollar session.
buyerChoiceboolean
Optional. Let the buyer pay in DGB or DigiDollar at checkout. Honoured only for a payment priced in a regular currency (fiatCurrency and fiatAmount, currency DGB) at a store with DigiDollar and buyer choice on, where DigiPay offers DigiDollar beyond the API; otherwise ignored without an error. The response then has buyerChoice: true and an options list (one per currency: currency, address, amountSatoshis, amountCentsDd, usdRate, rateAt, uri). The session's own currency, address and amounts describe the currency in effect; once funds arrive, lockedAt is set and they are the currency actually paid. Funds later sent in the other currency show as extra: {"{ currency, amount, txid, seenAt }"} (satoshis for DGB, cents for DD) for you to refund.
amountCentsDdinteger
DigiDollar amount in US cents, 100 to 10000000. Required when currency is DD; amount is then ignored. The store must have digiDollarEnabled (which needs its DigiDollar key), otherwise 400 digidollar_not_enabled_for_store. The address is the next one from the store's DigiDollar key, so the DD goes straight to the merchant's wallet; making it needs no outside service.

Headers

Idempotency-Keystring
Up to 255 characters. Repeat calls with the same key within 24 hours (per account) return the original session instead of a new one. Your order id works well.

Returns the session: id, storeId, address, amount, amountSatoshis, status, uri (BIP21 payment request), checkoutUrl, expiresAt, returnUrl, currency and the payment fields below (null until something arrives).

Errors: 400 if the store has no receive address yet (PATCH the store first), the store id isn't yours, or a field is invalid.

GET /v1/pay/sessionsAPI key

Your sessions, newest first, as { total, take, skip, sessions: [ … ] }.

Query parameters

statusstring
pending, seen, paid, confirmed, expired, underpaid, refunded or voided. An unknown value is ignored (no filter).
storeIdstring
Only this store's sessions.
takeinteger
1 to 100, default 25. With format=csv: up to 10000.
skipinteger
Default 0.
formatstring
csv returns a spreadsheet download (text/csv) instead of JSON: id, store, status, address, DGB amounts, fiat, label, memo, confirmations, txid, timestamps and source, then currency, amount and received in the session's own currency (DigiDollar in dollars; its DGB columns are 0).
GET /v1/pay/sessions/{id}No auth

Public read of one session, as { session: { … }, merchantName }. No key needed: the id is random and reveals nothing secret. The hosted checkout uses it, and it's the call to make when you want to double-check a webhook. For a buyer-choice session it also has ddAvailable and, when that's false, ddReason (dd_disabled or unavailable).

POST /v1/pay/sessions/{id}/options/ddNo auth

The buyer's switch to DigiDollar on a buyer-choice session (the hosted checkout and POS call it). Returns the session's DD option, making it the first time: a USD price becomes DD at 1:1, any other currency is converted at DigiPay's USD rate and rounded up to the cent, and the amount then stays fixed until the session expires. Rate-limited per visitor. 409 with dd_option_not_allowed (reason: no_choice, locked, not_pending, expired) or dd_option_unavailable (dd_disabled, no_rate, out_of_range with minCents and maxCents, or dd_service_unavailable while DigiPay can't reach the public explorer that confirms DigiDollar).

POST /v1/pay/sessions/{id}/refundAPI key

Record a refund. Crypto payments can't be pulled back, so you send the DGB back from your own wallet first, then record the transaction here so the dashboard, receipts and webhooks agree. The session becomes refunded and session.refunded fires.

{
  "txid": "9f2c4e1a7b3d5f8e0c6a2b4d8f1e3a5c7b9d0e2f4a6c8b1d3e5f7a9c0b2d4e6f",
  "note": "Customer returned the item"
}

Body

txidstringrequired
The refund transaction id, 32 to 128 characters.
notestring
Why. Kept up to 512 characters and included in the webhook as refundNote.

Errors: 409 unless the session is paid or confirmed (so refunding twice is refused), 404 if it isn't yours.

POST /v1/pay/sessions/{id}/voidAPI key

Cancel an unpaid session. It becomes voided, DigiPay stops watching its address, the checkout shows it as cancelled, and session.voided fires. The body is optional.

{
  "note": "Order cancelled"
}

Body

notestring
Why. Kept up to 512 characters.

Errors: 409 unless the session is pending or seen.

Stores#

A store owns its receive address or xpub, webhook URL and secret, default expiry and sessions. An account can run many: several shops, a tip jar, a testnet store. A store id that belongs to another account answers 404.

GET /v1/pay/storesAPI key

All your stores. Each has id, name, network, receiveMode (xpub, address or unconfigured), hasReceive, receivePreview, webhookUrl, hasWebhookSecret, defaultSessionExpiryMinutes, digiDollarEnabled, defaultCurrency (DGB, a fiat code such as EUR, DD, or null when not set), defaultCurrencyEffective (the same, except a saved DD reads as USD while the store can't offer DigiDollar), buyerChoiceEnabled, ddDonationAddress and createdAt.

POST /v1/pay/storesAPI key
{
  "name": "Acme Tips Jar",
  "network": "mainnet"
}

Body

namestringrequired
Store name.
networkstring
mainnet (default), testnet or regtest. A testnet store is watched on DigiByte testnet.
defaultCurrencystring
Optional. The store's default currency, as on PATCH.

The new store has no receive address yet: PATCH one before creating sessions.

GET /v1/pay/stores/{id}API key

One store, in the same shape as the list. A paired POS tablet's key can read its own store, which is how a new tablet learns the store's defaultCurrency.

PATCH /v1/pay/stores/{id}API key

Change any subset of these fields; leave the rest out.

{
  "name": "Main Shop",
  "network": "mainnet",
  "addressOrXpub": "xpub6...",
  "webhookUrl": "https://shop.example/digipay/webhook",
  "defaultSessionExpiryMinutes": 45,
  "digiDollarEnabled": false,
  "defaultCurrency": "EUR"
}

Body

namestring
1 to 120 characters.
networkstring
mainnet, testnet or regtest. Refused with 409 network_change_strands_keys while the store keeps a key for its current network: reason: "receive" (send a new addressOrXpub in the same request) or "dd_key" (remove the DigiDollar key first).
addressOrXpubstring
A DigiByte address or a BIP84 account xpub for the store's network (400 with reason: "wrong_network" otherwise). An empty string clears it. Setting a new xpub restarts address derivation.
webhookUrlstring
Public HTTPS URL for webhooks. The first time one is set, a webhook secret is created. An empty string removes the URL and deletes the secret.
defaultSessionExpiryMinutesinteger
1 to 1440.
digiDollarEnabledboolean
Allow DigiDollar (DD) sessions on this store.
buyerChoiceEnabledboolean
Let buyers choose DGB or DigiDollar on payments priced in a regular currency. On by default; only has an effect while DigiDollar is on.
defaultCurrencystring
DGB or one of the DigiByte wallet's ~80 fiat codes (USD, EUR, PHP …), any case; stored upper case. Payment links in the dashboard and newly paired POS tablets start in it. DD (DigiDollar) is accepted only while the store can offer it (DigiDollar on and DigiPay offering it beyond the API), otherwise 400 digidollar_not_enabled_for_store; turning DigiDollar off later keeps the saved value, and it acts as USD until DigiDollar is back. An empty string or null clears it; any other value answers 400.

Returns the store, plus webhookSecret. It holds the secret only on the call that created it, and is null on every other call. Store it then: it can't be read again (rotate it if it's lost).

POST /v1/pay/stores/{id}/webhook-secret/rotateAPI key

Replace the store's webhook secret. The new secret is returned once:

{
  "webhookSecret": "3f9a1c7e5b2d8f4a6c0e9b1d7f3a5c8e2b4d6f8a0c1e3b5d"
}

The old secret stops working immediately: every webhook after this call is signed with the new one, so update your receiver straight away.

DELETE /v1/pay/stores/{id}API key

Delete a store. Answers 400 (cannot delete your only store) if it's the account's last one.

GET /v1/pay/stores/{id}/donation-addressAPI key

A stable address for donation buttons, as { address, mode }. In xpub mode it's derivation index 0, which is then reserved (invoices start at 1). In address mode it's the configured address. 400 if the store has no receive address.

With ?currency=DD it returns the store's DigiDollar donation address (mode: "dd"): the next address from the store's DigiDollar key, taken on the first call and kept until the key changes. Needs DigiDollar on for the store and offered by DigiPay beyond the API, otherwise 400 digidollar_not_enabled_for_store. DD tips go straight to the merchant's wallet.

POST /v1/pay/stores/{id}/dd-key/previewAPI key

Checks a pasted DigiDollar account key ({ key }, an xpub/tpub from the DigiByte Wallet's DigiDollar key for DigiPay screen) and returns { network, firstAddress, keyFingerprint } without saving anything. Show firstAddress to the merchant to compare with their wallet. 400 dd_key_invalid with reason malformed, private_key (never echoed back), wrong_network or not_account_key. Not for POS tablet keys.

PUT /v1/pay/stores/{id}/dd-keyAPI key

Sets or replaces the store's DigiDollar key: { key, confirmFirstAddress }, where confirmFirstAddress is the first address the merchant checked against their wallet (409 first_address_mismatch otherwise). Returns the store, whose ddKey is { set, network, fingerprint, firstAddress, setAt, unpaidRun, unpaidRunWarning }; the key itself is never returned. Stores with the same key share one address sequence, so no DD address is given out twice. Open payments keep their addresses.

DELETE /v1/pay/stores/{id}/dd-keyAPI key

Removes the store's DigiDollar key and turns DigiDollar off. Open DD payments are still watched until they finish. Turning DigiDollar back on (PATCH with digiDollarEnabled: true) needs a key again: 409 dd_key_required.

GET /v1/pay/public/stores/{id}/donation-optionsNo auth

What a store's tip page can offer, as { storeName, network, dgbAddress, ddAddress, ddAvailable, ddReason }. dgbAddress is the store's address in address mode (null for xpub stores, whose buttons carry the address themselves); ddAddress is set only while the store has DigiDollar on and DigiPay offers it, so turning DigiDollar off removes it from every button already embedded. ddAvailable is false (ddReason: "dd_service_unavailable") while DigiPay can't reach the public explorer that confirms DigiDollar. Read-only and rate-limited; 404 for an unknown store.

GET /v1/pay/stores/{id}/analyticsAPI key

Daily totals for the dashboard charts: { storeId, days, since, until, summary, series }.

Query parameters

daysinteger
1 to 365, default 30. Days are UTC.

summary has totalSessions, totalPaid (paid, confirmed and refunded), totalRefunded, grossVolumeDgb, conversionPct and refundRatePct. Each series entry has day, total, paid, refunded, voided, failed and volumeDgb.

GET /v1/pay/stores/{id}/stats/dailyAPI key

Sales per day on your own calendar days, for the dashboard's Overview charts: { storeId, days, timeZone, from, to, fromUtc, toUtc, storeHasPayments, totals, previous, series }.

Query parameters

daysinteger
1 to 365, default 30. The window ends today (in tz) and includes it. Anything else answers 400.
tzstring
The time zone whose calendar days to count in, such as Europe/Amsterdam. Default UTC; an unknown zone answers 400.

totals counts the window's sessions by creation day: payments, paid (paid or confirmed), open (waiting or detected), expired, underpaid, refunded, voided, revenueDgb, the DGB amount of the paid and confirmed DGB sessions, and revenueDdCents, the same for DigiDollar sessions in USD cents (never added into DGB). series has one entry per day, oldest first and including days with nothing, each with date (yyyy-MM-dd) and the same fields.

previous is { from, to, totals } for the same number of days just before the window, for "+12% vs previous 30 days"; it is null when the store didn't exist yet before the window. fromUtc and toUtc are the window's start and (exclusive) end as UTC instants. storeHasPayments says whether the store has ever had a session, to tell a new store from a quiet period.

Webhooks#

DigiPay sends a signed POST with a JSON body to the store's webhookUrl whenever a session changes state. A store needs both a URL and a secret; set the URL with PATCH store.

Events#

EventSent when
session.seenA payment for at least 99% of the amount is in the mempool, unconfirmed.
session.paidThat payment has 1 confirmation.
session.confirmedIt has 6 confirmations. Can arrive without session.paid first if the payment was already that deep when DigiPay saw it.
session.underpaidThe payment found is less than 99% of the amount.
session.expiredNothing arrived before expiresAt. A payment within the next 3 days still moves the session on and sends session.paid or session.confirmed.
session.refundedYou recorded a refund (refund). refundTxid, refundedAt and refundNote are set.
session.extra_paymentOn a buyer-choice session, funds arrived in the currency the buyer didn't pay in. Sent once, with session.extra; refund the buyer from your wallet.
session.voidedYou cancelled an unpaid session (void).
webhook.testYou asked for a test (test). Its session is made up (ses_test_…); it is sent once, never retried, and can't be replayed.

New event types may be added. Answer 200 to ones you don't handle; anything else counts as a failed delivery.

Headers#

  • X-DigiPay-Signature: sha256=<hex> — HMAC-SHA256 of the raw body, keyed with the store's webhook secret.
  • X-DigiPay-Event — the event name, the same as event in the body. Handy for routing without parsing.
  • X-DigiPay-Delivery: wdel_… — the id of this delivery attempt. Every retry and replay gets a new id, so log it, but don't de-duplicate on it.

Body#

{
  "event": "session.paid",
  "timestamp": "2026-11-26T12:34:56Z",
  "session": {
    "id": "ses_8kq2x7m4n9p3r6t1",
    "merchantId": "mer_2m8p4q6r1t3v5x7z",
    "storeId": "sto_4fj8w2k9m3n7p5q1",
    "address": "dgb1qexampleaddress",
    "amountSatoshis": 1250000000,
    "amount": 12.5,
    "fiatCurrency": "USD",
    "fiatAmount": 5.00,
    "label": "Order #4201",
    "memo": "inv-001",
    "status": "paid",
    "receivedSatoshis": 1250000000,
    "confirmations": 1,
    "paidTxid": "c4de7f12a34bc6de3e9f1d7b5a2c3f7e8b4d1a6c9e5f2a8d3b7c1e4f6a9d2c5",
    "returnUrl": "https://shop.example/orders/42/thanks",
    "createdAt": "2026-11-26T12:30:02Z",
    "expiresAt": "2026-11-26T13:00:02Z",
    "currency": "DGB"
  }
}

Notes

null fields
Fields with no value are left out of the body rather than sent as null: fiatCurrency, label, paidTxid and so on appear only when set.
refundTxid, refundedAt, refundNote
Present on session.refunded (a void sets refundedAt and, if given, refundNote).
currency, amountCentsDd
DigiDollar sessions carry "currency": "DD" and amountCentsDd; their amountSatoshis is 0 and receivedSatoshis holds the cents received.
timestamp
When this attempt was sent. Rejecting deliveries more than about 5 minutes from your clock protects you if your secret leaks; each retry carries a fresh timestamp.

Retries and de-duplication#

A delivery fails when your server can't be reached, times out, or answers anything but 2xx (redirects aren't followed). Network errors, 5xx, 408 and 429 are retried automatically after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours (7 attempts over about 8.5 hours). Other 4xx answers are treated as permanent and not retried. After the last attempt the delivery stays failed until you replay it.

Each retry or replay is a new delivery, rebuilt from the session's current state, with a new id, timestamp and signature. So you may see an event more than once: de-duplicate on session.id plus event, and treat session.status as the truth. For money-critical steps you can always confirm with GET /v1/pay/sessions/{id}.

Test, delivery log and replay#

POST /v1/pay/stores/{id}/webhook/testAPI key

Sends a webhook.test event to the configured URL now and returns { ok, webhookUrl, deliveryId, statusCode, error }, so you can see what your server answered. 400 if the store has no webhook URL.

GET /v1/pay/stores/{id}/webhook-deliveriesAPI key

Recent delivery attempts, newest first. Each has id, sessionId, eventName, url, attempt, statusCode or errorMessage, durationMs, responseSnippet (the first 512 characters of your reply, as plain text), success, and nextRetryAt (set while a retry is scheduled; null once it succeeded or gave up).

Query parameters

takeinteger
1 to 100, default 25. With format=csv: up to 10000.
sessionIdstring
Only deliveries for this session, including retries and replays.
formatstring
csv returns a spreadsheet download. The response text is replaced by its length.
POST /v1/pay/stores/{id}/webhook-deliveries/{deliveryId}/replayAPI key

Sends a past delivery's event again, rebuilt from the session's current state, as a new delivery with attempt increased by one. Test deliveries can't be replayed (400): send a new test instead.

Verifying the signature#

Compute HMAC_SHA256(secret, rawBody) as lowercase hex, prefix it with sha256=, and compare it with the X-DigiPay-Signature header in constant time. Verify before parsing: the signature covers the exact bytes, so re-serialised JSON won't match. Answer 401 on a mismatch or a missing header.

Node (Express):

const crypto = require('crypto');
const express = require('express');
const app = express();

function verifyDigiPay(rawBody, header, secret) {
  if (typeof header !== 'string' || !header.startsWith('sha256=')) return false;
  const expected = Buffer.from(
    crypto.createHmac('sha256', secret).update(rawBody).digest('hex'));
  const provided = Buffer.from(header.slice('sha256='.length));
  // timingSafeEqual throws on different lengths, so check that first.
  return provided.length === expected.length &&
    crypto.timingSafeEqual(expected, provided);
}

app.post('/digipay/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  const ok = verifyDigiPay(req.body, req.headers['x-digipay-signature'],
    process.env.DIGIPAY_WEBHOOK_SECRET);
  if (!ok) return res.status(401).end();
  const event = JSON.parse(req.body.toString('utf8'));
  // De-duplicate on event.session.id + event.event, then update the order.
  res.status(200).end();
});

Python (Flask):

import hmac, hashlib, os
from flask import Flask, request, abort

app = Flask(__name__)

@app.post('/digipay/webhook')
def webhook():
    raw = request.get_data()
    expected = 'sha256=' + hmac.new(
        os.environ['DIGIPAY_WEBHOOK_SECRET'].encode(),
        raw, hashlib.sha256).hexdigest()
    provided = request.headers.get('X-DigiPay-Signature', '')
    if not hmac.compare_digest(expected, provided):
        abort(401)
    event = request.get_json()  # safe now
    # de-duplicate on event['session']['id'] + event['event']
    return '', 200

PHP:

<?php
$raw = file_get_contents('php://input');
$expected = 'sha256=' . hash_hmac('sha256', $raw, getenv('DIGIPAY_WEBHOOK_SECRET'));
$provided = $_SERVER['HTTP_X_DIGIPAY_SIGNATURE'] ?? '';
if (!hash_equals($expected, $provided)) {
    http_response_code(401);
    exit;
}
$event = json_decode($raw, true);
// de-duplicate on $event['session']['id'] + $event['event']
http_response_code(200);

C# (ASP.NET Core):

app.MapPost("/digipay/webhook", async (HttpRequest req) =>
{
    using var ms = new MemoryStream();
    await req.Body.CopyToAsync(ms);
    var raw = ms.ToArray();
    var secret = Environment.GetEnvironmentVariable("DIGIPAY_WEBHOOK_SECRET")!;
    using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
    var expected = "sha256=" + Convert.ToHexString(hmac.ComputeHash(raw)).ToLowerInvariant();
    var provided = req.Headers["X-DigiPay-Signature"].ToString();
    // FixedTimeEquals returns false (not throws) when the lengths differ.
    if (!CryptographicOperations.FixedTimeEquals(
            Encoding.UTF8.GetBytes(expected), Encoding.UTF8.GetBytes(provided)))
        return Results.Unauthorized();
    // JsonSerializer.Deserialize<WebhookEvent>(raw) ...
    return Results.Ok();
});

Embed script#

https://pay.dgbwallet.app/embed/digipay.js is a small script with no dependencies that opens the hosted checkout in a modal over your page. Try it live (opens in a new tab).

From code:

DigiPay.checkout({ sessionId: 'ses_abc' });                  // open the checkout modal
DigiPay.checkout({ sessionId: 'ses_abc', theme: 'light' });  // theme: 'light' | 'dark' (optional)
DigiPay.close();                                             // close it
const a = DigiPay.button({ address: 'dgb1...', amount: 5, name: 'Shop' });
document.body.appendChild(a);                                // a donation button

From markup:

<button data-digipay-checkout data-session-id="ses_abc">Pay</button>
<span data-digipay-button data-address="dgb1..." data-amount="5">Tip</span>
<!-- optional on either: data-theme="light" or "dark" -->

Elements are bound on DOMContentLoaded; call DigiPay.bind(rootEl) after adding new ones.

Callbacks#

Options for DigiPay.checkout(options):

Body

sessionIdstringrequired
The session to pay.
themestring
light or dark. Without it the checkout follows the buyer's own setting.
onStatusfunction
Called with { sessionId, status } on every status change the checkout shows: pending, seen, paid, confirmed, underpaid, expired, refunded, voided.
onSuccessfunction
Called once with { sessionId, status } when the payment is confirmed. With it, you decide what happens next; without it the widget goes to the session's returnUrl (if any) after closing.
closeDelaynumber
Milliseconds the modal stays open after confirmed, so the buyer sees it. Default 2500.
<script src="https://pay.dgbwallet.app/embed/digipay.js"></script>
<script>
  DigiPay.checkout({
    sessionId: 'ses_...',
    // Every status change: pending, seen, paid, confirmed, underpaid, expired, refunded, voided
    onStatus: function (e) {
      document.getElementById('order-status').textContent = e.status;
    },
    // Once, when the payment is confirmed (6 confirmations)
    onSuccess: function (e) {
      window.location.href = '/orders/thanks?session=' + encodeURIComponent(e.sessionId);
    },
    closeDelay: 1500 // ms the modal stays open after "confirmed"
  });
</script>

An error thrown inside a callback is caught and logged, so it can't break the checkout.

Messages from the checkout#

The callbacks are built on messages the checkout iframe posts to your page with postMessage. Listen for them yourself if you embed the checkout without digipay.js:

typeOther fieldsSent when
digipay-checkout-statussessionId, status, returnUrlThe status changes (and once when the checkout loads).
digipay-checkout-returnsessionId, status, urlThe buyer chose to go back to the shop. Navigate your page to url.
digipay-checkout-escapenoneThe buyer pressed Escape inside the checkout. Close it.
window.addEventListener('message', (e) => {
  if (e.origin !== 'https://pay.dgbwallet.app') return;
  const msg = e.data;
  if (!msg || msg.type !== 'digipay-checkout-status') return;
  // msg.sessionId, msg.status: 'seen' | 'paid' | 'confirmed' | 'expired' | ...
  if (msg.status === 'paid') showThankYou();
});

Use callbacks and messages for your page's UI only. Anyone can post messages to a window, and the buyer's browser can close at any moment, so fulfil orders from the webhook.

Account and audit log#

Used by the dashboard; not in the OpenAPI document.

GET /v1/pay/meAPI key or session

The signed-in account: { id, displayName, digiIdAddress, createdAt, stores: [ … ] }.

PATCH /v1/pay/meAPI key or session
{
  "displayName": "Acme Co"
}

Body

displayNamestring
1 to 120 characters. Everything else is set per store.
GET /v1/pay/me/auditAPI key or session

The account's append-only audit trail, newest first: { items: [ … ], nextCursor }. Each item has action (for example session.refund, store.update), the actor (type, token prefix, IP), the target, a summary, metadata and createdAt.

Query parameters

limitinteger
1 to 200, default 50.
cursorstring
The nextCursor from the previous page (a UTC timestamp). Omit for the newest entries; nextCursor is null on the last page.

API keys#

Managed from the dashboard; not in the OpenAPI document.

GET /v1/pay/api-keysAPI key or session

Your keys: prefix, label, created, last used and revoked dates. Never the secret.

POST /v1/pay/api-keysAPI key or session
{
  "label": "production"
}

Body

labelstring
Optional, up to 80 characters.

The full key is returned once, as apiKey. DigiPay keeps only its hash.

DELETE /v1/pay/api-keys/{id}API key or session

Revoke a key. Calls with it then get 401. Existing sessions carry on and their webhooks still fire.

Digi-ID sign-in#

The browser dashboard's sign-in flow. Servers don't need it. Limited to 10 requests per minute per address.

GET /v1/pay/auth/challengeNo auth

Returns { nonce, uri, expiresAt }. Show uri as a QR code for the DigiByte wallet to sign.

POST /v1/pay/auth/callbackNo auth

Called by the wallet with { address, uri, signature }. DigiPay checks the signature, creates the account and its Default Store if new, and marks the challenge signed. 409 if the challenge was already used or has expired.

GET /v1/pay/auth/poll/{nonce}No auth

The browser polls until it returns { status: "signed", merchantId, displayName, token }. The token is a dps_ session token.

DELETE /v1/pay/auth/sessionSession

Sign out: revokes the current dps_ token. API keys aren't affected.

Public data#

GET /v1/pay/public/statsNo auth

Site-wide totals for the home page: { merchants, stores, sessions, paidSessions, totalDgb, generatedAt }. Counts only, demo and test data excluded, cached for 30 seconds.

GET /v1/pay/public/priceNo auth

The price of 1 DGB in a fiat currency, worked out the same way as the DigiByte wallet: CoinGecko's own price where it quotes DGB in that currency, otherwise the USD price times the USD exchange rate. Used by POS tablets, payment links and the checkout. Returns { currency, dgbPrice, fetchedAt, source, decimals, symbol, stale }.

Query parameters

currencystring
Any code from GET /v1/pay/public/currencies (the wallet's list of about 80), case-insensitive; default usd. Anything else: 400.

Response fields

sourcestring
coingecko (priced directly) or coingecko+fx (USD price times the USD exchange rate, refreshed every 6 hours).
decimalsnumber
Digits after the decimal point for amounts in this currency: 0 for yen, won or rupiah, 3 for the Gulf dinars, otherwise 2. Round fiat amounts to this.
symbolstring
The symbol written before an amount, for example ₱.
staleboolean
true when CoinGecko couldn't be reached and this is the last price from the past 10 minutes (check fetchedAt).

Prices are cached for 60 seconds. With no price at all: 502. To charge a fiat amount, send amount = fiatAmount / dgbPrice rounded to 8 decimals, with fiatCurrency, fiatAmount and dgbPriceAtCreation.

GET /v1/pay/public/currenciesNo auth

The fiat currencies DigiPay can price in, the same list as the DigiByte wallet: { regions, currencies: [{ code, name, symbol, region, decimals, flag }] }. flag is an ISO country code, or null for currencies shared by several countries.

Sandbox#

Pretend a buyer paid, without coins: on your own testnet or regtest store, or on a throwaway demo session. 20 requests per minute per address. The quickstart walks through the whole flow, and testing without real money lists the other options.

POST /v1/pay/test/sessions/{id}/advanceAPI key (demo sessions: no auth) · 20/min

Moves a session one step per call: pending → seen → paid (1 confirmation) → confirmed (6), with a made-up txid. It sends the same webhooks as a real payment (session.seen, session.paid, session.confirmed, signed as usual) and updates any open checkout. The body is optional:

{
  "to": "confirmed",
  "confirmations": 6
}

Body

tostring
seen, paid or confirmed: jump straight there instead of one step.
confirmationsinteger
Set the confirmation count, for example 3 to watch a payment part way to final.

Returns where the session is now:

{
  "id": "ses_8kq2x7m4n9p3r6t1",
  "status": "confirmed",
  "confirmations": 6,
  "receivedSatoshis": 1250000000,
  "paidTxid": "c4de7f12a34bc6de3e9f1d7b5a2c3f7e8b4d1a6c9e5f2a8d3b7c1e4f6a9d2c5"
}

Who can advance what. Your own sessions need the usual Authorization header (an API key or session token of the account that owns the session), and the session's store must be on testnet or regtest: a mainnet store answers 400 advance only works on testnet or regtest stores. Demo sessions (ses_demo_…) need no auth and never send webhooks.

POST /v1/pay/test/demo-sessionNo auth · 20/min

Creates a throwaway demo account, store and 5 DGB session, and returns { sessionId, storeId, merchantId }. Open https://pay.dgbwallet.app/pay/{sessionId} to watch it while you advance it. Demo stores have no webhook, and demo data is swept away within a day.

Status codes#

Errors come back as JSON with an error field explaining what to fix, for example { "error": "amount (DGB) must be > 0" }.

CodeMeaningWhat to do
200Success.
400Invalid input, or the request can't work yet (no receive address, deleting your only store).Fix the request; don't retry as is.
401Missing, wrong or revoked token.Check the key.
404Not found, or it belongs to another account (DigiPay doesn't say which).Check the id.
409Wrong state: refunding a session that isn't paid or confirmed, voiding one that isn't pending or seen, or reusing a Digi-ID challenge.Read the session's status first.
429Rate limit reached (see below).Wait for the window to reset, then retry with backoff.
502Public price only: no price source available.Retry later.

Rate limits#

Fixed windows; going over returns 429 until the window resets.

EndpointsLimit
/v1/pay/stores/…, /me/…, /api-keys/…120 requests per minute per key or session token
POST /v1/pay/merchants5 per hour per client address
/v1/pay/auth/…10 per minute per client address
/v1/pay/test/…20 per minute per client address
/v1/pay/pos/…20 per minute per client address

Questions?#

The source is open: read it, file an issue, or run DigiPay yourself. It's built to self-host in one container backed by SQLite or Postgres.

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.