FlexPrice Python SDK
Type-safe Python client for the FlexPrice API: billing, metering, and subscription management for SaaS and usage-based products.
Requirements
- Python 3.10+
Installation
pip install flexprice-temp
With uv or poetry:
uv add flexprice-temp
# or
poetry add flexprice-temp
Quick start
Initialize the client with your server URL and API key, then ingest an event:
from flexprice_temp import Flexprice
with Flexprice(
server_url="https://api.cloud.flexprice.io",
api_key_auth="YOUR_API_KEY",
) as flexprice:
# Ingest an event
result = flexprice.events.ingest_event(
request={
"event_name": "Sample Event",
"external_customer_id": "customer-123",
"properties": {"source": "python_app", "environment": "test"},
"source": "python_app",
}
)
print(result)
Async usage
The same client supports async when used as an async context manager:
import asyncio
from flexprice_temp import Flexprice
async def main():
async with Flexprice(
server_url="https://api.cloud.flexprice.io",
api_key_auth="YOUR_API_KEY",
) as flexprice:
result = await flexprice.events.ingest_event_async(
request={
"event_name": "Sample Event",
"external_customer_id": "customer-123",
"properties": {"source": "python_async", "environment": "test"},
"source": "python_async",
}
)
print(result)
asyncio.run(main())
Authentication
- Pass your API key as
api_key_authwhen creating the client. The SDK sends it in thex-api-keyheader. - Prefer environment variables (e.g.
FLEXPRICE_API_KEY) and load them in code; get keys from your FlexPrice dashboard or docs.
Features
- Full API coverage (customers, plans, events, invoices, payments, entitlements, etc.)
- Sync and async support
- Type-safe request/response models (Pydantic)
- Built-in retries and error handling
For a full list of operations, see the API reference or the generated docs/sdks/ in this repo.
Troubleshooting
- Missing or invalid API key: Ensure
api_key_authis set (or setFLEXPRICE_API_KEYand pass it in). Keys are for server-side use only. - Wrong server URL: Use
https://api.cloud.flexprice.io(no trailing slash). The SDK appends paths as needed. - 4xx/5xx on ingest: Event ingest returns 202 Accepted; for errors, check request fields (
event_name,external_customer_id,properties,source) against the API docs.
Documentation
- FlexPrice API documentation
- Python SDK examples in this repo
Metadata
Release files for flexprice-temp 0.0.36
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flexprice_temp-0.0.36.tar.gz | 222.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flexprice_temp-0.0.36-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 752.9 kB
Release files / flexprice_temp-0.0.36.tar.gz
| Download URL | flexprice_temp-0.0.36.tar.gz |
|---|---|
| Size | 222.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1390f5445d1aeb95bc8e43f405d10d1ba6fdab5ab17b6cc492c0791f94653ad5
|
|
BLAKE2b-256 checksum How to use checksums |
8d7711344b0bae8e1d08e045fcd6bea32f9335bf4e13d75d3f5864ff044f8b0c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Release files / flexprice_temp-0.0.36-py3-none-any.whl
| Download URL | flexprice_temp-0.0.36-py3-none-any.whl |
|---|---|
| Size | 530.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f11bb73353883959e691b0b4cccfafa7ff04ecf307a4406cee538a133440463b
|
|
BLAKE2b-256 checksum How to use checksums |
22cd052ce1126d279de571c6a9f07f9585352f7321eb4ca24aae02ad3e6b0270
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|