Polar::Api::Subscriptions
API client for subscriptions operations
Constants
Constructors
Creates a new Subscriptions instance
@param client [Client] The Polar API client instance
Instance methods
Create Subscription
Create a subscription programmatically.
This endpoint only allows to create subscription on free products. For paid products, use the checkout flow.
No initial order will be created and no confirmation email will be sent.
Scopes: subscriptions:write
Endpoint: POST /v1/subscriptions/
Parameters:
body(required): Request body as Polar::Models::SubscriptionCreateCustomer
Returns: Polar::Models::Subscription
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Export Subscriptions
Export subscriptions as a CSV file.
Scopes: subscriptions:read subscriptions:write
Endpoint: GET /v1/subscriptions/export
Parameters:
organization_id(optional): Filter by organization ID.
Returns: JSON response string
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Get Subscription
Get a subscription by ID.
Scopes: subscriptions:read subscriptions:write
Endpoint: GET /v1/subscriptions/{id}
Parameters:
id(required): The subscription ID.
Returns: Polar::Models::Subscription
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
List Subscriptions
List subscriptions.
Scopes: subscriptions:read subscriptions:write
Endpoint: GET /v1/subscriptions/
Parameters:
organization_id(optional): Filter by organization ID.product_id(optional): Filter by product ID.customer_id(optional): Filter by customer ID.external_customer_id(optional): Filter by customer external ID.discount_id(optional): Filter by discount ID.active(optional): Filter by active or inactive subscription.page(optional): Page number, defaults to 1.limit(optional): Size of a page, defaults to 10. Maximum is 100.sorting(optional): 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.metadata(optional): Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.
Returns: Polar::Models::ListResource(Polar::Models::Subscription)
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Revoke Subscription
Revoke a subscription, i.e cancel immediately.
Scopes: subscriptions:write
Endpoint: DELETE /v1/subscriptions/{id}
Parameters:
id(required): The subscription ID.
Returns: Polar::Models::Subscription
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Update Subscription
Update a subscription.
Scopes: subscriptions:write
Endpoint: PATCH /v1/subscriptions/{id}
Parameters:
id(required): The subscription ID.body(required): Request body as Polar::Models::SubscriptionUpdate
Returns: Polar::Models::Subscription
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors