Skip to content

Pypaystack2 Package Reference

Pypaystack2 is a simple python wrapper for Paystack API.

it is a fork of the original project Pypaystack Modules and packages exported by this package: - api: A package containing several wrappers for Paystack API, like apple pay api, bulk charges api e.t.c. - utils: A module containing useful utilities and enums - errors: A module containing error types for pypaystack2

pypaystack2.paytack

AsyncPaystack

Bases: BaseAsyncAPI

An asynchronous Paystack API wrapper class with all the wrappers supported by pypaystack2.

This class has all the individual api wrapper classes like ApplePay, BulkCharge bound to it. its intent is to reduce the number of imports by exposing all the api wrappers bound to it via an instance of this class.

Source code in src/pypaystack2/paystack.py
class AsyncPaystack(BaseAsyncAPI):
    """An asynchronous Paystack API wrapper class with all the wrappers supported by pypaystack2.

    This class has all the individual api wrapper classes like `ApplePay`, `BulkCharge` bound to it.
    its intent is to reduce the number of imports by exposing all the api wrappers bound to it via an
    instance of this class.
    """

    def __init__(self, auth_key: str = None):
        super().__init__(auth_key=auth_key)
        self.apple_pay = AsyncApplePay(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.bulk_charges = AsyncBulkCharge(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.charge = AsyncCharge(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.integration = AsyncIntegration(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.customers = AsyncCustomer(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.dedicated_accounts = AsyncDedicatedAccount(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.disputes = AsyncDispute(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.payment_requests = AsyncPaymentRequest(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.miscellaneous = AsyncMiscellaneous(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.payment_pages = AsyncPaymentPage(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.plans = AsyncPlan(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.products = AsyncProduct(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.refunds = AsyncRefund(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.settlements = AsyncSettlement(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.splits = AsyncTransactionSplit(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.subaccounts = AsyncSubAccount(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.subscriptions = AsyncSubscription(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.terminals = AsyncTerminal(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.transactions = AsyncTransaction(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.transfer_recipients = AsyncTransferRecipient(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.transfers = AsyncTransfer(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.transfer_control = AsyncTransferControl(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.verification = AsyncVerification(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)

Paystack

Bases: BaseAPI

A Paystack API wrapper class with all the wrappers supported by pypaystack2.

This class has all the individual api wrapper classes like ApplePay, BulkCharge bound to it. its intent is to reduce the number of imports by exposing all the api wrappers bound to it via an instance of this class.

Source code in src/pypaystack2/paystack.py
class Paystack(BaseAPI):
    """A Paystack API wrapper class with all the wrappers supported by pypaystack2.

    This class has all the individual api wrapper classes like `ApplePay`, `BulkCharge` bound to it.
    its intent is to reduce the number of imports by exposing all the api wrappers bound to it via an
    instance of this class.
    """

    def __init__(self, auth_key: str = None):
        super().__init__(auth_key=auth_key)
        self.apple_pay = ApplePay(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.bulk_charges = BulkCharge(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.charge = Charge(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.integration = Integration(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.customers = Customer(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.dedicated_accounts = DedicatedAccount(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.disputes = Dispute(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.payment_requests = PaymentRequest(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.miscellaneous = Miscellaneous(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.payment_pages = PaymentPage(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.plans = Plan(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.products = Product(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.refunds = Refund(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.settlements = Settlement(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.splits = TransactionSplit(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.subaccounts = SubAccount(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.subscriptions = Subscription(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.terminals = Terminal(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.transactions = Transaction(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.transfer_recipients = TransferRecipient(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.transfers = Transfer(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)
        self.transfer_control = TransferControl(
            auth_key=self._PAYSTACK_AUTHORIZATION_KEY
        )
        self.verification = Verification(auth_key=self._PAYSTACK_AUTHORIZATION_KEY)

pypaystack2.api

A package containing several wrappers for interfacing Paystack API, like apple pay api, bulk charges api e.t.c. Modules exported by this package: - apple_pay: A module containing implementations for interfacing with Paystack's Apple Pay API - bulk_charges: A module containing implementations for interfacing with Paystack's Bulk Charges API - charge: A module containing implementations for interfacing with Paystack's Charge API - control_panel: A module containing implementations for interfacing with Paystack's Control Panel API - customer: A module containing implementations for interfacing with Paystack's Customer API - dedicated_accounts: A module containing implementations for interfacing with Paystack's Dedicated Accounts API - disputes: A module containing implementations for interfacing with Paystack's Disputes API - invoices: A module containing implementations for interfacing with Paystack's Invoices API - miscellaneous: A module containing implementations for interfacing with Paystack's Miscellaneous API - payment_pages: A module containing implementations for interfacing with Paystack's Payment Page API - plans: A module containing implementations for interfacing with Paystack's Plans API - products: A module containing implementations for interfacing with Paystack's Products API - refunds: A module containing implementations for interfacing with Paystack's Refunds API - settlements: A module containing implementations for interfacing with Paystack's Settlements API - splits: A module containing implementations for interfacing with Paystack's Splits API - subaccounts: A module containing implementations for interfacing with Paystack's Sub Account API - subscriptions: A module containing implementations for interfacing with Paystack's Subscriptions API - transactions: A module containing implementations for interfacing with Paystack's Transactions API - transfer_recipients: A module containing implementations for interfacing with Paystack's Transfer Recipients API - transfers: A module containing implementations for interfacing with Paystack's Transfers API - transfers_control: A module containing implementations for interfacing with Paystack's Transfers Control API - verification: A module containing implementations for interfacing with Paystack's Verification API

wrappers within pypaystack2.api

pypaystack2.utils

pypaystack2.exceptions

InvalidDataException

Bases: Exception

Invalid input recognized. Saves unnecessary request to the server

Source code in src/pypaystack2/exceptions.py
class InvalidDataException(Exception):
    """
    Invalid input recognized. Saves unnecessary request to the server
    """

    pass

InvalidMethodException

Bases: Exception

Invalid or unrecognized/unimplemented HTTP request method

Source code in src/pypaystack2/exceptions.py
class InvalidMethodException(Exception):
    """
    Invalid or unrecognized/unimplemented HTTP request method
    """

    pass

MissingAuthKeyException

Bases: Exception

We can't find the authentication key

Source code in src/pypaystack2/exceptions.py
1
2
3
4
5
6
class MissingAuthKeyException(Exception):
    """
    We can't find the authentication key
    """

    pass