Install
Requires Python 3.10 or later.Configure
For asyncio, use
AsyncInvoiceAI. It has the same methods:
Create and send an invoice
idempotency_key, timeout, max_retries and extra_headers.
Errors and retries
Failed calls are retried up tomax_retries times with exponential backoff. The SDK retries network errors, timeouts, 408, 409 conflict, 429 and 5xx. Every POST gets an Idempotency-Key that’s reused on retries, so a retried create never runs twice. On a 429, it waits for Retry-After when that’s 60 seconds or less.
API errors extend
APIError and carry status, code, detail and request_id.
Pagination
Webhooks
Response headers
client.request("GET", "/business").
Testing
There’s no sandbox, so don’t point tests at your live account. Instead:-
Pass
http_client=httpx.Client(transport=httpx.MockTransport(handler))and return canned responses. -
Run a mock server from the spec, then set
INVOICE_AI_BASE_URL: -
Sign test webhook bodies with
sign_payload(body, secret), which returns the three signature headers.
Versioning
The SDK is in beta (0.x). A minor release can include breaking changes, so pin the minor version: horizonpay-invoice-ai~=0.1.0. Release notes are on GitHub.