Skip to main content
The Python SDK supports Python 3.10 or newer and uses 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

Use BillionsApi 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 using AsyncBillionsApi.
The default API host is 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.

Verify a payment callback

verify_invoice_paid() 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.