Payment Pages Module
This wrapper class facilitates synchronous integration with Paystack Payment Pages API. The Payment Pages API provides a quick and secure way to collect payment for products.
- class PaymentPagesClientAPI(secret_key: str = None)
Paystack Miscellaneous API Reference: Payment Pages
- add_products(payment_id: int, product: List[int])→ PayStackResponse
Add products to a payment page
- Parameters:
payment_id (int) – ID of the payment page
product (list) – List of product IDs
- Returns:
The response from the API.
- Return type:
PayStackResponse object
- check_slug_available(page_slug: str)→ PayStackResponse
Check if a page slug is available
- Parameters:
page_slug (str) – URL slug you would like to be associated with this page.
- Returns:
The response from the API.
- Return type:
PayStackResponse object
- create_payment_page(name: str, description: str | None = None, amount: int | None = None, split_code: str | None = None, page_slug: str | None = None, redirect_url: str | None = None, metadata: Dict[str, Any] | None = None, custom_fields: List[Dict[str, Any]] | None = None)→ PayStackResponse
Create a new payment page
- Parameters:
name (str) – Name of the payment page
description (str, optional) – Description of the payment page
amount (int, optional) – Amount of the payment page
split_code (str, optional) – Split code of the transaction split
page_slug (str, optional) – URL slug you would like to be associated with this page.
redirect_url (str, optional) – If you would like Paystack to redirect someplace upon successful payment, specify the URL here.
metadata (dict, optional) – Extra data to configure the payment page.
custom_fields (list, optional) – List of custom fields you would like to add to the payment page
- Returns:
The response from the API.
- Return type:
PayStackResponse object
- fetch_payment_page(page_id_or_slug: str)→ PayStackResponse
Fetch a payment page
- Parameters:
page_id_or_slug (str) – ID or slug of the payment page
- Returns:
The response from the API.
- Return type:
PayStackResponse object
- list_payment_pages(per_page: int | None = None, page: int | None = None, from_date: date | None = None, to_date: date | None = None)→ PayStackResponse
List all payment pages
- Parameters:
per_page (int, optional) – Number of payment pages per page
page (int, optional) – Page number
from_date (date, optional) – Date from which to list payment pages
to_date (date, optional) – Date to which to list payment pages
- Returns:
The response from the API
- Return type:
PayStackResponse object
- update_payment_page(page_id_or_slug: str, name: str | None = None, description: str | None = None, amount: int | None = None, active: bool | None = None)→ PayStackResponse
Update a payment page
- Parameters:
page_id_or_slug (str) – ID or slug of the payment page
name (str, optional) – Name of the payment page
description (str, optional) – Description of the payment page
amount (int, optional) – Amount of the payment page
active (bool, optional) – Whether the payment page url should be deactivated or not. Set False to deactivate
- Returns:
The response from the API.
- Return type:
PayStackResponse object
Note
The page_slug parameter in the create_payment_page method will be accessible at https://paystack.com/pay/[page_slug]
The metadata can include subaccount, logo image, transaction charge etc. See documentation on how to set
the custom_fields parameter: What are the metadata to be passed in the request data?.