(subscriptions)
- list - List Subscriptions
- export - Export Subscriptions
- update - Update Subscription
- revoke - Revoke Subscription
List subscriptions.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.subscriptions.list()
while res is not None:
# Handle items
res = res.next()
models.SubscriptionsListResponse
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Export subscriptions as a CSV file.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.subscriptions.export()
# Handle response
print(res)
Any
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Update a subscription.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.subscriptions.update(id="<value>", subscription_update={
"revoke": True,
})
# Handle response
print(res)
models.Subscription
Error Type |
Status Code |
Content Type |
models.AlreadyCanceledSubscription |
403 |
application/json |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Revoke a subscription, i.e cancel immediately.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.subscriptions.revoke(id="<value>")
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
The subscription ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Subscription
Error Type |
Status Code |
Content Type |
models.AlreadyCanceledSubscription |
403 |
application/json |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |