Discounts
In order to have use of discounts, they has to be configured in the back-office !
Discounts define a maximum percentage of discount for a given range of EAN. Those ranges may target a specific EAN, a publisher, a country…
Set discount
Set a discount to a cart line.
Example
https://wsmedia.tlsecure.com/api/json/00000/cart/discount/1
Request
HTTP Verb : PUT
URL : http://{WS_URL}/{returnType}/{domainCode}/cart/discount/{line}
Parameters | Location | Type | Required | Default | Accepted |
|
---|---|---|---|---|---|---|
token | Header | String(26) | v |
|
|
|
Content-Type | Header | String | v | application/x-www-form-urlencoded |
|
|
line | Path | Integer | v |
|
|
|
discount | Form | Float |
| 1 |
|
|
priceWithDiscount | Form | Float |
|
|
|
|
At least one the fields discount or priceWithDiscount have to be given. If both are, priceWithDiscount will have the priority.
Response
Success
{
"response": {
"success": true
"message": "cart retrieved"
"object": {
"cart": {
"customer": 2
"productsQuantity": 1
"price": 20.25
"totalPrice": 20.25
"creationDate": "2016-02-29 15:18:34"
"lines": {
"line": [1]
0: {
"id": 1
"ean": 9789462500877
"title": "Kip"
"author": "Marcus Bean & Ellen Hosmar"
"price": 20.25
"quantity": 1
"productForm": "BB"
"priceFull":22.5
"discount": 10
}
}
}
}
}
}
Error
{
"response": {
"success": false
"code": 12
"message": "no discount parameters given"
}
}
Codelist
Code | Success | Message |
---|---|---|
0 | v | gift set and cart line updated |
1 |
| domaincode malformed |
2 |
| connexion error |
3 |
| token empty |
4 |
| no token with that key |
5 |
| invalid token |
9 |
| {param} not {type} {(or undefined)} |
10 |
| cart not exist |
11 |
| cartline not exist |
12 |
| no discount parameters given |
13 |
| no postal charges available |
14 |
| discount can not be applied |
99 |
| uncatched exception |