Polar::Api::Discounts
API client for discounts operations
Constants
Constructors
Creates a new Discounts instance
@param client [Client] The Polar API client instance
Instance methods
Create Discount
Create a discount.
Scopes: discounts:write
Endpoint: POST /v1/discounts/
Parameters:
body(required): Request body as Polar::Models::DiscountCreate
Returns: Polar::Models::Discount
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Delete Discount
Delete a discount.
Scopes: discounts:write
Endpoint: DELETE /v1/discounts/{id}
Parameters:
id(required): The discount ID.
Returns: JSON response string
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Get Discount
Get a discount by ID.
Scopes: discounts:read discounts:write
Endpoint: GET /v1/discounts/{id}
Parameters:
id(required): The discount ID.
Returns: Polar::Models::Discount
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
List Discounts
List discounts.
Scopes: discounts:read discounts:write
Endpoint: GET /v1/discounts/
Parameters:
organization_id(optional): Filter by organization ID.query(optional): Filter by 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::Discount)
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors
Update Discount
Update a discount.
Scopes: discounts:write
Endpoint: PATCH /v1/discounts/{id}
Parameters:
id(required): The discount ID.body(required): Request body as Polar::Models::DiscountUpdate
Returns: Polar::Models::Discount
Raises:
ResourceNotFoundErroron 404NotPermittedErroron 403HTTPValidationErroron 422PolarErroron other errors