Async Subscriptions Module

This wrapper class facilitates asynchronous integration with Paystack Subscriptions API. The Subscriptions API allows you to create and manage recurring payment on your integration.


class AsyncSubscriptionClientAPI(secret_key: str = None)

Paystack Subscription API Reference: Subscriptions

async 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

async 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

async 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

async 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

async 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

async 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

async 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