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
Name | Type | In | Description |
---|---|---|---|
organizationId | string | path | Organization ID |
after | string | query | The 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"
},
{
"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
Name | Type | In | Description |
---|---|---|---|
organizationId | string | path | Organization ID |
customerId | string | path | The customer ID you are trying to allocate |
ref | string | path | A 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
Name | Type | In | Description |
---|---|---|---|
organizationId | string | path | Organization ID |
customerId | string | path | Customer ID |
ref | string | path | A unique reference |
Responses
204: No Content response.
404: not_found: Not Found response.
409: conflict: Conflict response.
Models
Discount
Name | Type | Description |
---|---|---|
id | string | A unique discount ID |
name | string | A human readable discount name |
createdAt | string | The discounts creation date |
updatedAt | string | The discounts last updated date |
allocatable | boolean | If the discount can be allocated to a customer |
description | string | A brief description for your discount |
DiscountAllocation
Name | Type | Description |
---|---|---|
id | string | The discount allocation ID |
discountId | string | The discount ID this allocation is referring to |
createdAt | string | Date and time when the allocation was created |
expiresAt | string | (optional) Date and time when the allocation expires |
ref | string | A unique reference |
DiscountAllocationPayload
Name | Type | Description |
---|---|---|
discountId | string | The discount ID this allocation is referring to |
expiresAt | string | (optional) Date and time when the allocation expires |