2. Requesting Offers From Hoox
This page explains the Request Offer API call
What is an Offer
Hoox offer is an object that represent a specific and personalized value proposition granted by a Hoox Partner to your customer (buyer). To get an offer without passing any personal information, you first need to encrypt pieces of data, typically an email address or a phone number using Hoox Encrypt API call
. After a hash (or hashes) was created, you send them in the Hoox Request Offer body.
The response object of this call contains an array with one Offer object.
Im most cases, you will only present the offer banner to the user, so the images.web
key in the response object is the only one that you'll need.
When Should You Send This Call
Just before you want to present the offer to the buyer, assuming you've already called Hoox Encrypt to generate the hashes (typically in the product page / check out page / cart page).
Sent after the buyer's email address or phone number were hashed using Hoox encryptor (library or api call). The response is an array containing one offer to be presented to the buyer. If an offer is not granted, the array would be empty.
Payload to be sent in the offer request body.
The Merchant ID provided by Hoox.
mrC*gnU19683
The branch ID provided by Hoox.
ac@gnU121345
The API Key provided by Hoox.
abc@ut654!
Unique string representing a branch / merchant / website. Used by aggregators. Can also be used to differentiate between different endpoints.
Ab1U82G34hba
The merchant's store name. Will reflect in Hoox reports.
Times Square
The Key Policy key provided by Hoox.
hkp254768901
The merchant's transaction id or cart id.If present, it will be sent back in the response object.
lpid24500312
The total amount of the transaction including tax.
144.4
The total amount of the transaction without tax.
100
The cost of shipping.
20
The total amount of taxes.
20.4
The tax rate in percentage.
17
ISO 4271 representing the curremcy code.
USD
True if the user is registered in the Merchants' website. Default is false.
true
Array of unique hashed emails and phone numbers representing the user - hashed by Hoox encryptor.
["mcBne!T$n&Ya"]
POST /offer HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 358
{
"merchantId": "mrC*gnU19683",
"branchId": "ac@gnU121345",
"apiKey": "abc@ut654!",
"appId": "Ab1U82G34hba",
"storeName": "Times Square",
"keyPolicy": "hkp254768901",
"branchTransactionId": "lpid24500312",
"totalAmount": 144.4,
"transactionAmount": 100,
"shippingAmount": 20,
"taxAmount": 20.4,
"taxRate": 17,
"currencyCode": "USD",
"registeredUser": true,
"userHashes": [
"mcBne!T$n&Ya"
]
}
[
{
"name": "Free Shipping",
"description": "Pay with Mastercard and get free shipping",
"localizedDescriptions": {
"en": "Pay with Mastercard and get free shipping",
"es": "paga con tu Mastercard y obtén envío gratis",
"ro": "Plătește cu Mastercard și beneficiază de transport gratuit"
},
"images": {
"mobile": "www.images.com/mobile",
"web": "www.images.com/web",
"kiosk": "www.images.com/kiosk",
"terminal": "www.images.com/terminal"
},
"currencyCode": "USD",
"value": 20,
"hooxReference": "tgc-ima23-sdd345",
"requestId": "so367i22d",
"branchTransactionId": "lpid24500312",
"hooxType": "discount",
"offerId": "cc212Gre2345",
"campaignId": "cdf156212Gre25"
}
]
In case an offer was returned, you should use the images key to get the image url. This image should be presented to the user.
The response body might contain an empty array. In this case you should proceed normally without Hoox.
Last updated