Fidloy Python SDK
Official Python SDK for the Fidloy API.
Install
pip install fidloy-sdk
Quick Start
from fidloy import Fidloy
client = Fidloy(api_key="YOUR_API_KEY")
transactions = client.list_transactions(business_id=2)
for txn in transactions:
print("ID:", txn.get("id"), "Amount:", txn.get("amount"))
client.close()
base_url is optional and already defaults to the production API.
Simplest 2 Examples
Example 1: Show transactions
from fidloy import Fidloy
client = Fidloy(api_key="YOUR_API_KEY")
for txn in client.list_transactions(business_id=2):
print(txn.get("id"), txn.get("amount"))
client.close()
Example 2: Show customers
from fidloy import Fidloy
client = Fidloy(api_key="YOUR_API_KEY")
for customer in client.list_customers(business_id=2):
print(customer.get("id"), customer.get("first_name"), customer.get("phone"))
client.close()
Example 3: Get point balance
from fidloy import Fidloy
client = Fidloy(api_key="YOUR_API_KEY")
balance = client.get_points_balance(business_id=2, customer_id=30)
print(f"Balance: {balance.get('points_balance')} points")
client.close()
Example 4: Validate coupon
from fidloy import Fidloy
client = Fidloy(api_key="YOUR_API_KEY")
result = client.validate_coupon(
business_id=2,
code="SUMMER20",
amount=10000,
customer_id=30,
phone="+250788000000",
email="customer@example.com"
)
if result.get("valid"):
print(f"Coupon valid! Discount: {result.get('discount_amount')}")
else:
print(f"Invalid coupon: {result.get('error')}")
client.close()
Also Available (Direct Client)
from fidloy_sdk import FidloyClient
client = FidloyClient(api_key="YOUR_API_KEY")
customer = client.create_customer(
first_name="Alex",
last_name="Bwana",
business_id=2,
phone="+250788000000",
)
print(customer)
client.close()
Main Features
- API-key authenticated requests
- Very simple
Fidloyfacade for beginners - Customer-in-business reward history helper methods
- Customer and transaction creation helpers
- Points and coupon redemption helpers
- Point balance checking and point rules listing
- Coupon validation and code checking
- Receipt and webhook creation helpers
- Typed, predictable exceptions
- Configurable timeout and headers
Core Methods
get_rewards_historyget_customer_rewards_historycreate_customercreate_transactioncreate_receiptcreate_webhookredeem_pointsredeem_couponget_points_balancelist_point_ruleslist_point_rules_categorizedvalidate_coupon
Publish to PyPI
Recommended: Trusted Publishing (GitHub Actions)
Follow PYPI_RELEASE_CHECKLIST.md to configure PyPI Trusted Publisher.
Then publish by creating a GitHub Release for your version tag.
Manual upload (fallback)
python -m pip install --upgrade build twine
python -m build
python -m twine upload dist/*
Use a PyPI token when uploading.
Metadata
Release files for fidloy-sdk 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fidloy_sdk-0.1.9.tar.gz | 11.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fidloy_sdk-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.7 kB
Release files / fidloy_sdk-0.1.9.tar.gz
| Download URL | fidloy_sdk-0.1.9.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfb2c8d37d426b34ee1e00e8cd0a6d23d584670131e37d279680972deffdb627
|
|
BLAKE2b-256 checksum How to use checksums |
73fa477cf95a056cad50748df76e3f68e382e4ad1d451556dbbb970dadfe1729
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / fidloy_sdk-0.1.9-py3-none-any.whl
| Download URL | fidloy_sdk-0.1.9-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73455d9ee9772073759c4a7ab7477bc7ddfcdfb57c42da31a8ead7224ac43e97
|
|
BLAKE2b-256 checksum How to use checksums |
141c3e5bd47831a347074cb4d90d3f131397790a0669438ed8cbe981acb557d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|