Implementing API for Voucher Redemption.
Implementing our API is pretty simple and straight forward. We use REST API as it provides a great deal of flexibility, scalability and portability.
As a Merchant or Influencer, you first need to locate your ‘Token API Key’ which can be found on the top left corner of your Merchant interface after logging in under the ‘My Account’ section.
The process is straightforward.
After the Player(s) wins the deal, he/she is taken to the URL you (Merchant/Influencer) gave in the Deal-on-Demand URL input field in the
‘Add Promotion’ section.
This could be your main website globally or a special order page that offers discounts or any sort of promotion.
Your specific order page could look like the following image:
On successful authentication and passing the Token API Key, you will receive a response along with the voucher code that when the player applies by pressing the button will entitle him to get the discount and the necessary calculation will be performed on your end thereby allowing him/her to get the new discounted price.
After successful completion of the request, and proceeding to your next Thank You page the voucher will be marked as redeemed in the system by you calling redeem.php.
After that, you can manage every aspect of the voucher from your Merchant Control Panel.
Here's how you implement the request from your end:
Sample Request
curl https://cbvoucher.com/api/v1/discount.php \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"api_token":1
"voucher_code":"16193462361547"
}'
You will get a response like this:
{
"message":"OK",
"code":"200",
"data":{
"offer":"13.00",
"offer_type":"percentage"
}
}
Sample Request
curl https://cbvoucher.com/api/v1/redeem.php \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"api_token":1
"voucher_code":"16193462361547"
}'
You will get response like this
{
"message": "OK",
"code": "200",
"data": [
{
"id": "32",
"userid": "268",
"logo_spotted": "447",
"spotted_time": "21.068",
"campaign_id": "1448",
"promotion_id": "475",
"promotion_code": "16193462361547",
"coupon_redeemed": "no",
"status": "ok",
"expired": "no",
"deleted": "0",
"promotion_added": "2021-03-07",
"promotion_expiry": "2021-05-03",
"date_added": "2021-04-25",
"rank": "1",
"my_feeling": "molesto",
"marketplace_status": "inactive",
"is_deal_on_demand": "yes",
"deal_on_demand_live_id": "13"
}
]
}