Official Python SDK for the PawPayments Native V2 API
Project description
PawPayments — Python SDK
Official Python SDK for the PawPayments Native V2 API.
Ships both a synchronous client (PawPayments, built on requests) and an
asynchronous one (AsyncPawPayments, built on httpx).
Install
pip install pawpayments
Requires Python 3.9+.
Quickstart (sync)
from pawpayments import PawPayments
paw = PawPayments(api_key="…")
invoice = paw.invoices.create(
amount=25,
fiat_currency="USD",
billing_type="STATIC",
asset="usdt_tron",
description="Pro plan, 1 month",
notify_url="https://example.com/paw/webhook",
)
print(invoice["payment_url"])
Quickstart (async)
import asyncio
from pawpayments import AsyncPawPayments
async def main():
async with AsyncPawPayments(api_key="…") as paw:
invoice = await paw.invoices.create(
amount=25,
fiat_currency="USD",
billing_type="STATIC",
asset="usdt_tron",
)
print(invoice["payment_url"])
asyncio.run(main())
Resources
| Group | Methods |
|---|---|
paw.assets |
list() |
paw.rates |
get(base=, assets=) |
paw.balance |
get() |
paw.invoices |
create(**), get(id), list(**), notify(id) |
paw.payouts |
create(**, uniq_id=), get(id), list(**), batch(items, uniq_id=) |
paw.ledger |
list(type=, ...) |
paw.notifications |
list(**), test(url=) |
paw.permanent |
create(**), get(id), list(**), deactivate(id) |
payouts.create and payouts.batch accept an optional uniq_id for explicit
idempotency (UUIDv4). When omitted the SDK generates one with uuid.uuid4().
A repeated uniq_id within 2 hours yields a 409.
Payout requests use address. Invoice responses expose address_to and may
include address_from.
Webhook verification
from flask import Flask, request, abort
from pawpayments import Webhook
app = Flask(__name__)
@app.post("/paw/webhook")
def webhook():
raw = request.get_data()
sig = request.headers.get("X-Paw-Signature", "")
if not Webhook.verify_raw_body(raw, sig, API_KEY):
abort(401)
payload = Webhook.parse_payload(raw)
# …handle the invoice update…
return "", 200
Errors
from pawpayments import PawPaymentsApiError
try:
paw.invoices.create(...)
except PawPaymentsApiError as exc:
print(exc.code, exc.http_status, str(exc), exc.details)
Testing
pytest tests/test_webhook.py— signature unit tests + PHP-interop parity.PAW_API_KEY=… pytest tests/test_live.py tests/test_negative.py— live happy-path + negative-case suites againsthttps://api.pawpayments.com. Tests skip whenPAW_API_KEYis absent.
License
MIT
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 pawpayments-2.0.0.post1.tar.gz.
File metadata
- Download URL: pawpayments-2.0.0.post1.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ea29faf746d3004468dcc1329104d00223c9b07e011d4480bff18028cbdf8ba
|
|
| MD5 |
c65ceb7f9d0a97c09a3c0ba66b4d2403
|
|
| BLAKE2b-256 |
713bedd56e088b880549f8ca801846531e2a3bcede2476b5e829abdb270436d4
|
Provenance
The following attestation bundles were made for pawpayments-2.0.0.post1.tar.gz:
Publisher:
release.yml on PawPayments/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pawpayments-2.0.0.post1.tar.gz -
Subject digest:
6ea29faf746d3004468dcc1329104d00223c9b07e011d4480bff18028cbdf8ba - Sigstore transparency entry: 1591417654
- Sigstore integration time:
-
Permalink:
PawPayments/python-sdk@62f6b8c862fc89fe7f208fe9070f4e40c01921f1 -
Branch / Tag:
refs/tags/v2.0.0-p1 - Owner: https://github.com/PawPayments
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@62f6b8c862fc89fe7f208fe9070f4e40c01921f1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pawpayments-2.0.0.post1-py3-none-any.whl.
File metadata
- Download URL: pawpayments-2.0.0.post1-py3-none-any.whl
- Upload date:
- Size: 10.7 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 |
d5084533370646ab62b585138b9c48889465958d51d180635bfc0f52d18b41e2
|
|
| MD5 |
c46c30f2a37a2755ec2bc157d607968e
|
|
| BLAKE2b-256 |
d5e866caa8378b85d2bdc51543a9e707709883ba70448ab0ad42f68fbe77ad3f
|
Provenance
The following attestation bundles were made for pawpayments-2.0.0.post1-py3-none-any.whl:
Publisher:
release.yml on PawPayments/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pawpayments-2.0.0.post1-py3-none-any.whl -
Subject digest:
d5084533370646ab62b585138b9c48889465958d51d180635bfc0f52d18b41e2 - Sigstore transparency entry: 1591417709
- Sigstore integration time:
-
Permalink:
PawPayments/python-sdk@62f6b8c862fc89fe7f208fe9070f4e40c01921f1 -
Branch / Tag:
refs/tags/v2.0.0-p1 - Owner: https://github.com/PawPayments
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@62f6b8c862fc89fe7f208fe9070f4e40c01921f1 -
Trigger Event:
push
-
Statement type: