NullPay SDK for Python backends
Project description
NullPay Python SDK
nullpay-python is the Python equivalent of @nullpay/node.
It follows the same backend-first architecture:
- reads
nullpay.jsonlocally for named invoice lookup - calls the NullPay backend to create and retrieve checkout sessions
- uses the NullPay relayer flow for invoice pre-generation when
invoice_hashorsaltis missing - verifies webhook signatures locally with HMAC-SHA256
The smart-contract and Provable SDK work stays on the NullPay backend. This package is a thin Python client for FastAPI, Flask, Django, and plain Python services.
Install
pip install ./packages/nullpay-python
Basic usage
from nullpay import NullPay
client = NullPay({
"secretKey": "sk_test_...",
"baseURL": "https://nullpay-backend-ib5q4.ondigitalocean.app/api",
})
session = client.checkout.sessions.create({
"amount": 10,
"currency": "USDCX",
"type": "multipay",
"success_url": "https://example.com/success",
"cancel_url": "https://example.com/cancel",
})
print(session["checkout_url"])
API surface
NullPay(config)
Supported config keys:
secretKeyorsecret_keybaseURLorbase_urlprojectRootorproject_rootconfigPathorconfig_pathtimeout
load_nullpay_config(project_root=None, config_path=None)
Loads nullpay.json from the provided project root or explicit path.
client.invoices
get_all()get_by_index(i)get_by_name(name)get_by_type(type_name)
client.checkout.sessions
create(params)retrieve(session_id)
create(...) mirrors the Node SDK behavior:
- accepts
nullpay_invoice_nameandnullpay_invoice_index - auto-generates a salt if
invoice_hashorsaltis missing - calls
/dps/relayer/create-invoice - polls the Provable
salt_to_invoicemapping - performs best-effort dashboard sync via
/invoices - finally creates the hosted checkout session via
/checkout/sessions
client.webhooks
verify_signature(payload, signature)construct_event(payload, signature)
Framework examples
See examples/ for:
- FastAPI
- Flask
- Django
Tests
Run from this package directory:
python -m unittest discover -s tests
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 nullpay_python-0.1.0.tar.gz.
File metadata
- Download URL: nullpay_python-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22a77961c68369143520f300aae001c5cd7081eb3ebfbc9d3db7510e53bccdc4
|
|
| MD5 |
681598dedd6f5c657535aa2e2fd4b567
|
|
| BLAKE2b-256 |
c0d55bccb3bf846dd93f5ca516b3e5ab8d56446296e87cbb70d972c6833df5b4
|
File details
Details for the file nullpay_python-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nullpay_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afc8982d154e5abc3e80dd70df736998b92596edaf0bb9d3774a0d5f913144cf
|
|
| MD5 |
748588b7a8ee5ce8ee06cea919f4b6cb
|
|
| BLAKE2b-256 |
0c08376c1619cef72ff511ce5a40b79267177e0ae7cb512d296fcc0afcc8b8b5
|