(customer_portal.subscriptions)
- list - List Subscriptions
- get - Get Subscription
- update - Update Subscription
- cancel - Cancel Subscription
List subscriptions of the authenticated customer or user.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customer_portal.subscriptions.list()
while res is not None:
# Handle items
res = res.next()
models.CustomerPortalSubscriptionsListResponse
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Get a subscription for the authenticated customer or user.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customer_portal.subscriptions.get(id="<value>")
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
Customer subscription ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CustomerSubscription
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Update a subscription of the authenticated customer or user.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customer_portal.subscriptions.update(id="<value>", customer_subscription_update={
"product_price_id": "<value>",
})
# Handle response
print(res)
models.CustomerSubscription
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 |
*/* |
Cancel a subscription of the authenticated customer or user.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customer_portal.subscriptions.cancel(id="<value>")
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
Customer subscription ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CustomerSubscription
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 |
*/* |