Important information on applying rewards to an order
The endpoint to call for applying a promotion to a customer's order is the Reward API /apply
endpoint. Below are some key information you need to know when using this endpoint.
When you make a request to the /apply
, you are essentially asking the system to apply promotions or rewards to a specific order. The response from this API call will include information about the promotions that were successfully applied to the order.
Below are some key concepts to understand:
Applied Promotions
The API response will contain information about all the promotions that have been applied to the order. This includes both automatic promotions that the order qualifies for and any promotions or coupon codes that you specified in your request.
Updating an Order
It is important to note that you should always pass back the array of applied promotions in the Order object with subsequent requests. This enables the system to revalidate the applied promotions against the updated cart or order. In other words, when you send a new request to apply promotions, you should include the list of previously applied promotions so that the system can check if they still qualify based on any changes made to the order.
Initial Request
When you make the first request to this endpoint, the applied promotion array will typically be empty because no promotions have been applied to the order yet. In such cases, the response will only contain information about any automatically applied promotions that the order qualifies for and any promotions applied based on the coupon code or promotion ID you provided in the request.
Removing Applied Promotions
If you need to remove a promotion from an order (for example, when a customer manually removes a promotion from their order), you can simply remove that specific promotion from the appliedPromotions array and then send the updated order with the next request to the apply endpoint. This will effectively remove the promotion from the order.
Cart Changes
It is recommended to call this endpoint as described above whenever the customer's cart is loaded or when changes are made to the order. This ensures that the order continues to meet the rules of each promotion, and any promotions that are no longer valid based on the changes are removed.