curl --request POST \
--url https://api.nuwebgroup.com/v1/discount-codes/fixed \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "FIXED10",
"amount": 1000,
"maxUsesPerOrder": 2,
"currencyId": 1,
"maxUsesPerCustomer": 1,
"minimumSpend": 1000,
"saleItems": [
1,
2
],
"maximumUses": 100,
"validFrom": "2021-01-01",
"validTo": "2021-02-01"
}
'{
"data": {
"type": "discountCodes",
"id": 1,
"attributes": {
"type": "fixed",
"code": "FIXED10",
"amount": 1000,
"applyToNetPrice": false,
"maxUsesPerOrder": 2,
"maximumUses": 100,
"maxUsesPerCustomer": 2,
"minimumSpend": 1000,
"validFrom": "2021-11-22T00:00:00.000000Z",
"validTo": "2021-11-25T00:00:00.000000Z",
"boxOfficeOnly": false,
"disabledAt": null,
"createdAt": "2021-11-22T00:00:00.000000Z",
"updatedAt": "2021-11-22T00:00:00.000000Z"
},
"relationships": {
"currencies": {
"data": {
"type": "currencies",
"id": 1
}
},
"saleItems": {
"data": [
{
"type": "saleItems",
"id": 1
},
{
"type": "saleItems",
"id": 2
}
]
}
},
"links": {
"self": "http://api.willms.com/v1/discount-codes?id=1"
}
},
"included": [
{
"type": "currencies",
"id": 1,
"attributes": {
"name": "Pounds",
"code": "GBP",
"symbol": "£",
"subunit": 2,
"isCashless": false,
"isCustom": false,
"isPrimary": true
}
}
]
}Create a new fixed discount code.
curl --request POST \
--url https://api.nuwebgroup.com/v1/discount-codes/fixed \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "FIXED10",
"amount": 1000,
"maxUsesPerOrder": 2,
"currencyId": 1,
"maxUsesPerCustomer": 1,
"minimumSpend": 1000,
"saleItems": [
1,
2
],
"maximumUses": 100,
"validFrom": "2021-01-01",
"validTo": "2021-02-01"
}
'{
"data": {
"type": "discountCodes",
"id": 1,
"attributes": {
"type": "fixed",
"code": "FIXED10",
"amount": 1000,
"applyToNetPrice": false,
"maxUsesPerOrder": 2,
"maximumUses": 100,
"maxUsesPerCustomer": 2,
"minimumSpend": 1000,
"validFrom": "2021-11-22T00:00:00.000000Z",
"validTo": "2021-11-25T00:00:00.000000Z",
"boxOfficeOnly": false,
"disabledAt": null,
"createdAt": "2021-11-22T00:00:00.000000Z",
"updatedAt": "2021-11-22T00:00:00.000000Z"
},
"relationships": {
"currencies": {
"data": {
"type": "currencies",
"id": 1
}
},
"saleItems": {
"data": [
{
"type": "saleItems",
"id": 1
},
{
"type": "saleItems",
"id": 2
}
]
}
},
"links": {
"self": "http://api.willms.com/v1/discount-codes?id=1"
}
},
"included": [
{
"type": "currencies",
"id": 1,
"attributes": {
"name": "Pounds",
"code": "GBP",
"symbol": "£",
"subunit": 2,
"isCashless": false,
"isCustom": false,
"isPrimary": true
}
}
]
}The 'Bearer' token can be obtained from the token management interface or via the login endpoint using your admin user credentials.
Request body for creating a fixed discount code.
The amount of the discount. For fixed discounts, this is the amount in the currency's minor unit, e.g., 200 = £2.00.
An array of sale item ID's.