payzum — official Python SDK
Accept crypto and stablecoin payments (USDC/USDT, multi-chain) with Payzum. Non-custodial — funds settle to your own wallet. Zero runtime dependencies.
pip install payzum
You need two values from your Payzum dashboard: an API key and a webhook secret.
Charge a customer
from payzum import Payzum
payzum = Payzum("your-api-key") # Payzum.sandbox(...) for staging
invoice = payzum.payments.create(
price_amount="49.99", # a string or Decimal — never a float
price_currency="usd",
pay_currency="all", # the buyer picks the coin on the checkout page
order_id="ORDER-12345",
ipn_callback_url="https://your-shop.example/payzum/ipn",
idempotency_key="ORDER-12345", # lets the SDK retry safely on network hiccups
)
redirect(invoice["invoice_url"]) # send the buyer to the hosted checkout
That's the whole flow: create, redirect, and wait for the webhook. Which coins the buyer can pick is configured in your dashboard, not in code.
Get notified when it's paid
Payzum POSTs a signed webhook (IPN) to your ipn_callback_url. Hand the SDK
the raw request body and the headers — it finds the right header, checks
the signature and rejects replays, all by itself:
from payzum import Payzum, PaymentStatus, SignatureError
try:
data = Payzum.webhooks(webhook_secret).verify_payment_ipn(
request.get_data(), # RAW bytes, before any parsing
request.headers,
)
except SignatureError:
return "bad signature", 401
status = PaymentStatus.from_merchant(data["payment_status"])
if status.is_paid():
fulfil_order(data["order_id"]) # only fulfil on is_paid()
Deliveries can arrive more than once — deduplicate on
verifier.event_id(request.headers) if a repeat must be a no-op on your side.
Statuses
A payment is always in one of five states: waiting, partially_paid,
finished, expired, failed. Everything you need is on the enum:
status.is_paid()— safe to fulfil (covers overpayment too).status.is_terminal()— nothing further will happen.PaymentStatus.from_merchant(...)raises on anything unexpected, so a surprise value can never be mistaken for "paid".
Errors
Everything raises a typed exception: ApiError (with .error_code, e.g.
AMOUNT_BELOW_MINIMUM, to branch on), SignatureError for webhooks,
TransportError for network failures, PayzumError for local validation.
Transient failures are retried for you, honouring the server's back-off hints.
A create is only retried when you pass an idempotency_key, and then in a
way that cannot double-charge.
Amounts are exact
Amounts go in as str/Decimal and come back as Decimal — the SDK never
converts money through a float in either direction.
Testing your integration
Payzum(api_key, transport=...) accepts any object with the
Transport.send() shape, so you can test without touching the network. The
SDK's own suite runs with python -m unittest discover -s tests.
Docs: https://merchant.payzum.com/docs · llms: https://merchant.payzum.com/llms.txt
Metadata
Release files for payzum 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 | |
|---|---|---|---|
| payzum-0.1.0.tar.gz | 23.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| payzum-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.3 kB
Release files / payzum-0.1.0.tar.gz
| Download URL | payzum-0.1.0.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dbc65c422fa3c9d2b87904d002cade66c13da7e5dfd7bb44347383b58301a9db
|
|
BLAKE2b-256 checksum How to use checksums |
d19e64c06e2a8726024f78d3e735cda8ea470260dcff3e4f9c650c81a72b85f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|
Release files / payzum-0.1.0-py3-none-any.whl
| Download URL | payzum-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ca86ce03e66bfa7d930bdc7d88ff7494d60b31aab7a21a6516cd29310e5f16d
|
|
BLAKE2b-256 checksum How to use checksums |
fe83771855059a19c4b5c43014b6843b3643d0e9061d34e4d6bc5c12ff66ae1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.12
|