Coupons (1.0)
Download OpenAPI specification:Download
Use this API to manage Coupons in NewStore, such as creating, retrieving, or updating coupons and coupon codes.
You can use these methods to create coupons and coupon codes for specific products or for the whole cart, which are applied manually in NewStore Associate App.
For a guide on how to use coupons via NewStore Omnichannel Manager, see this guide. Also you can find additinal information in process documentation
Create Coupon
Creates a specified coupon.
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Request Body schema: application/json
Create coupon request.
name required | string The name of the coupon. |
validFrom required | string(?:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$)|(?:... The date the coupon becomes valid. If localizedTimezone is false, timezone can be indicated at the end of the string. |
validTo | string(?:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$)|(?:... The date the coupon becomes invalid. If localizedTimezone is false, timezone can be indicated at the end of the string. |
required | CartLevelPercentageCategory (object) or CartLevelFixedCategory (object) or ProductLevelPercentageCategory (object) or ProductLevelFixedCategory (object) or BogoPercentageCategory (object) or BogoFixedCategory (object) or FreeShipping (object) The actual promotion kind. |
active | boolean Indicates whether the coupon is active or not. |
required | Array of objects (Currency) A list of conditions on currencies to satisfy in order for the coupon to be applied. |
singleUse | boolean Indicates whether the coupon codes are single use or not. |
localizedTimezone | boolean Optional, this property determines local timezone validity for the coupon. If true, UTC is assumed with no timezone required in "validFrom" and "validTo". If false, timezone must be specified in those fields. |
stores | Array of strings Indicates in which stores the coupon can be used. A list of IDs states that the coupon can be used in the given stores while an empty array states that the coupon can be used in any store. |
consumers | Array of strings <= 10000 items Indicates by which consumers the coupon can be used. A list of IDs states that the coupon can be used by the given consumers while an empty array states that the coupon can be used by any consumers. |
externalId | string Optional, The identifier of the corresponding coupon/voucher on the caller’s system. |
exclusive | boolean Indicates whether the promotion is exclusive or not. |
object or null (Segment) A customer segmentation. |
Responses
Request samples
- Payload
{- "name": "Black Friday Coupon",
- "validFrom": "2023-11-01T00:00:00",
- "validTo": "2023-12-01T00:00:00",
- "category": {
- "kind": "CartLevelPercentage",
- "discount": 10
}, - "active": true,
- "currencies": [
- {
- "code": "EUR",
- "minimumCartValue": 50
}
], - "stores": [
- "f9c7b6ec-b296-4eba-b083-c8b53d14407d"
], - "localizedTimezone": true,
- "singleUse": false,
- "consumers": [
- "2dbb6700-d847-11ed-afa1-0242ac120002",
- "3c8eb0de-d847-11ed-afa1-0242ac120002"
], - "exclusive": true,
- "segment": {
- "key": "type",
- "value": "gold member",
- "schema": 1
}
}
Response samples
- 201
- 400
- 409
- 500
{- "links": {
- "self": "/coupon/64357c41-cad8-4000-8000-d998be563098"
}, - "coupon": {
- "id": "64357c41-cad8-4000-8000-d998be563098",
- "name": "Black Friday Coupon",
- "description": "Black Friday Coupon",
- "validFrom": "2023-11-01T00:00:00",
- "validTo": "2023-12-01T00:00:00",
- "category": {
- "kind": "CartLevelPercentage",
- "discount": 10
}, - "active": true,
- "createdAt": "2023-04-11T00:00:00",
- "createdBy": "25dd570161b05f0cae353a56757f8495",
- "updatedAt": "2023-04-11T00:00:00",
- "updatedBy": "25dd570161b05f0cae353a56757f8495",
- "tenant": "dodici",
- "currencies": [
- {
- "code": "EUR",
- "minimumCartValue": 50
}
], - "stores": [
- "f9c7b6ec-b296-4eba-b083-c8b53d14407d"
], - "localizedTimezone": true,
- "version": "a43a5a2d-1424-4c80-a252-992d489062eb",
- "codes": [ ],
- "singleUse": true,
- "consumers": [
- "2dbb6700-d847-11ed-afa1-0242ac120002",
- "3c8eb0de-d847-11ed-afa1-0242ac120002"
], - "exclusive": true,
- "segment": {
- "key": "type",
- "value": "gold member",
- "schema": 1
}
}
}
List Coupons
Retrieves all coupons.
query Parameters
count required | integer <= 150 The number of coupons to get at once. |
page required | integer >= 1 The page number. |
name | string The names of the coupons you want to get (it can be a list of comma separated values) |
code | string The codes for which you want to get the coupons (it can be a list of comma separated values) |
partial | boolean Deprecated Default: true This flag should be always present with |
kind[] | string Enum: "CartLevelFixed" "CartLevelPercentage" "ProductLevelFixed" "ProductLevelPercentage" "BogoFixed" "BogoPercentage" "FreeShippingFixed" "FreeShippingPercentage" Example: kind[]=CartLevelFixed The type of the coupon you want to get |
active | boolean Example: active=true This flag should be set to true to return |
validFrom | string(?:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$)|(?:... Example: validFrom=2023-09-03T00:00:00 By setting this field, you will only get coupons which are valid from this date onward. |
validTo | string(?:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$)|(?:... Example: validTo=2023-09-11T23:59:59 By setting this field, you will only get coupons which are valid up to this date. |
segment | string Example: segment=member Indicates the Key or Value of customer profile extended attribute. |
partial-category | boolean Default: true Example: partial-category=true This flag should be always present with |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Responses
Response samples
- 200
- 400
- 500
{- "items": [
- {
- "links": {
- "self": "/coupon/64357c41-cad8-4000-8000-d998be563098"
}, - "coupon": {
- "id": "64357c41-cad8-4000-8000-d998be563098",
- "name": "Black Friday Coupon",
- "description": "Black Friday Coupon",
- "validFrom": "2023-11-01T00:00:00",
- "validTo": "2023-12-01T00:00:00",
- "category": {
- "kind": "CartLevelPercentage",
- "discount": 10
}, - "active": true,
- "createdAt": "2023-04-11T00:00:00",
- "createdBy": "25dd570161b05f0cae353a56757f8495",
- "updatedAt": "2023-04-11T00:00:00",
- "updatedBy": "25dd570161b05f0cae353a56757f8495",
- "tenant": "dodici",
- "currencies": [
- {
- "code": "EUR",
- "minimumCartValue": 50
}
], - "stores": [
- "f9c7b6ec-b296-4eba-b083-c8b53d14407d"
], - "singleUse": false,
- "localizedTimezone": true,
- "codes": [ ],
- "exclusive": true,
- "segment": {
- "key": "type",
- "value": "gold member",
- "schema": 1
}, - "version": "a43a5a2d-1424-4c80-a252-992d489062eb"
}
}, - {
- "links": {
- "self": "/coupon/633e9b5e-983b-4000-8000-bdde1340e55f"
}, - "coupon": {
- "id": "633e9b5e-983b-4000-8000-bdde1340e55f",
- "name": "Coupon for hoodies",
- "description": "Coupon for hoodies",
- "validFrom": "2023-04-27T00:00:00",
- "validTo": "2023-04-30T23:59:59",
- "category": {
- "kind": "ProductLevelFixed",
- "includedCategories": [
- {
- "path": [
- "Shop",
- "Accessories"
]
}
], - "includedProducts": [ ],
- "excludedProducts": [ ],
- "shopId": "storefront-catalog-en",
- "locale": "en-us",
- "discounts": [
- {
- "amount": 50,
- "currency": "EUR"
}, - {
- "amount": 50,
- "currency": "USD"
}
]
}, - "active": false,
- "createdAt": "2023-04-27T13:15:55Z",
- "createdBy": "3227aa4cdff85694a7788450e3c269b2",
- "updatedAt": "2022-10-06T09:09:50Z",
- "updatedBy": "3227aa4cdff85694a7788450e3c269b2",
- "tenant": "dodici",
- "currencies": [
- {
- "code": "EUR",
- "minimumCartValue": 150
}, - {
- "code": "USD",
- "minimumCartValue": 150
}
], - "stores": [ ],
- "singleUse": false,
- "localizedTimezone": true,
- "codes": [ ],
- "exclusive": true,
- "segment": {
- "key": "member",
- "value": "VIP",
- "schema": 1
}, - "version": "6255ca9a-a025-4846-826a-f69fd6da4917"
}
}
], - "links": {
- "next": "/coupon?count=2&page=1&partial=true",
- "previous": null
}, - "pagination": {
- "count": 2,
- "page": 1,
- "total": 15
}
}
Get Coupon
Retrieves the specified coupon by ID. To retrieve the coupon ID, use the list coupon API.
path Parameters
id required | string The ID of the coupon. |
query Parameters
partial | boolean Deprecated Default: true This flag should be always present with |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Responses
Response samples
- 200
- 404
- 500
{- "links": {
- "self": "/coupon/64357c41-cad8-4000-8000-d998be563098"
}, - "coupon": {
- "id": "64357c41-cad8-4000-8000-d998be563098",
- "name": "Black Friday Coupon",
- "description": "Black Friday Coupon",
- "validFrom": "2023-11-01T00:00:00",
- "validTo": "2023-12-01T00:00:00",
- "category": {
- "kind": "CartLevelPercentage",
- "discount": 10
}, - "active": true,
- "createdAt": "2023-04-11T00:00:00Z",
- "createdBy": "25dd570161b05f0cae353a56757f8495",
- "updatedAt": "2023-04-11T00:00:00Z",
- "updatedBy": "25dd570161b05f0cae353a56757f8495",
- "tenant": "dodici",
- "currencies": [
- {
- "code": "EUR",
- "minimumCartValue": 50
}
], - "codes": [ ],
- "singleUse": true,
- "localizedTimezone": true,
- "stores": [
- "f9c7b6ec-b296-4eba-b083-c8b53d14407d",
- "b25fd287-90cb-421c-a2b7-27691742f55b"
], - "consumers": [
- "2dbb6700-d847-11ed-afa1-0242ac120002",
- "3c8eb0de-d847-11ed-afa1-0242ac120002"
], - "exclusive": true,
- "segment": {
- "key": "type",
- "value": "gold member",
- "schema": 1
}, - "version": "bf6a0288-d64e-4cb6-b534-a8a6c4724d06"
}
}
Update Coupon
Updates the specified coupon with new information. The only property that cannot be updated is the category.
path Parameters
id required | string The ID of the coupon. |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Request Body schema: application/json
Update coupon request.
name required | string The name of the coupon. |
validFrom required | string(?:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$)|(?:... The date the coupon becomes valid. If localizedTimezone is false, timezone can be indicated at the end of the string. |
validTo | string(?:^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$)|(?:... The date the coupon becomes invalid. If localizedTimezone is false, timezone can be indicated at the end of the string. |
required | CartLevelPercentageCategory (object) or CartLevelFixedCategory (object) or ProductLevelPercentageCategory (object) or ProductLevelFixedCategory (object) or BogoPercentageCategory (object) or BogoFixedCategory (object) or FreeShipping (object) The actual promotion kind. |
active | boolean Indicates whether the coupon is active or not. |
required | Array of objects (Currency) A list of conditions on currencies to satisfy in order for the coupon to be applied. |
singleUse | boolean Indicates whether the coupon codes are single use or not. |
localizedTimezone | boolean Optional, this property determines local timezone validity for the coupon. If true, UTC is assumed with no timezone required in "validFrom" and "validTo". If false, timezone must be specified in those fields. |
stores | Array of strings Indicates in which stores the coupon can be used. A list of IDs states that the coupon can be used in the given stores while an empty array states that the coupon can be used in any store. |
consumers | Array of strings <= 10000 items Indicates by which consumers the coupon can be used. A list of IDs states that the coupon can be used by the given consumers while an empty array states that the coupon can be used by any consumers. |
externalId | string Optional, The identifier of the corresponding coupon/voucher on the caller’s system. |
exclusive | boolean Indicates whether the promotion is exclusive or not. |
object or null (Segment) A customer segmentation. | |
version required | string A UUID representing the version of the coupon. |
Responses
Request samples
- Payload
{- "name": "Black Friday Coupon",
- "validFrom": "2023-11-01T00:00:00",
- "validTo": "2023-12-01T00:00:00",
- "category": {
- "kind": "CartLevelPercentage",
- "discount": 10
}, - "active": true,
- "currencies": [
- {
- "code": "EUR",
- "minimumCartValue": 50
}
], - "stores": [
- "f9c7b6ec-b296-4eba-b083-c8b53d14407d"
], - "localizedTimezone": true,
- "version": "a43a5a2d-1424-4c80-a252-992d489062eb",
- "singleUse": false,
- "consumers": [
- "2dbb6700-d847-11ed-afa1-0242ac120002",
- "3c8eb0de-d847-11ed-afa1-0242ac120002"
], - "exclusive": true,
- "segment": {
- "key": "type",
- "value": "gold member",
- "schema": 1
}
}
Response samples
- 200
- 400
- 404
- 409
- 500
{- "links": {
- "self": "/coupon/64357c41-cad8-4000-8000-d998be563098"
}, - "coupon": {
- "id": "64357c41-cad8-4000-8000-d998be563098",
- "name": "Black Friday Coupon",
- "description": "Black Friday Coupon",
- "validFrom": "2023-11-01T00:00:00",
- "validTo": "2023-12-01T00:00:00",
- "category": {
- "kind": "CartLevelPercentage",
- "discount": 10
}, - "active": true,
- "createdAt": "2023-04-11T00:00:00",
- "createdBy": "25dd570161b05f0cae353a56757f8495",
- "updatedAt": "2023-04-11T00:00:00",
- "updatedBy": "25dd570161b05f0cae353a56757f8495",
- "tenant": "dodici",
- "currencies": [
- {
- "code": "EUR",
- "minimumCartValue": 50
}
], - "stores": [
- "f9c7b6ec-b296-4eba-b083-c8b53d14407d"
], - "localizedTimezone": true,
- "version": "a43a5a2d-1424-4c80-a252-992d489062eb",
- "codes": [ ],
- "singleUse": true,
- "consumers": [
- "2dbb6700-d847-11ed-afa1-0242ac120002",
- "3c8eb0de-d847-11ed-afa1-0242ac120002"
], - "exclusive": true,
- "segment": {
- "key": "type",
- "value": "gold member",
- "schema": 1
}
}
}
Create coupon codes
Use this method to create coupon codes associated to a coupon definition. To retrieve the coupon ID, use the List coupons method.
You don't need the Label
property in the request payload while creating coupons.
path Parameters
id required | string The ID of the coupon. |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Request Body schema: application/json
Create coupon code request.
codes required | Array of strings A list of new coupon codes. |
Responses
Request samples
- Payload
{- "codes": [
- "CODE1",
- "CODE2"
]
}
Response samples
- 201
- 400
- 404
- 409
- 500
{- "links": [
- {
- "self": "/coupon/62839b62-80ff-4000-8000-01b47275b241/code/629868d2-58ac-4000-8000-3766e65e2e3d"
}, - {
- "self": "/coupon/62839b62-80ff-4000-8000-01b47275b241/code/62986960-0b13-4000-8000-1a636b395759"
}
], - "codes": [
- {
- "id": "629868d2-58ac-4000-8000-3766e65e2e3d",
- "name": "CODE1",
- "redemptions": 0,
- "active": true
}, - {
- "id": "629868d2-58ac-4000-8000-3766e65e2e3d",
- "name": "CODE2",
- "redemptions": 0,
- "active": true
}
]
}
Get Coupon Codes
Use this method to retrieve coupon codes.
path Parameters
id required | string The ID of the coupon. |
query Parameters
count required | integer <= 150 The number of coupons to get at once. |
page required | integer >= 1 The page number. |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Responses
Response samples
- 200
- 400
- 500
{- "items": [
- {
- "links": {
- "self": "/coupon/62839b62-80ff-4000-8000-01b47275b241/code/629868d2-58ac-4000-8000-3766e65e2e3d"
}, - "codes": {
- "id": "629868d2-58ac-4000-8000-3766e65e2e3d",
- "name": "CODE1",
- "redemptions": 0,
- "active": true
}
}, - {
- "links": {
- "self": "/coupon/62839b62-80ff-4000-8000-01b47275b241/code/62986960-0b13-4000-8000-1a636b395759"
}, - "codes": {
- "id": "62986960-0b13-4000-8000-1a636b395759",
- "name": "CODE2",
- "redemptions": 0,
- "active": true
}
}
], - "links": {
- "next": "/coupon/62839b62-80ff-4000-8000-01b47275b241/code?count=2&page=2",
- "previous": "null"
}, - "pagination": {
- "count": 2,
- "page": 1,
- "total": 15
}
}
Update Coupon Codes
Use this method to update the specified coupon code, you can switch a coupon code to an active
state or not.
path Parameters
id required | string The ID of the coupon. |
code_id required | string The ID of the coupon code. |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Request Body schema: application/json
id | string |
name | string[a-zA-Z0-9-%_@&!] |
redemptions | number |
active | boolean |
Responses
Request samples
- Payload
{- "id": "629868d2-58ac-4000-8000-3766e65e2e3d",
- "name": "CODE1",
- "redemptions": 0,
- "active": true
}
Response samples
- 400
{- "message": "not found",
- "status": 404
}
Create Coupon Codes Import
Use this method to create coupon codes by importing a CSV file.
Important: if you want to import large quantities of codes, please do not provide one single big file, but split them into multiple files with 50-100k codes, in order not to overload the system.
path Parameters
id required | string The ID of the coupon. |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Request Body schema: multipart/form-data
Create coupon codes import request by importing a CSV file containing coupon codes.
import required | string <binary> [a-zA-Z0-9-%_@&!] CSV file. |
Responses
Response samples
- 202
- 400
- 500
{- "codesImport": {
- "id": "646b39ac-14e7-4000-8000-8fb14bc22cec",
- "status": "CREATED",
- "processed": 1000,
- "created": 700,
- "errors": 300,
- "updatedAt": "2023-05-22 11:27:53.639 +0000 UTC"
}
}
List Coupon Codes Import
Use this method to retrieve a list of coupon codes imports.
path Parameters
id required | string The ID of the coupon. |
query Parameters
count required | integer <= 150 The number of coupons to get at once. |
page required | integer >= 1 The page number. |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Responses
Response samples
- 200
- 400
- 500
{- "items": [
- {
- "links": {
- "self": "/coupon/646b3cb3-14e7-4000-8000-8fb14bc22d03/code/import/646b51b9-14e7-4000-8000-8fb14bc22d15"
}, - "codesImport": {
- "id": "646b51b9-14e7-4000-8000-8fb14bc22d15",
- "status": "CREATED",
- "processed": 1000,
- "created": 700,
- "errors": 300,
- "updatedAt": "2023-05-22 11:27:53.639 +0000 UTC"
}
}, - {
- "links": {
- "self": "/coupon/646b3cb3-14e7-4000-8000-8fb14bc22d03/code/import/646b46b1-14e7-4000-8000-8fb14bc22d0b"
}, - "codesImport": {
- "id": "646b46b1-14e7-4000-8000-8fb14bc22d0b",
- "status": "CREATED",
- "processed": 700,
- "created": 300,
- "errors": 400,
- "updatedAt": "2023-05-23 10:27:53.639 +0000 UTC"
}
}
], - "links": {
- "next": "/coupon/64677e31-14e7-4000-8000-8fb14bc22ce6/code/import?count=2&page=1",
- "previous": "null"
}, - "pagination": {
- "count": 2,
- "page": 1,
- "total": 220
}
}
Get Coupon Codes Import
Use this method to retrieve a specified coupon codes import.
path Parameters
id required | string The ID of the coupon. |
import_id required | string The ID of the imported coupon code. |
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Responses
Response samples
- 200
- 400
- 404
- 500
{- "links": {
- "self": "/coupon/646b3cb3-14e7-4000-8000-8fb14bc22d03/code/import/646b51b9-14e7-4000-8000-8fb14bc22d15"
}, - "codesImport": {
- "id": "646b39ac-14e7-4000-8000-8fb14bc22cec",
- "status": "CREATED",
- "processed": 1000,
- "created": 700,
- "errors": 300,
- "updatedAt": "2023-05-22 11:27:53.639 +0000 UTC"
}
}
Create Coupon Code Redemption
Use this method to redeem a coupon code.
This method is not idempotent and should be called when the coupon was used. If the order for which this coupon was used failes, the coupon is unredeemed automatically at a later stage.
After a successful execution a 200 status is returned.
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Request Body schema: application/json
A coupon code redemption request.
codes required | Array of strings |
consumerId | string |
channelType | string |
catalogTotal | number |
currency | string |
orderId required | string |
Responses
Request samples
- Payload
{- "codes": [
- "SUMMER2022",
- "DRESS10"
], - "consumerId": "consumer-id-123",
- "channelType": "store",
- "catalogTotal": 100,
- "currency": "USD",
- "orderId": "2b89a5e0-1f1f-4374-b6d3-272341193cc7"
}
Response samples
- 400
- 404
- 409
- 500
{- "message": "not found",
- "status": 404
}
Coupon Code Unredemption
Use this method to unredeem a coupon code based on order id.
header Parameters
tenant required | string Example: test-tenant The test tenant name. |
user-id required | string Example: test-userid The test user ID. |
Request Body schema: application/json
A coupon code unredemption request. It is required to use either sales_order_uuid or orderId. If sales_order_uuid is provided, we use that for unredemption, otherwise we use orderId.
orderId | string Deprecated |
sales_order_uuid | string |
Responses
Request samples
- Payload
{- "orderId": "2b89a5e0-1f1f-4374-b6d3-272341193cc7",
- "sales_order_uuid": "bf6a0288-d64e-4cb6-b534-a8a6c4724d06"
}
Response samples
- 200
- 404
- 500
{- "message": "not found",
- "status": 404
}