Payment Requests Module

This wrapper class facilitates synchronous integration with Paystack Payment Requests API. The Payment Requests API allows you manage requests for payment of goods and services.


class PaymentRequestClientAPI(secret_key: str = None)

Paystack Payment Request API Reference: Payment Requests

archive_payment_request(code: str)→ PayStackResponse

Archive a payment request

Parameters:

code (str) – Payment request code

Returns:

The response from the API.

Return type:

PayStackResponse object

create_payment_request(customer: str, amount: int, draft: bool, has_invoice: bool, send_notification: bool, due_date: date | None = None, description: str | None = None, line_items: List[Dict[str, Any]] | None = None, tax: List[Dict[str, Any]] | None = None, currency: str | None = None, invoice_number: int | None = None, split_code: str | None = None)→ PayStackResponse

Create a payment request for a transaction

Parameters:
  • customer (str) – Customer’S ID

  • amount (int) – Amount of the payment request

  • draft (bool) – Whether the payment request is a draft

  • has_invoice (bool) – Whether the payment request has an invoice

  • send_notification (bool) – Whether the payment request should send a notification

  • due_date (date, optional) – Due date of the payment request

  • description (str, optional) – Description of the payment request

  • line_items (List[Dict[str, Any]], optional) – List of line items of the payment request

  • tax (List[Dict[str, Any]], optional) – List of taxes of the payment request

  • currency (str, optional) – Currency of the payment request

  • invoice_number (int, optional) – Invoice number of the payment request

  • split_code (str, optional) – Split code of the transaction split

Returns:

The response from the API.

Return type:

PayStackResponse object

fetch_payment_request(id_or_code: str)→ PayStackResponse

Fetch a payment request

Parameters:

id_or_code (str) – Payment request ID or code

Returns:

The response from the API.

Return type:

PayStackResponse object

finalize_payment_request(code: str, send_notification: bool)→ PayStackResponse

Finalize a payment request

Parameters:
  • code (str) – Payment request code

  • send_notification (bool) – Whether the notification should be sent

Returns:

The response from the API.

Return type:

PayStackResponse object

list_payment_requests(per_page: int | None = 50, page: int | None = 1, customer: str | None = None, status: str | None = None, currency: str | None = None, include_archive: bool | None = True, from_date: date | None = None, to_date: date | None = None)→ PayStackResponse

List payment requests

Parameters:
  • per_page (int, optional) – Number of results per page

  • page (int, optional) – Page number

  • customer (str, optional) – Filter by Customer ID

  • status (str, optional) – Filter by payment request status.

  • currency (str, optional) – Filter by currency

  • include_archive (bool, optional) – Whether to include archived payment requests. (default: True)

  • from_date (date, optional) – Filter by from date

  • to_date (date, optional) – Filter by to date

Returns:

The response from the API

Return type:

PayStackResponse object

payment_request_total()→ PayStackResponse

Get the total number of payment requests

Returns:

The response from the API

Return type:

PayStackResponse object

send_notification(code: str)→ PayStackResponse

Send a notification to a payment request to a customer

Parameters:

code (str) – Payment request code

Returns:

The response from the API.

Return type:

PayStackResponse object

update_payment_request(id_or_code: str, customer: str | None = None, amount: int | None = None, description: str | None = None, line_items: List[Dict[str, Any]] | None = None, tax: List[Dict[str, Any]] | None = None, currency: str | None = None, due_date: date | None = None, send_notification: bool | None = True, draft: bool | None = True, invoice_number: int | None = None, split_code: str | None = None)→ PayStackResponse

Update a payment request

Parameters:
  • id_or_code (str) – Payment request ID or code

  • customer (str, optional) – Customer ID

  • amount (int, optional) – Amount of the payment request

  • description (str, optional) – Description of the payment request

  • line_items (List[Dict[str, Any]], optional) – List of line items of the payment request

  • tax (List[Dict[str, Any]], optional) – List of taxes of the payment request

  • currency (str, optional) – Currency of the payment request

  • due_date (date, optional) – Due date of the payment request

  • send_notification (bool, optional) – Whether the notification should be sent. (default: True)

  • draft (bool, optional) – Whether the payment request is a draft. (default: True)

  • invoice_number (int, optional) – Invoice number of the payment request

  • split_code (str, optional) – Split code of the transaction split

Returns:

The response from the API

Return type:

PayStackResponse object

verify_payment_request(code: str)→ PayStackResponse

Verify a payment request

Parameters:

code (str) – Payment request code

Returns:

The response from the API.

Return type:

PayStackResponse object

The line_items is a List type that contains a dictionary of key-value pairs as seen in the usage. The keys are: name, amount and quantity.

Usage

[{“name”:”item 1”, “amount”:2000, “quantity”: 1}]

The tax is follows same as list_items parameter except with the keys are different. The keys are: name and amount.

Usage

[{“name”:”VAT”, “amount”:200}]

See documentation on how to pass string values of enum classes Tool kit module in the status parameter.