Skip to content

Latest commit

 

History

History
402 lines (272 loc) · 10.1 KB

File metadata and controls

402 lines (272 loc) · 10.1 KB

paystack.Subscription

All URIs are relative to https://api.paystack.co

Method HTTP request Description
create POST /subscription Create Subscription
disable POST /subscription/disable Disable Subscription
enable POST /subscription/enable Enable Subscription
fetch GET /subscription/{code} Fetch Subscription
list GET /subscription List Subscriptions
manage_email POST /subscription/{code}/manage/email Send Update Subscription Link
manage_link POST /subscription/{code}/manage/link Generate Update Subscription Link

create

Response create(customer, plan, authorization=authorization, start_date=start_date)

Create Subscription

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

customer = 'customer_example' # str | Customer's email address or customer code
plan = 'plan_example' # str | Plan code

# Create Subscription

response = paystack.Subscription.create(
    customer,
    plan,
)

pprint(response)

Parameters

Name Type Description Notes
customer str Customer's email address or customer code
plan str Plan code
authorization str If customer has multiple authorizations, you can set the desired authorization you wish to use for this subscription here. If this is not supplied, the customer's most recent authorization would be used [optional]
start_date datetime Set the date for the first debit. (ISO 8601 format) e.g. 2017-05-16T00:30:13+01:00 [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded, application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

disable

Response disable(code, token)

Disable Subscription

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

code = 'code_example' # str | Subscription code
token = 'token_example' # str | Email token

# Disable Subscription

response = paystack.Subscription.disable(
    code,
    token,
)

pprint(response)

Parameters

Name Type Description Notes
code str Subscription code
token str Email token

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded, application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

enable

Response enable(code, token)

Enable Subscription

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

code = 'code_example' # str | Subscription code
token = 'token_example' # str | Email token

# Enable Subscription

response = paystack.Subscription.enable(
    code,
    token,
)

pprint(response)

Parameters

Name Type Description Notes
code str Subscription code
token str Email token

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded, application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

fetch

Response fetch(code)

Fetch Subscription

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

code = 'code_example' # str | 

# Fetch Subscription

response = paystack.Subscription.fetch(
    code,
)

pprint(response)

Parameters

Name Type Description Notes
code str

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list

Response list(per_page=per_page, page=page, plan=plan, customer=customer, _from=_from, to=to)

List Subscriptions

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'


# List Subscriptions

response = paystack.Subscription.list(
)

pprint(response)

Parameters

Name Type Description Notes
per_page int Number of records to fetch per page [optional]
page int The section to retrieve [optional]
plan str Plan ID [optional]
customer str Customer ID [optional]
_from datetime The start date [optional]
to datetime The end date [optional]

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
404 Entity not found -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

manage_email

Response manage_email(code)

Send Update Subscription Link

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

code = 'code_example' # str | 

# Send Update Subscription Link

response = paystack.Subscription.manage_email(
    code,
)

pprint(response)

Parameters

Name Type Description Notes
code str

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

manage_link

Response manage_link(code)

Generate Update Subscription Link

Example

  • Bearer Authentication (bearerAuth):
import paystack
from pprint import pprint

# Set your API key based on domain (test or live mode)
paystack.api_key = 'sk_domain_xxxxxxxx'

code = 'code_example' # str | 

# Generate Update Subscription Link

response = paystack.Subscription.manage_link(
    code,
)

pprint(response)

Parameters

Name Type Description Notes
code str

Return type

Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Request successful -
401 Unauthorized operation -
0 Server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]