class

Polar::Api::Orders

Inherits Reference < Object

API client for orders operations

Constants

Log = ::Log.for(self)

Constructors

new(client : Client)

Creates a new Orders instance

@param client [Client] The Polar API client instance

Source

Instance methods

export(organization_id : String | Nil = nil, product_id : String | Nil = nil)

Export Subscriptions

Export orders as a CSV file.

Scopes: orders:read

Endpoint: GET /v1/orders/export

Parameters:

  • organization_id (optional): Filter by organization ID.
  • product_id (optional): Filter by product ID.

Returns: JSON response string

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
generate_invoice(id : String)

Generate Order Invoice

Trigger generation of an order's invoice.

Scopes: orders:read

Endpoint: POST /v1/orders/{id}/invoice

Parameters:

  • id (required): The order ID.

Returns: JSON response string

Raises:

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

Get Order

Get an order by ID.

Scopes: orders:read

Endpoint: GET /v1/orders/{id}

Parameters:

  • id (required): The order ID.

Returns: Polar::Models::Order

Raises:

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

Get Order Invoice

Get an order's invoice data.

Scopes: orders:read

Endpoint: GET /v1/orders/{id}/invoice

Parameters:

  • id (required): The order ID.

Returns: Polar::Models::OrderInvoice

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
list(organization_id : String | Nil = nil, product_id : String | Nil = nil, product_billing_type : String | Nil = nil, discount_id : String | Nil = nil, customer_id : String | Nil = nil, checkout_id : String | Nil = nil, page : Int32 | Nil = nil, limit : Int32 | Nil = nil, sorting : String | Nil = nil, metadata : String | Nil = nil) : Polar::Models::ListResource(Polar::Models::Order)

List Orders

List orders.

Scopes: orders:read

Endpoint: GET /v1/orders/

Parameters:

  • organization_id (optional): Filter by organization ID.
  • product_id (optional): Filter by product ID.
  • product_billing_type (optional): Filter by product billing type. recurring will filter data corresponding to subscriptions creations or renewals. one_time will filter data corresponding to one-time purchases.
  • discount_id (optional): Filter by discount ID.
  • customer_id (optional): Filter by customer ID.
  • checkout_id (optional): Filter by checkout ID.
  • 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::Order)

Raises:

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

Update Order

Update an order.

Scopes: orders:write

Endpoint: PATCH /v1/orders/{id}

Parameters:

  • id (required): The order ID.
  • body (required): Request body as Polar::Models::OrderUpdate

Returns: Polar::Models::Order

Raises:

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