(customers)
List customers.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customers.list()
while res is not None:
# Handle items
res = res.next()
Parameter |
Type |
Required |
Description |
organization_id |
OptionalNullable[models.CustomersListQueryParamOrganizationIDFilter] |
➖ |
Filter by organization ID. |
query |
OptionalNullable[str] |
➖ |
Filter by name or email. |
page |
Optional[int] |
➖ |
Page number, defaults to 1. |
limit |
Optional[int] |
➖ |
Size of a page, defaults to 10. Maximum is 100. |
sorting |
List[models.CustomerSortProperty] |
➖ |
Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CustomersListResponse
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Create a customer.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customers.create(request={
"email": "Loyal79@yahoo.com",
})
# Handle response
print(res)
models.Customer
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Get a customer by ID.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customers.get(id="<value>")
# Handle response
print(res)
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
The customer ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Customer
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Update a customer.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.customers.update(id="<value>", customer_update={})
# Handle response
print(res)
models.Customer
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Delete a customer.
Immediately cancels any active subscriptions and revokes any active benefits.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
polar.customers.delete(id="<value>")
# Use the SDK ...
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
The customer ID. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |