class

Polar::Api::CustomerPortal::Subscriptions

Inherits Reference < Object

API client for subscriptions operations in customer_portal context

Constants

Log = ::Log.for(self)

Constructors

new(client : Client)

Creates a new Subscriptions instance

@param client [Client] The Polar API client instance

Source

Instance methods

Cancel Subscription

Cancel a subscription of the authenticated customer.

Scopes: customer_portal:write

Endpoint: DELETE /v1/customer-portal/subscriptions/{id}

Parameters:

  • id (required): The subscription ID.

Returns: Polar::Models::CustomerSubscription

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source

Get Subscription

Get a subscription for the authenticated customer.

Scopes: customer_portal:read customer_portal:write

Endpoint: GET /v1/customer-portal/subscriptions/{id}

Parameters:

  • id (required): The subscription ID.

Returns: Polar::Models::CustomerSubscription

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
list(product_id : String | Nil = nil, active : String | Nil = nil, query : String | Nil = nil, page : Int32 | Nil = nil, limit : Int32 | Nil = nil, sorting : String | Nil = nil) : Polar::Models::ListResource(Polar::Models::CustomerSubscription)

List Subscriptions

List subscriptions of the authenticated customer.

Scopes: customer_portal:read customer_portal:write

Endpoint: GET /v1/customer-portal/subscriptions/

Parameters:

  • product_id (optional): Filter by product ID.
  • active (optional): Filter by active or cancelled subscription.
  • query (optional): Search by product or organization name.
  • 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.

Returns: Polar::Models::ListResource(Polar::Models::CustomerSubscription)

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source

Update Subscription

Update a subscription of the authenticated customer.

Scopes: customer_portal:write

Endpoint: PATCH /v1/customer-portal/subscriptions/{id}

Parameters:

  • id (required): The subscription ID.
  • body (required): Request body as Polar::Models::CustomerSubscriptionUpdate

Returns: Polar::Models::CustomerSubscription

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source