Async Transactions Module

This wrapper class facilitates asynchronous integration with Paystack Transactions API. The Transactions API allows you to create and manage payments on your integration.

Note

You can use convert_currency() to convert to subunit. Authorization code are generated upon a successful card transaction.


class AsyncTransactionClientAPI(secret_key: str = None)

Paystack Transaction API Reference: Transaction

async charge_authorization(email: str, amount: int, authorization_code: str, reference: str | None = None, currency: str | None = None, channels: List[str] | None = None, subaccount: str | None = None, transaction_charge: int | None = None, bearer: str | None = None, queue: bool | None = None, metadata: Dict[str, List[Dict[str, Any]]] | None = None)→ PayStackResponse

Charge an authorization transaction

Parameters:
  • email (str) – The email of the customer

  • amount (int) – amount should be in subunit in this case 10000 kobo = 100 naira.

  • authorization_code (str) – Value: AUTH***************RW2

  • reference (str, optional) – This is a unique reference.

  • currency (str, optional)

  • channels (list, optional) – Channels.value.value

  • subaccount (str, optional)

  • transaction_charge (int, optional) – Amount of transaction charge to charge

  • bearer (str, optional) – Who bears Paystack charges? Two options: account | subaccount

  • queue (bool, optinoal) – If set to true, the transaction will be queued for processing

  • metadata (Dict[str, List[Dict[str, Any]]]) – JSON object of custom data.

Returns:

The response from the API

Return type:

PayStackResponse object

async export_transactions(per_page: int | None = 50, page: int | None = 1, customer: int | None = None, currency: str | None = None, amount: int | None = None, status: str | None = None, settled: bool | None = None, settlement: int | None = None, payment_page: int | None = None, from_date: date | None = None, to_date: date | None = None)→ PayStackResponse

Export transactions

Parameters:
  • per_page (int, optional) – The number of transaction records to return per page.

  • page (int, optional) – The page to return.

  • customer (str, optional)

  • currency (str, optional)

  • amount (int, optional)

  • status (str, optional)

  • settled (bool,optional)

  • settlement (int, optional)

  • payment_page (int, optional)

  • from_date (date, optional) – The customer’s from date.

  • to_date (date, optional) – The customer’s to date.

Returns:

The response from the API

Return type:

PayStackResponse object

async fetch_transaction(transaction_id: int)→ PayStackResponse

Fetch details of a specific transaction

Parameters:

transaction_id (int) – ID of the transaction

Returns:

The response from the API

Return type:

PayStackResponse object

async initialize(email: str, amount: int, currency: str | None = None, reference: str | None = None, callback_url: str | None = None, plan: str | None = None, invoice_limit: int | None = None, channels: List[str] | None = None, split_code: str | None = None, subaccount: str | None = None, transaction_charge: int | None = None, bearer: str | None = None, metadata: Dict[str, Any] | None = None)→ PayStackResponse

Initiate a transaction

Parameters:
  • email (str)

  • amount (int)

  • currency (str, optional)

  • reference (str, optional) – This is a unique identifier. You can create of your choice

  • callback_url (str, optional) – Use this to override the callback url provided on the dashboard: https://example.com/callback

  • plan (str, optional) – If transaction is to create a subscription to a predefined plan, provide plan code here.

  • invoice_limit (int, optional) – Number of times to charge customer during subscription to plan

  • channels (list, optional) – Channels.value.value

  • split_code (str, optional) – Transaction split code

  • subaccount (str, optional) – The code for the subaccount that owns the payment.

  • transaction_charge (str, optional) – An amount used to override the split configuration for a # single split payment

  • bearer (str, optional) – Who bears Paystack charges? Two options are (account | subaccount)

Metadata:

JSON object of the custom data

Returns:

The response from the API

Return type:

PayStackResponse object

async list_transactions(per_page: int | None = 50, page: int | None = 1, customer: int | None = None, terminal_id: str | None = None, amount: int | None = None, status: str | None = None, from_date: date | None = None, to_date: date | None = None)→ PayStackResponse

List all transactions

Parameters:
  • per_page (int, optional) – The number of transaction records to return per page.

  • page (int, optional) – The page to return.

  • customer (str, optional) – Specify an ID for the customer whose transactions you want to retrieve

  • terminal_id – Specify an ID for the terminal whose transactions you want to retrieve

  • amount (int, optional)

  • status (str, optional) – Specify a status for the transactions you want to retrieve [success, failed, abandoned]

  • from_date (date, optional) – A timestamp from which to start listing transaction

  • to_date (date, optional) – A timestamp at which to stop listing transaction

Returns:

The response from the API

Return type:

PayStackResponse object

async partial_debit(email: str, authorization_code: str, amount: int, currency: str, reference: str | None = None, at_least: int | None = None)→ PayStackResponse

Charge a partial debit transaction

Parameters:
  • email (str) – The email of the customer

  • amount (int) – amount should be in subunit in this case 10000 kobo = 100 naira.

  • authorization_code (str) – Value: AUTH***************RW2

  • reference (str, optional) – This is a unique reference.

  • currency (str, optional)

  • at_least (int, optional) – Minimum amount to charge

Returns:

The response from the API

Return type:

PayStackResponse object

async transaction_timeline(id_or_reference: str)→ PayStackResponse

Get the timeline of a transaction

Parameters:

id_or_reference – The id or reference of the transaction you want to get

Returns:

The response from the API

Return type:

PayStackResponse object

async transaction_totals(per_page: int | None = 50, page: int | None = 1, from_date: date | None = None, to_date: date | None = None)→ PayStackResponse

Get total of all transactions

Parameters:
  • per_page (int, optional) – The number of transaction records to return per page.

  • page (int, optional) – The page to return.

  • from_date (date, optional) – A timestamp from which to start listing transaction

  • to_date (date, optional) – A timestamp at which to stop listing transaction

Returns:

The response from the API

Return type:

PayStackResponse object

async verify_transaction(reference: str)→ PayStackResponse

Verify a transaction by reference

Parameters:

reference (str)

Returns:

The response from the API

Return type:

PayStackResponse object

You can use the tool kit in the helpers module as reference: PayStackEase Helpers Package