Auto Redemption (Redemptions 2.0)

  • A discount should be automatically queued up in the discount basket if the auto-redemption feature is enabled for the business.
  • The business can configure the auto-redemption strategy.
  • If a discount expires after being added to the discount basket, it is removed from the discount basket. When you make a call to the API, it validates the discounts added to the discount basket. If one or more discounts are found to be honored, expired, perished, or archived, the API returns an error message indicating that these discounts cannot be honored. The API lists the invalid discounts in the discount_basket_items object with a message stating that the discount is invalid and returns a null value in the discount_details object.

Note: Auto-redemption currently supports only subscriptions and non-points-based rewards.

Headers
  • Accept
    Type: string
    required

    Advertises which content types the client is able to understand

  • Authorization
    Type: string
    required

    You may pass the access_token instead of the authentication_token in Online Ordering endpoints to authorize the request. It must be supplied as Bearer ACCESS_TOKEN_GOES_HERE.

  • Content-Type
    Type: string
    required

    Set this header to application/json.

  • User-Agent
    Type: string
    required

    For details, see User Agent.

  • x-pch-digest
    Type: string
    required

    The signature for the API call

  • Accept-Language
    Type: string

    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 Campaign Management, and 3) subscription plan name and subscription description when creating/editing a subscription plan under Wallet and Passes > Subscription Plans.

Body
application/json
  • client
    Type: string
    required

    Client key of the business

  • receipt_amount
    Type: numberFormat: float
    required

    Order 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, both receipt_amount and subtotal_amount will be 10. If a $2 discount is applied, both will be 8.

  • receipt_datetime
    Type: stringFormat: date-time
    required

    Timestamp of receipt per ISO 8601 format, including TZ offset from UTC (YYYY-MM-DDThh:mm:ss-±hh:mm)

  • subtotal_amount
    Type: numberFormat: float
    required

    Order amount before taxes (sum of all item amounts minus any discounts). Same as receipt_amount. For historical reasons, include this parameter along with receipt_amount in the API request.

  • business_date
    Type: string

    Business date

  • external_uid
    Type: string

    Unique identifier generated by the system to lock the discount basket and prevent duplicate transactions. This parameter is optional when reward locking is enabled for the business in the Punchh platform. Note: Contact your Punchh representative to update this configuration.

  • line_items
    Type: array object[] ·

    List of line items

  • transaction_no
    Type: string

    Transaction number

Responses
  • application/json
  • application/json
  • application/json
  • application/json
Request Example for post/api/auth/discounts/auto_select
curl https://SERVER_NAME_GOES_HERE.punchh.com/api/auth/discounts/auto_select \
  --request POST \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer ACCESS_TOKEN_GOES_HERE' \
  --header 'Content-Type: application/json' \
  --header 'User-Agent: Punchh/OnlineOrder/1.0/Web/BrowserVersion/OS_Type' \
  --header 'x-pch-digest: SIGNATURE_GOES_HERE' \
  --header 'Accept-Language: en' \
  --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>",
  "transaction_no": "11111111111",
  "client": "CLIENT_GOES_HERE",
  "external_uid": "EXTERNAL_UID_GOES_HERE"
}'
{
  "redemption_ref": "REDEMPTION_REF_GOES_HERE",
  "locked": true,
  "created_at": null,
  "discount_basket_items": [
    {
      "discount_basket_item_id": 4699,
      "discount_type": "reward",
      "discount_id": "33703164",
      "discount_value": null,
      "created_at": "2022-08-25T10:03:48Z",
      "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
      }
    }
  ]
}