Discounts
Was this helpful?
Was this helpful?
Manage Discounts
Cart’s unique identifier generated when a cart is created.
Your Emporix tenant's name.
Note: The tenant should always be written in lowercase.
^[a-z][a-z0-9]+$
Discount codes, listed with commas, specify the discounts slated for deletion. If no codes are provided, all discounts will be removed.
code1,code2
DELETE /cart/{tenant}/carts/{cartId}/discounts HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
No content
Cart’s unique identifier generated when a cart is created.
Your Emporix tenant's name.
Note: The tenant should always be written in lowercase.
^[a-z][a-z0-9]+$
DELETE /cart/{tenant}/carts/{cartId}/discounts/{discountIndex} HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
No content
Cart’s unique identifier generated when a cart is created.
Your Emporix tenant's name.
Note: The tenant should always be written in lowercase.
^[a-z][a-z0-9]+$
GET /cart/{tenant}/carts/{cartId}/discounts HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Accept: */*
[
{
"id": "text",
"yrn": "text",
"couponYrn": "text",
"code": "text",
"amount": 1,
"currency": "text",
"discountRate": 1,
"name": "text",
"calculationType": "ApplyDiscountBeforeTax",
"discountCalculationType": "SUBTOTAL",
"valid": true,
"links": [
{
"rel": "validate",
"title": "text",
"href": "text",
"type": "application/json"
}
],
"discountValidationDetails": {
"message": "text",
"details": [
"text"
]
},
"discountIndex": 1
}
]
Applies a discount on the specified cart. Multiple discount coupons can be applied to cart, but you need to send a separate request for each discount coupon.
cart.cart_manage
Note: This scope is only required for OAuth2 authorization method to authorize the request with the access_token
.
Cart’s unique identifier generated when a cart is created.
Your Emporix tenant's name.
Note: The tenant should always be written in lowercase.
^[a-z][a-z0-9]+$
Discount's unique identifier.
A unique identifier of a global resource, which stores information about the resource, such as its type, ID or name of the tenant.
Discount code generated when a discount coupon is created through the Coupon Service.
Three-letter currency code, compliant with the ISO 4217 standard.
[A-Z]{3}
Discount expressed as fixed amount.
Discount's displayed name.
Discount expressed as a percentage of the price.
Determines whether the coupon is applied to the total or subtotal value of the order.
SUBTOTAL
Possible values: Calculation type specifies how the discount should be calculated. It can be set to one of the following:
ApplyDiscountBeforeTax
ApplyDiscountAfterTax
The field is deprecated and is not used in calculatedPrice fields. The calculated price takes into account site's settings where:
includesTax=true
results in ApplyDiscountAfterTax
includesTax=false
results in ApplyDiscountBeforeTax
ApplyDiscountBeforeTax
Possible values: POST /cart/{tenant}/carts/{cartId}/discounts HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 450
{
"code": "DEVIZU",
"amount": 10,
"currency": "EUR",
"name": "Thanksgiving coupon for all orders",
"calculationType": "ApplyDiscountBeforeTax",
"links": [
{
"title": "THANKSGIVING10",
"rel": "validate",
"type": "application/json",
"href": "https://api.emporix.io/couponcart/{tenant}/coupons/THANKSGIVING10"
},
{
"title": "THANKSGIVING10 redeem",
"rel": "redeem",
"type": "application/json",
"href": "https://api.emporix.io/couponcart/{tenant}/coupons/THANKSGIVING10/redemptions"
}
]
}
{
"yrn": "{discountYrn}",
"discountId": "1",
"discountIndex": 0
}