httpx 0.27 or newer.
It provides synchronous and asynchronous clients.
Python SDK on GitHub
Browse the source code, examples, releases, and issue tracker.
Installation
Synchronous client
UseBillionsApi as a context manager so its HTTP client is closed
automatically:
Asynchronous client
AsyncBillionsApi exposes the same operations as coroutines:
Available methods
Both clients expose the same methods. Await them when usingAsyncBillionsApi.
https://api.billions.works, and the default public API
version is v1. You can override both or inject a custom httpx.Client or
httpx.AsyncClient.
Process webhook events
Useget_invoice_from_webhook() for both intermediate
invoice.status_changed events and final invoice.paid events:
Verify a paid event
verify_invoice_paid() accepts the current webhook envelope and legacy callback
objects. It retrieves the authoritative invoice from the API, requires
completed status, and compares the callback status and paid amount.
Decimal forms such as 100, 100.0, and 100.000000000000000000 are treated
as equivalent.
Errors
Transport errors use
status_code == 0.