A clean, intuitive, and reliable Python wrapper for the Paystack API.
This library was built to eliminate repetitive boilerplate when integrating Paystack into your Python projects, while emphasizing modern design, robust error handling, and a test-driven foundation. Covers the full API with clean abstractions, so you can focus on building features—not handling payments.
See the Paystack API docs for reference, and explore the Usage Guide for practical examples.
pip install paystack-api-wrapper-
Initialize the client with your secret key
(Best practice: store your secret key as an environment variable
PAYSTACK_SECRET_KEY.)import os from paystack import PaystackClient, APIError secret_key = os.getenv("PAYSTACK_SECRET_KEY") client = PaystackClient(secret_key=secret_key)
-
Make an API call (e.g., initialize a transaction):
try: data, meta = client.transactions.initialize( email="customer@example.com", amount=50000, # amount in kobo currency="NGN" ) print("Transaction initialized:", data) # {'authorization_url': '...', 'access_code': '...', 'reference': '...'} except APIError as e: print(f"API error: {e.message}")
See the Full Usage Guide for details on handling responses, pagination, and advanced error management.
The client exposes all major Paystack API resources as properties:
apple_paybulk_chargeschargecustomersdedicated_virtual_accountsdirect_debitdisputesintegrationmiscellaneouspayment_pagespayment_requestsplansproductsrefundssettlementssubaccountssubscriptionsterminaltransactionstransaction_splitstransferstransfers_controltransfer_recipientsverificationvirtual_terminal
Contributions are welcome! Check out the contributing guide to get started.
MIT © Joseph Ezekiel – see LICENSE for details.