BETA: Please note that the current endpoints are considered beta. It is possible there may be changes before these endpoints are finalised.

You can use LOKE discount endpoint to list discounts for an organization.

Discounts can be allocated to customers via the discount allocation endpoint. To deallocate a discount call DELETE with the same ref.

Discounts

List Discounts

Get discounts for an organization

get /organizations/{organizationId}/discounts

Parameters

NameTypeInDescription
organizationIdstringpathOrganization ID
afterstringqueryThe cursor to use for pagination. Do not use this field manually it will be automatically provided in the response headers (see Paging guide).

Responses

200: OK response.Discount[]
[
  {
    "allocatable": true,
    "createdAt": "2020-01-01T00:00:00Z",
    "description": "20% off on all products",
    "id": "20e543f0-ddcd-4059-aaf3-7b21952c06f9",
    "name": "20% off",
    "updatedAt": "2021-11-01T00:00:00Z"
  },
  {
    "allocatable": true,
    "createdAt": "2020-01-01T00:00:00Z",
    "description": "20% off on all products",
    "id": "20e543f0-ddcd-4059-aaf3-7b21952c06f9",
    "name": "20% off",
    "updatedAt": "2021-11-01T00:00:00Z"
  }
]

Allocate Discount

Allocate a discount to a customer

put /organizations/{organizationId}/customers/{customerId}/discount-allocations/{ref}

Parameters

NameTypeInDescription
organizationIdstringpathOrganization ID
customerIdstringpathThe customer ID you are trying to allocate
refstringpathA unique reference for the discount allocation. Must be globally unique for your client ID

Request Body

DiscountAllocationPayload
{
  "discountId": "01GE3RB02FPVBREBHPSC4MKDC4",
  "expiresAt": "2020-01-01T00:00:00Z"
}

Responses

200: OK response.DiscountAllocation
{
  "createdAt": "2020-01-01T00:00:00Z",
  "discountId": "01GE3RB02FPVBREBHPSC4MKDC4",
  "expiresAt": "2020-01-01T00:00:00Z",
  "id": "20e543f0-ddcd-4059-aaf3-7b21952c06f9",
  "ref": "5d062b90-d326-452a-ac03-7839ea458888"
}
400: max_allocations: Bad Request response.
404: not_found: Not Found response.
409: conflict: Conflict response.

Delete Discount Allocation

Delete a discount allocation for a customer

delete /organizations/{organizationId}/customers/{customerId}/discount-allocations/{ref}

Parameters

NameTypeInDescription
organizationIdstringpathOrganization ID
customerIdstringpathCustomer ID
refstringpathA unique reference

Responses

204: No Content response.
404: not_found: Not Found response.
409: conflict: Conflict response.

Models

Discount

NameTypeDescription
idstringA unique discount ID
namestringA human readable discount name
createdAtstringThe discounts creation date
updatedAtstringThe discounts last updated date
allocatablebooleanIf the discount can be allocated to a customer
descriptionstringA brief description for your discount

DiscountAllocation

NameTypeDescription
idstringThe discount allocation ID
discountIdstringThe discount ID this allocation is referring to
createdAtstringDate and time when the allocation was created
expiresAtstring(optional) Date and time when the allocation expires
refstringA unique reference

DiscountAllocationPayload

NameTypeDescription
discountIdstringThe discount ID this allocation is referring to
expiresAtstring(optional) Date and time when the allocation expires

In this article