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
afterstringquery

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
idstring A unique discount ID
namestring A human readable discount name
createdAtstring The discounts creation date
updatedAtstring The discounts last updated date
allocatableboolean If the discount can be allocated to a customer
descriptionstring A brief description for your discount

DiscountAllocation

NameTypeDescription
idstring The discount allocation ID
discountIdstring The discount ID this allocation is referring to
createdAtstring Date and time when the allocation was created
expiresAtstring(optional) Date and time when the allocation expires
refstring A unique reference

DiscountAllocationPayload

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

In this article