Learn how to preview & validate rewards redemptions
PUT redeem/preview
endpoint to preview
or validate rewards redemptions.PUT
request to the redeem/preview
endpoint.
The endpoint will send back the exact order you originally sent, but with an additional keyword redemptions_result at each level where a redeem
array was found.
The endpoint doesn’t want to force you how to present the data to the customer, it just provide the data you need to build whatever experience you want to show.
redemptions_result
object was to the product that redeemed 6 points.value
, how much was discounted discount_value
, the percentage of the discount discount_percent
. This values can be used to show the customer how much they are saving.action
field that tells you what to do with the affected entity:
UPDATE
: The entity was updated, display these values instead.READ
: The entity has been updated before, but the last redeem didn’t change anything.DELETE
: Then entity was removed, don’t display this item in the order.CREATE
: The entity is new and must be display along the other products in the order.redeemed
array contains the rewards that were redeemed. This array will contain the rewards that were redeemed and the action that was taken.error
was added to the redeemed object. This error can either be shown to the customer or used to debug your implementation.
order.redemptions_result.value
to compare if what you are going to charge the customer matches.
If the order values don’t match, the order may have been tampered with. You should not emit the event.