(products)
List products.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.products.list(organization_id=[
])
while res is not None:
# Handle items
res = res.next()
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 polar:
res = polar.products.create(request={
"name": "<value>",
"prices": [
{
"recurring_interval": polar_sdk.SubscriptionRecurringInterval.MONTH,
"type": "recurring",
"amount_type": "free",
},
],
})
# Handle response
print(res)
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 polar:
res = polar.products.get(id="<value>")
# Handle response
print(res)
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 polar:
res = polar.products.update(id="<value>", product_update={})
# Handle response
print(res)
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 polar:
res = polar.products.update_benefits(id="<value>", product_benefits_update={
"benefits": [
],
})
# Handle response
print(res)
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 |
*/* |