Official Python SDK for DigiPay — accept DigiByte payments on your site.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file digipay-0.1.0.tar.gz.
File metadata
- Download URL: digipay-0.1.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d838e4d229abdd039af62d7ba2ca60171d50d357ea44e353effe54ef48f6a00
|
|
| MD5 |
7a2fa1e2bcbcdb3ef4bc68ce1ca488fc
|
|
| BLAKE2b-256 |
c12dc63130d8b8aad5b9b1bb9312ece23c240e7e6fff440506b8906e6b2387fe
|
Provenance
The following attestation bundles were made for digipay-0.1.0.tar.gz:
Publisher:
publish-sdk-python.yml on DennisPitallano/digibyte-wallet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
digipay-0.1.0.tar.gz -
Subject digest:
5d838e4d229abdd039af62d7ba2ca60171d50d357ea44e353effe54ef48f6a00 - Sigstore transparency entry: 1353902003
- Sigstore integration time:
-
Permalink:
DennisPitallano/digibyte-wallet@00c279c16f7973f6a98156988444571ade406ab1 -
Branch / Tag:
refs/tags/sdk-python-v0.1.0 - Owner: https://github.com/DennisPitallano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@00c279c16f7973f6a98156988444571ade406ab1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file digipay-0.1.0-py3-none-any.whl.
File metadata
- Download URL: digipay-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
657a63242fe121d05ae7a8d2f0a105731abafbb3f7a299590594bb7ab9908986
|
|
| MD5 |
e26bf58e69709fa8fee872cee12c2291
|
|
| BLAKE2b-256 |
7832d8bad9d77e969f554c2f49ee3ea1eec1705c81ec4514584b7212172a23f7
|
Provenance
The following attestation bundles were made for digipay-0.1.0-py3-none-any.whl:
Publisher:
publish-sdk-python.yml on DennisPitallano/digibyte-wallet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
digipay-0.1.0-py3-none-any.whl -
Subject digest:
657a63242fe121d05ae7a8d2f0a105731abafbb3f7a299590594bb7ab9908986 - Sigstore transparency entry: 1353902124
- Sigstore integration time:
-
Permalink:
DennisPitallano/digibyte-wallet@00c279c16f7973f6a98156988444571ade406ab1 -
Branch / Tag:
refs/tags/sdk-python-v0.1.0 - Owner: https://github.com/DennisPitallano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdk-python.yml@00c279c16f7973f6a98156988444571ade406ab1 -
Trigger Event:
push
-
Statement type: