We will explore different ways to integrate Ifeelgoods API.
Prerequisites
Before reading this page, make sure you have read the quick start page, especially section 2 (retrieve the list of rewards we are able to deliver) and section 3.1 (retrieve a reward code).
Now that you know the basics, we can dive into the recommended user flows.
The first one, book and redeem
, allows you to reserve a code and then retrieve it.
The second one, book and activate
, allows you to reserve a code but, in the end, you retrieve a link that you can share to the end user. The code is generated when the end user clicks on the link.
Finally, do not hesitate to consult the FAQ which contains at lot of information.
Flow N°1: book and redeem
The book (1) and redeem (2) flow can be done within 2 API calls.
(1) The first call, Book , allows you to create a “redemption” in a temporary booked
state. This call will reserve a code (when possible, depending on the type of supply on the IFG side) for 30 minutes. After 30 minutes, the redemption is canceled (canceled
state).
This call is generally made when validating a basket, when the beneficiary enters the purchase funnel. It gives the beneficiary time to finalize their purchase and prevents the code from being sold to someone else in the meantime.
POST
https://api-sandbox.ifeelgoods.com/fulfillment/v2/promotions/{promotion_id}/rewards/{reward_sku}/redemptions/book
(2) The second call is Redeem . We pass as a parameter the ID of the redemption previously created during the book. This call validates the redemption and allows you to attach the reserved code. The redemption ends in a redeemed
state.
POST
https://api-sandbox.ifeelgoods.com/fulfillment/v2/redemptions/{redemption_id}/actions/redeem
Alternative: It is also possible to use the Create and redeem API on the second call. The only difference is that instead of passing the redemption ID as a parameter, you must pass exactly the same parameters as for the book (promotion_id
, reward_sku
, order_id
, email
, etc.).
Flow N°2: book and activate
The book (1) and activate (2) flow is also done within 2 API calls.
This flow allows you to retrieve an activation link to distribute to the beneficiary. There will therefore be no codes (reward_codes
) in the API response.
The advantage of this flow is to give the beneficiary a right of withdrawal. As long as the link is not clicked, the code is not generated. It is therefore possible to cancel the redemption.
(1) The first call, Book, allows you to create a “redemption” in a temporary booked
state. This call will reserve a code (when possible, depending on the type of supply on the IFG side) for 30 minutes. After 30 minutes, the redemption is canceled (canceled
state).
This call is generally made when validating a basket, when the beneficiary enters the purchase funnel. It gives the beneficiary time to finalize their purchase and prevents the code from being sold to someone else in the meantime.
POST
https://api-sandbox.ifeelgoods.com/fulfillment/v2/promotions/{promotion_id}/rewards/{reward_sku}/redemptions/book
(2) The second call is Activate. We pass as a parameter the ID of the redemption previously created during the book. This call validates the redemption used for the reservation and returns an activation link in the url
key. The redemption ends in a pending
state.
Example link:
https://redemption.ifeelgoods.com/#/IFEEL-GOODS?t=abcde_un_token_d_authentication
When the beneficiary clicks on the link, the code is generated and the redemption ends in redeemed
state. It is then no longer possible to cancel the redemption.
POST
https://api-sandbox.ifeelgoods.com/fulfillment/v2/redemptions/{redemption_id}/actions/activate