Skip to navigation

Replace the discount codes applied to a cart

Sets the complete set of discount codes on the cart — send every code the shopper should have, [] to clear — and returns the updated cart with a verdict per code. Partial success is normal: an unknown code never discards the valid ones sent with it. A real code the cart does not qualify for yet is kept as pending and applies on its own once it does. Automatic promotions are not codes; they appear in cart.discounts with source: AUTOMATIC, cannot be added or removed here, and are ignored if their code is sent. Safe to retry: the request states the desired end state. Does not extend the reservation.

Headers

x-entriastringRequired

Identifies which store this request is for. Required on every store-scoped route. It is not authentication and not a secret — it grants no privileges and is safe to send from a browser. You receive the value once your Entria backend has been created and configured. Missing header returns 400; an unknown store returns 404.

Request

This endpoint expects an object.
cartIdstringRequired
Id of the cart.
codeslist of stringsRequired

Complete desired set of discount codes. Replaces whatever is on the cart; [] clears it.

Response

The updated cart and a verdict for every code in the request.
cartobject
acceptedlist of strings

Shopper-entered codes on the cart after this write that produce a discount (cart.discounts with source: CODE). Automatic promotions are not codes and are never listed here, even if their code was sent.

pendinglist of strings

Real codes on the cart after this write that do not qualify yet. The same list as cart.pendingDiscountCodes; they apply on their own once the cart qualifies.

rejectedlist of objects
Codes from this request that cannot apply in this session. Not kept anywhere.

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
409
Conflict Error
500
Internal Server Error
501
Not Implemented Error