v4
OpenAPI 3.0.02026-07-31811,0021.1 MBThis method can be used to redeem a reward in behalf of a customer.
There are 2 types of rewards:
- Discount Rewards: Percent (10%) or Value (R$10,00). This rewards are simples as they use pre-configured values
- Cashback: As a value (R$5,00). The used value must be informed in the Value field of the request body
They both can be used with this method. Just be aware that:
- The field Value must have the selected cashback value for the purchase. Use only if the reward is Cashback type
- For other rewards this field can be null
The rewardId field can be obtained by calling the rewards/available endpoint
The customerId field in the body is the same used in the rewards/avaible endpoint.
The OriginalKey field
This field allows you to create idempotency: even if you make the exactly same request twice it will redeem only once. As distributed systems should be fault-tolerant it may result in requests being done more than one time. Not using the OriginalKey may duplicate a redeem request
How to use this field
Inform some string that is unique for this change.
For instance: if you are redeeming the reward Id=OPQ for customerID=ABC regarding the OrderId=123 with Value=10,our key could be OPQ-ABC-123-10
If you dont need this kind of verification you can just use some time-related string, such as 2023-01-01 23:59:00:000
Coupon Generation
It's important to note that unlike the customers/{id}/redeem endpoint this call will not generate a coupon in BonifiQ. That is true even if the reward if configured so.
This is by design as in Point of Sale endpoints it is expected that the caller (PoS) will give the customer the necessary discounts.
The ExternalCode return
One of the most important fields returned by this method is the ExternalCode. This field represents an External identification for this redeem. This exact value must be passed on the Coupon field for the Order Add Method from this API. This will make a link between the redeem and the order.
Important: Remember to pass the ExternalCode value to the Coupon field when adding an order