Python SDK
Install and start using the Python SDK.
Intro
The Maxio Advanced Billing SDK provides access to the Maxio Advanced Billing REST APIs.
Maxio Advanced Billing (formerly Chargify) provides an HTTP-based API that conforms to the principles of REST. One of the many reasons to use Advanced Billing is the immense feature set and client libraries. The Maxio API returns JSON responses as the primary and recommended format, but XML is also provided as a backwards compatible option for merchants who require it.
Steps to make your first Maxio Advanced Billing API call
- Sign-up or log-in to your test site account.
- Setup authentication credentials.
- Submit an API request and verify the response.
- Test the Advanced Billing integrations.
Next, you can explore authentication methods, basic concepts for interacting with Advanced Billing via the API, and the entire set of application-based documentation to aid in your discovery of the product.
Request Example
The following example uses the curl command-line tool to make an API request.
Request
curl -u <api_key>:x -H Accept:application/json -H Content-Type:application/json https://acme.chargify.com/subscriptions.jsonInstallation
Add the SDK to your project from its folder, with whichever package manager your project uses. Give each tool a path containing a slash, such as ../maxio-advanced-billing — a bare folder name is looked up on PyPI instead, and resolves to whatever project holds that name there:
pip install <path-to-sdk>uv add <path-to-sdk>poetry add <path-to-sdk>Quick Start
Synchronous client
Construct MaxioAdvancedBillingClient with keyword arguments, and call close() when you are done. Every argument is optional.
from maxio_advanced_billing import MaxioAdvancedBillingClient
from maxio_advanced_billing.core import BasicAuthCredentials
client = MaxioAdvancedBillingClient(
basic_auth=BasicAuthCredentials(username="YOUR_USERNAME", password="YOUR_PASSWORD"), environment="us"
)
client.close()Alternatively, scope it — with MaxioAdvancedBillingClient(...) as client: closes the pool on exit.
Asynchronous client
AsyncMaxioAdvancedBillingClient mirrors MaxioAdvancedBillingClient with identical method names, and every endpoint method is a coroutine. It takes the same arguments, with some differences — for example, the transport argument is custom_async_http_client.
from asyncio import run
from maxio_advanced_billing import AsyncMaxioAdvancedBillingClient
from maxio_advanced_billing.core import BasicAuthCredentials
async def main() -> None:
client = AsyncMaxioAdvancedBillingClient(
basic_auth=BasicAuthCredentials(username="YOUR_USERNAME", password="YOUR_PASSWORD"), environment="us"
)
await client.aclose()
run(main())Alternatively, scope it — async with AsyncMaxioAdvancedBillingClient(...) as client: closes the pool on exit.