Python SDK for Lenco API - Payments, Transfers, Collections
pip install lenco-python
# or
poetry add lenco-pythonfrom lenco import Lenco
client = Lenco(
api_key="your-api-key",
environment="production" # or "sandbox"
)
# Get accounts
accounts = client.accounts.list()
# Transfer to bank account
transfer = client.transfers.to_bank_account(
account_id="your-account-uuid",
account_number="0123456789",
bank_id="bank-uuid",
amount=10000,
reference="payment-001",
narration="Payment for services"
)
# Collect via mobile money
collection = client.collections.from_mobile_money(
amount=5000,
reference="order-123",
phone="0971234567",
operator="airtel",
country="zm"
)import asyncio
from lenco import AsyncLenco
async def main():
client = AsyncLenco(api_key="your-api-key")
# Concurrent requests
accounts, banks = await asyncio.gather(
client.accounts.list(),
client.banks.list(country="ng")
)
print(f"Found {len(accounts)} accounts")
print(f"Found {len(banks)} banks")
asyncio.run(main())- Full type hints support
- Sync and async clients
- Accounts, Banks, Transfers, Collections, Settlements, Transactions APIs
- Webhook signature verification
- Automatic retries with exponential backoff
- Pydantic models for request/response validation
Full API documentation available at docs.lenco.co
Alexander Asomba (@alexasomba) · 𝕏 @alexasomba
MIT