Add to Cart Functionality
This document details the flow of 'Add to cart' functionality under Product rewards.
Overview
Zinrelo now gives you the ability to set up product rewards that can be directly added to the cart from the loyalty dashboard.
This document outlines the configuration in the Zinrelo Admin console and the API calls you will have to make for this integration to work.
The Product Redemption Flow
User discovers the product that can be redeemed against loyalty points in the Zinrelo User Dashboard > My Rewards tab.
- User clicks on the redemption option with the image of the product.
- User is shown information about the product and a confirmation message with Add to cart and Cancel button.
- User clicks on Add to Cart button
- Zinrelo will temporarily deduct points from user’s account and generate a redemption ID.
- Zinrelo will then initiate a Form-POST from the browser with the following data: RedemptionProductID, InventoryProductID, Qty, Note, Redemption ID.
The json object will include below items:
- Redemption ID (required) - Generated by Zinrelo - This will represent unique identifier for each user at a specific time for specific product.
- RedemptionProductID (required) - Represents new product created for redemption
- InventoryProductID (required) - Represents actual product
- Qty (required) - Quantity redeemed
Note - Optional - This field will be used to support any customization we need in future.
You will make a call to Zinrelo to verify the redemption by passing the redemption ID.
Once the redemption is verified, you would know that the POST is genuine and can add the product ($0.00) to the cart and redirect the user to the cart page.
If user removes the product from the cart, you must make a call to Zinrelo with the redemption ID to cancel the redemption. Zinrelo would then deposit the points back to user’s account.
When the user places the order, you will make another call to Zinrelo to verify the redemption. Even if the redemption has been verified earlier, products in the cart will show up for 60 days or more in which time Zinrelo would have already cancelled the redemption after time out. So, another check is necessary just before the order goes through. After the order is placed, you will call Zinrelo’s Confirm API with the redemption ID to confirm the redemption. Zinrelo would then permanently deduct points from user’s account.
The entire process is described with an example in the diagram below.
API Endpoints (Ownership : Zinrelo)
For verifying if the redemption is valid -
URL - https://api.zinrelo.com/v1/loyalty/transactions/
Type - GET
Response- JSON containing the information about the redemption transaction. It will contain the state of the redemption.
Response Codes and Error for above endpoint.
For canceling the redemption –
URL- https://api.zinrelo.com/v1/loyalty/cancel_redeem_transaction
Type- POST
Parameters- transaction_id
Response- JSON containing the updated status of the transaction.
Response Codes and Error for the ‘cancel_redeem_transaction’ endpoint.
For confirming the redemption -
URL- https://api.zinrelo.com/v1/loyalty/confirm_redeem_transaction
Type- PATCH
Parameters– transaction_id_list(list of redemption transactionIDs)
Response– JSON containing the updated status of the transaction
Response Codes and Error for the ‘confirm_redeem_transaction’ endpoint.
The possible values taken by a single dict are explained below:
Important notes for the Confirm Redeem Transaction Endpoint
- If Zinrelo does not receive a confirmation within a certain period of time, the redemption would be automatically cancelled and the points would be deposited back to user’s account.
- If a user removes the item from the cart, you must make a call to Zinrelo to cancel the redemption transaction (#2 above).
Zinrelo Admin Console Modifications
- Select the type of implementation you want from the drop down as shown in the image below:
- When the option -”Direct Add to cart from loyalty dashboard” is selected, there will only be two tabs - Settings and Text configuration. The Manage Codes tab will be hidden since no codes will be involved.
- When the option - ”Direct Add to cart from loyalty dashboard” is selected, two new configuration fields - Wait time and Post Data will appear.
-
You can specify the key-value pairs in the POST Data. E.g RedemptionProductID, InventoryProductID, Qty, Note. Zinrelo will post this data to the Cart URL to add the item directly to cart.
-
In the popup mentioned above, the Cart URL and the wait time after which Zinrelo will automatically cancel the redeem transaction can be specified.
Zinrelo End User Dashboard Modifications
- Zinrelo dashboard will display a list of rewards and image of the product that can be directly added to the cart on the reward tile.
- Clicking on the Redeem button the tile will show a confirmation box. When user clicks on “Add to cart” button, Zinrelo will make a POST request to the Cart URL with the data that was specified during the configuration of this specific reward.
Updated about 1 year ago