Discount Look-up (Redemptions 2.0)
You can use this API endpoint to:
- Look up a guest's available discount in the loyalty account, per the guest’s user ID.
- Evaluate the guest’s discount basket against the receipt to verify the applicability of discounts if needed.
- Locks the user's discount basket using a unique identifier,
external_uid, generated by your application for the transaction when reward locking is enabled in the Punchh platform for the business. Locking the discount basket prevents other channels from creating simultaneous transactions or modifying the discount basket. See Discount Basket Locking Developer Guide. You must log in to the developer portal to access the developer guide.
The API returns the following:
- Selected discounts in the
selected_discountsarray object, which contains any pre-selected discount items selected using the mobile app and Add Selection to Discount Basket API. If the business is configured for auto-redemption, theselected_discountsobject will contain all available discounts for the user. If no discount items are pre-selected, the API returns an emptyselected_discountsobject. - Unselected discounts in the
unselected_discountsarray object, which contains any discount items that are available in the user account but not yet added to the discount basket - Discount basket in the API response indicating which discounts in the basket are applicable and which do not apply to the check items
- Type: string
Authorization requiredThis is a combination of unique API location key as well as business key (UUID) as the Authorization header.
- Type: string
Content - Type requiredSet this header to application/json.
- Type: string
User - Agent requiredFor details, see User Agent.
- Type: string
Accept requiredAdvertises which content types the client is able to understand
- Type: string
Accept - Language Preferred language. Punchh supports multiple languages for the redeemable name, redeemable description, meta data for coupon, subscription plan name, and subscription description in the API response as per the locale specified in the Accept-Language request header. Possible values: es for Spanish, fr for French, fr-ca for French-Canada, en-CY for English-Cyprus, ro for Romania, es-US for Spanish United States, etc.
The locales for a business are configured in the Punchh platform under Administration > Business Profile > Address > Alternate Languages. In the Punchh platform, the admin of a business has to configure in the relevant language(s) 1) the redeemable name and redeemable description when creating/editing a redeemable under Offers > All Redeemables, 2) meta data for coupons when creating/editing a coupon campaign under Marketing Automation > Campaign Management, and 3) subscription plan name and subscription description when creating/editing a subscription plan under Wallets and Passes > Subscription Plans.
- Type: numberFormat: float
receipt _amount requiredOrder amount before taxes, calculated as the sum of all item amounts minus any discounts. This is the amount used to calculate loyalty points/visits. The value of this parameter should match
subtotal_amount. For example, if the order amount is $10, bothreceipt_amountandsubtotal_amountwill be 10. If a $2 discount is applied, both will be 8. - Type: stringFormat: date-time
receipt _datetime requiredTimestamp of receipt per ISO 8601 format, including TZ offset from UTC (YYYY-MM-DDThh:mm:ss-±hh:mm)
- Type: numberFormat: float
subtotal _amount requiredOrder amount before taxes (sum of all item amounts minus any discounts). Same as
receipt_amount. For historical reasons, include this parameter along withreceipt_amountin the API request. - Type: integer
user _id requiredGuest user ID
- Type: string
business _date Business date
- Type: string
external _uid Unique identifier generated by the system to lock the discount basket and prevent duplicate transactions. This parameter is required when reward locking is enabled for the business in the Punchh platform. Note: Contact your Punchh representative to update this configuration setting.
- Type: array object[] · Line Items (Array Object)
line _items List of line items
- Type: string
punchh _key Punchh key
- Type: string
transaction _no Transaction number
- application/json
- application/json
- application/json
curl https://SERVER_NAME_GOES_HERE.punchh.com/api/pos/discounts/lookup \
--request POST \
--header 'Authorization: Token token=LOCATION_KEY_GOES_HERE, btoken=BUSINESS_KEY_GOES_HERE' \
--header 'Content-Type: application/json' \
--header 'User-Agent: IntegratorName/IntegrationType/VersionNumber' \
--header 'Accept: application/json' \
--data '{
"line_items": [
{
"item_name": "coffee",
"item_qty": 1,
"amount": 10,
"item_type": "M",
"item_id": 330,
"item_family": "10",
"item_group": "gp",
"serial_number": 1
},
{
"item_name": "pizza",
"item_qty": 1,
"amount": 20,
"item_type": "M",
"item_id": 331,
"item_family": "10",
"item_group": "gp",
"serial_number": 2
}
],
"receipt_datetime": "2019-04-11T14:14:07+05:30",
"subtotal_amount": 100,
"receipt_amount": 100,
"business_date": "<store this information>",
"punchh_key": "1111111111111",
"transaction_no": "11111111111",
"user_id": 11111111,
"external_uid": "EXTERNAL_UID_GOES_HERE"
}'
{
"selected_discounts": [
{
"discount_basket_item_id": 2710,
"discount_amount": 1,
"redemption_id": 78244965,
"redemption_type": "Redemption",
"discount_type": "reward",
"discount_id": 773861859,
"discount_value": null,
"message": null,
"qualified": true,
"remaining_balance": null,
"meta_data": null,
"discount_details": {
"item_id": 777658,
"name": "Flat $5 Off (Unlocks at 100 points)",
"campaign_name": "Mass Campaign Offer",
"image": "IMAGE_URL_GOES_HERE",
"points": 100,
"base_amount": 5,
"description": "",
"item_properties": null,
"meta_detail": null,
"start_date_tz": null,
"end_date_tz": null,
"created_at": "2022-09-08T18:41:16Z",
"auto_select": true
},
"qualified_items": []
}
],
"unselected_discounts": [
{
"discount_type": "reward",
"discount_id": 63,
"discount_amount": 2,
"qualified_items": [],
"discount_details": [],
"qualified": true
},
{
"discount_type": "redemption_code",
"discount_id": "<coupon_code>",
"discount_amount": 3,
"qualified_items": [],
"qualified": false
}
]
}