Installation & Configuration
The official Python SDK for the Felloh payments API. Use it to manage bookings, transactions, payment links, and all other Felloh resources from your Python backend.
Installation
The SDK requires Python 3.10 or later. It uses httpx for async HTTP requests.
Install the SDK
pip install felloh
Quick Start
Import the FellohClient class and create an instance with your API keys. The client is fully async and handles
authentication, token management, retries, and pagination automatically.
Your API keys can be created and managed from the Felloh dashboard. See the API Keys resource for managing keys programmatically.
Remember to call await client.close() when you're done, or use the async context manager to handle cleanup automatically.
Quick Start
import asyncio
from felloh import FellohClient
from felloh.types import FellohConfig
client = FellohClient(FellohConfig(
public_key="your-public-key",
private_key="your-private-key",
))
async def main():
bookings = await client.bookings.list({
"organisation": "your-org-id",
})
print(bookings["data"])
await client.close()
asyncio.run(main())
Configuration Options
The FellohConfig dataclass accepts the following options.
Parameters
- Name
public_keyrequired- Type
- str
- Description
Your Felloh public API key.
- Name
private_keyrequired- Type
- str
- Description
Your Felloh private API key.
- Name
base_url- Type
- str
- Description
Base URL for the Felloh API. Defaults to
https://api.felloh.com.
- Name
timeout- Type
- float
- Description
Request timeout in seconds. Defaults to
30.0.
- Name
max_retries- Type
- int
- Description
Number of automatic retries on 5xx or network errors. Defaults to
2. Uses exponential backoff.
- Name
token_refresh_buffer- Type
- int
- Description
Seconds before token expiry to proactively refresh. Defaults to
60.
- Name
logger- Type
- callable
- Description
Optional callback invoked after every HTTP request for logging and observability. Receives a
LogEntryobject.
Full Configuration
from felloh import FellohClient
from felloh.types import FellohConfig
client = FellohClient(FellohConfig(
public_key="your-public-key",
private_key="your-private-key",
base_url="https://api.felloh.com",
timeout=30.0,
max_retries=2,
token_refresh_buffer=60,
logger=lambda entry: print(
f"{entry.method} {entry.url} → "
f"{entry.status_code} ({entry.duration_ms:.0f}ms)"
),
))
Token Management
The SDK automatically handles JWT token acquisition and refresh. Tokens are cached in memory and proactively refreshed
before expiry based on the token_refresh_buffer setting. No manual token management is needed.
If a request receives a 401 response, the SDK will automatically refresh the token and retry the request once. Token refreshes are
serialised using an asyncio.Lock to prevent concurrent refresh requests.
Available Resources
Every resource on the Felloh API is accessible through an attribute on the client instance.
| Resource | Client Attribute | Documentation |
|---|---|---|
| Organisations | client.organisations | Organisations |
| Bookings | client.bookings | Bookings |
| Booking Components | client.booking_components | Booking Components |
| Transactions | client.transactions | Transactions |
| Customers | client.customers | Customers |
| Payment Links | client.payment_links | Payment Links |
| Ecommerce | client.ecommerce | Ecommerce |
| Refunds | client.refunds | Refunds |
| Charges | client.charges | Charges |
| Chargebacks | client.chargebacks | Chargebacks |
| Credit Notes | client.credit_notes | Credit Notes |
| Suppliers | client.suppliers | Suppliers |
| Beneficiaries | client.beneficiaries | Beneficiaries |
| Disbursements | client.disbursements | Disbursements |
| Ledger | client.ledger | Ledger |
| Acquirer Settlement | client.batches | Acquirer Settlement |
| API Keys | client.api_keys | API Keys |
| Audit | client.audit | Audit |
| AISP | client.aisp | AISP |
| Scheduled Payments | client.scheduled_payments | Scheduled Payments |
| Enums | client.enums | Enums |
