digipay
Official Python SDK for DigiPay — accept DigiByte payments on your site without holding any funds.
- Non-custodial. Payments land directly in your wallet (single address or BIP84 xpub).
- Zero runtime dependencies. Standard library only (
urllib,hmac,hashlib,json). - Fully typed.
py.typed,TypedDictDTOs,Literalstatus unions. - Python 3.10+.
pip install digipay
Quickstart
import os
from digipay import DigiPay
dp = DigiPay(api_key=os.environ["DIGIPAY_KEY"])
session = dp.sessions.create(amount=5, label="Order #1234")
print(session["checkoutUrl"]) # → https://pay.dgbwallet.app/pay/ses_…
Self-serve registration
If you don't have an API key yet, register a brand-new merchant + first store + initial key in a single call:
from digipay import DigiPay
merchant = DigiPay.register(
display_name="My Shop",
address_or_xpub="dgb1q…", # or a BIP84 xpub
webhook_url="https://my-shop.example/digipay-webhook",
)
print(merchant["apiKey"]) # dgp_… (shown once)
print(merchant["webhookSecret"]) # store this for verify_webhook
Webhook verification
DigiPay POSTs signed JSON to your webhookUrl on every state change. The signature is HMAC-SHA256 of the raw body, hex-encoded, in the X-DigiPay-Signature header (prefixed sha256=).
import os
from flask import Flask, request, abort
from digipay import verify_webhook, DigiPayError
app = Flask(__name__)
@app.post("/digipay-webhook")
def webhook():
try:
event = verify_webhook(
raw_body=request.get_data(), # raw bytes
signature=request.headers.get("X-DigiPay-Signature"),
secret=os.environ["DIGIPAY_SECRET"],
)
except DigiPayError as err:
abort(err.status)
if event["event"] == "session.paid":
# event["session"]["id"], .amount, .paidTxid, etc.
...
return "", 200
Critical: verify the signature against the raw bytes before parsing JSON. Re-serialising (or letting a framework parse for you) breaks the HMAC.
Resources
Sessions
dp.sessions.create(amount=5, label="Order #1", memo="…", fiat_currency="USD", fiat_amount=2.50)
dp.sessions.get("ses_abc")
dp.sessions.list(status="paid", take=50)
dp.sessions.export_csv(status="paid") # returns CSV text
Stores
dp.stores.list()
dp.stores.get("sto_abc")
dp.stores.create(name="Side hustle", network="mainnet")
dp.stores.update("sto_abc", webhook_url="…", default_session_expiry_minutes=30)
dp.stores.delete("sto_abc")
# Webhook tooling
dp.stores.send_test_webhook("sto_abc")
dp.stores.list_deliveries("sto_abc", take=100)
dp.stores.replay_delivery("sto_abc", "wdel_…")
dp.stores.export_deliveries_csv("sto_abc")
Errors
Every failure raises DigiPayError with the HTTP status preserved:
from digipay import DigiPay, DigiPayError
try:
dp.sessions.create(amount=0)
except DigiPayError as err:
print(err.status) # 400
print(err.body) # {"error": "amount (DGB) must be > 0"}
err.status |
Meaning |
|---|---|
0 |
Network / DNS / TLS / timeout |
400 |
Validation failure — see err.body["error"] |
401 |
Missing or invalid API key |
404 |
Resource not found, or not owned by this merchant |
429 |
Rate-limited (sandbox endpoints only) |
>= 500 |
Server-side; safe to retry with backoff |
Configuration
DigiPay(
api_key="dgp_…",
base_url="https://api.pay.dgbwallet.app", # default
timeout=15.0, # seconds, default
)
For staging or self-hosted, pass an alternate base_url.
License
MIT — see the repo root LICENSE.
Metadata
Release files for digipay 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| digipay-0.1.0.tar.gz | 9.5 kB | With provenance | Details for digipay-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| digipay-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for digipay-0.1.0-py3-none-any.whl |
Total release size: 21.3 kB
Release files / digipay-0.1.0.tar.gz
| Download URL | digipay-0.1.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d838e4d229abdd039af62d7ba2ca60171d50d357ea44e353effe54ef48f6a00
|
|
BLAKE2b-256 checksum How to use checksums |
c12dc63130d8b8aad5b9b1bb9312ece23c240e7e6fff440506b8906e6b2387fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency logRelease files / digipay-0.1.0-py3-none-any.whl
| Download URL | digipay-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
657a63242fe121d05ae7a8d2f0a105731abafbb3f7a299590594bb7ab9908986
|
|
BLAKE2b-256 checksum How to use checksums |
7832d8bad9d77e969f554c2f49ee3ea1eec1705c81ec4514584b7212172a23f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency logSecurity for digipay 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for digipay-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.