(products)
List products.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.products.list(organization_id=[
"<value>",
])
if res is not None:
while True:
# handle items
res = res.next()
if res is None:
break
Parameter |
Type |
Required |
Description |
organization_id |
OptionalNullable[models.ProductsListQueryParamOrganizationIDFilter] |
➖ |
Filter by organization ID. |
query |
OptionalNullable[str] |
➖ |
Filter by product name. |
is_archived |
OptionalNullable[bool] |
➖ |
Filter on archived products. |
is_recurring |
OptionalNullable[bool] |
➖ |
Filter on recurring products. If true , only subscriptions tiers are returned. If false , only one-time purchase products are returned. |
benefit_id |
OptionalNullable[models.QueryParamBenefitIDFilter] |
➖ |
Filter products granting specific benefit. |
page |
Optional[int] |
➖ |
Page number, defaults to 1. |
limit |
Optional[int] |
➖ |
Size of a page, defaults to 10. Maximum is 100. |
sorting |
List[models.ProductSortProperty] |
➖ |
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.ProductsListResponse
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Create a product.
import polar_sdk
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.products.create(request={
"name": "<value>",
"prices": [
{
"recurring_interval": polar_sdk.SubscriptionRecurringInterval.MONTH,
"type": polar_sdk.ProductPriceRecurringFreeCreateType.RECURRING,
"amount_type": polar_sdk.ProductPriceRecurringFreeCreateAmountType.FREE,
},
],
})
if res is not None:
# handle response
pass
models.Product
Error Type |
Status Code |
Content Type |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Get a product by ID.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.products.get(id="<value>")
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Product
Error Type |
Status Code |
Content Type |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Update a product.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.products.update(id="<value>", product_update={})
if res is not None:
# handle response
pass
models.Product
Error Type |
Status Code |
Content Type |
models.NotPermitted |
403 |
application/json |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |
Update benefits granted by a product.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.products.update_benefits(id="<value>", product_benefits_update={
"benefits": [
"<value>",
],
})
if res is not None:
# handle response
pass
models.Product
Error Type |
Status Code |
Content Type |
models.NotPermitted |
403 |
application/json |
models.ResourceNotFound |
404 |
application/json |
models.HTTPValidationError |
422 |
application/json |
models.SDKError |
4XX, 5XX |
*/* |