Subscriptions Module
This wrapper class facilitates synchronous integration with Paystack Subscriptions API. The Subscriptions API allows you to create and manage recurring payment on your integration.
- class SubscriptionClientAPI(secret_key: str = None)
Paystack Subscription API Reference: Subscriptions
- create_subscription(customer: str, plan_code: str, authorization: str, start_date: date | None = None)→ PayStackResponse
Create a subscription
- Parameters:
customer (str) – the customer id or email
plan_code (str) – the plan code
authorization (str) – the authorization code
start_date (date, optional) – the start date
- Returns:
The response from the API
- Return type:
PayStackResponse object
- disable_subscription(subscription_code: str, token: str)→ PayStackResponse
Disable a subscription
- Parameters:
subscription_code (str) – the subscription code
token (str) – the token sent to the customer email
- Returns:
The response from the API
- Return type:
PayStackResponse object
- enable_subscription(subscription_code: str, token: str)→ PayStackResponse
Enable a subscription
- Parameters:
subscription_code (str) – The subscription code
token (str) – The token sent to the customer email
- Returns:
The response from the API
- Return type:
PayStackResponse object
- fetch_subscription(id_or_code: str)→ PayStackResponse
Get details of a subscription
- Parameters:
id_or_code (str) – The subscription id or code
- Returns:
The response from the API
- Return type:
PayStackResponse object
- generate_update_subscription(subscription_code: str)→ PayStackResponse
Generate a link for updating the card on subscription
- Parameters:
subscription_code (str) – the subscription code
- Returns:
The response from thw API
- Return type:
PayStackResponse object
- list_subscriptions(per_page: int | None = 50, page: int | None = 1, customer: int | None = None, plan_code: int | None = None)→ PayStackResponse
List all subscriptions
- Parameters:
per_page (int, optional) – The number of subscriptions per page. (default: 50)
page (int, optional) – The page number. (default: 1)
customer (int, optional) – The customer number
plan_code (int, optional) – The plan code
- Returns:
The response from the API
- Return type:
PayStackResponse object
- send_update_subscription_link(subscription_code: str)→ PayStackResponse
Email a customer a link for updating the card on their subscription
- Parameters:
subscription_code (str) – The subscription code
- Returns:
The response from the API
- Return type:
PayStackResponse object