A clean, modern, and test-driven Python client for the Paystack API.
Built to eliminate boilerplate, this library provides a high-level, type-safe interface for integrating payments into your Python applications with confidence.
- Full API Coverage: Supports all Paystack endpoints from transactions to terminals.
- Predictable Responses: Every call returns a structured
(data, meta)tuple. - Robust Error Handling: Specific exceptions for validation, authentication, and network errors.
- Type-Safe: Fully typed with type hints for a better developer experience.
- Secure Webhooks: Built-in utilities for signature verification and IP whitelisting.
pip install paystack-api-wrapperimport os
from paystack import PaystackClient, APIError
# Initialize client
client = PaystackClient(secret_key=os.getenv("PAYSTACK_SECRET_KEY"))
try:
# Initialize a transaction
data, meta = client.transactions.initialize(
email="customer@example.com",
amount=50000, # in kobo
)
print(f"Checkout URL: {data['authorization_url']}")
except APIError as e:
print(f"Paystack error: {e.message}")- Full Usage Guide - Deep dive into initialization, pagination, and error handling.
- API Reference - Complete list of available resources and methods.
- Webhooks Guide - Securely handling real-time notifications.
The client exposes all Paystack resources as intuitive properties:
apple_pay, bulk_charges, charge, customers, dedicated_virtual_accounts, direct_debit, disputes, integration, miscellaneous, payment_pages, payment_requests, plans, products, refunds, settlements, subaccounts, subscriptions, terminal, transactions, transaction_splits, transfers, transfers_control, transfer_recipients, verification, virtual_terminal.
Contributions are welcome! Please see the Contributing Guide to get started.
MIT © Joseph Ezekiel – see LICENSE for details.