All guides

The redemption codes

Page 9 of 9

Reading the order never returns a code, so you can poll it as often as you need. When you are about to show the shopper their codes, issue them:

bash
curl -s -X POST "https://api-core.livingsocial.com/partner_storefront/bookings/5d0c2f3a-8b1e-4c7d-a9f0-1e2d3c4b5a69/codes" \
  -H "Authorization: Bearer $GROUPON_API_KEY" -H "Content-Type: application/json" -d '{}'
json
{
  "bookingId": "5d0c2f3a-8b1e-4c7d-a9f0-1e2d3c4b5a69",
  "codes": [
    { "id": "a1b2c3d4-0000-4000-8000-000000000001", "status": "CONFIRMED",
      "redemptionCode": "000000000001", "barcodeFormat": "ean-13", "expiresAt": "2027-03-18T04:59:59Z" },
    { "id": "a1b2c3d4-0000-4000-8000-000000000002", "status": "CONFIRMED",
      "redemptionCode": "000000000002", "barcodeFormat": "ean-13", "expiresAt": "2027-03-18T04:59:59Z" }
  ],
  "withheld": [
    { "id": "a1b2c3d4-0000-4000-8000-000000000003", "reason": "not_issued" }
  ]
}

Each entry of codes is what the shopper shows at the merchant: redemptionCode, with barcodeFormat (how to draw it as a barcode, such as ean-13) and expiresAt. Send {"unitIds": ["<unitItems id>"]} to issue the codes of some purchased units only; without it, every unit of the order is issued. Only your storefront issues the codes of an order placed from its own cart.

Issuing a code marks it as viewed at Groupon, exactly as when the shopper opens it in My Groupons: from then on the shopper cannot get a refund on their own, and Groupon's support decides any refund. So issue the codes when you show them, never to check the order, and tell the shopper before you do. Issuing the same unit again returns the same code and changes nothing more.

A unit in withheld got no code:

reasonWhat to do
not_issuedGroupon has not issued it yet. Issue it again once the order reads CONFIRMED.
third_party_inventoryGroupon shows this code on its own site only. Send the shopper to the unit's myGrouponUrl.
unsupported_regionThe same: send the shopper to the unit's myGrouponUrl.

Whoever holds a code can use it. Keep it as you keep a payment credential: show it to the shopper only, and never put it in a log, a URL or an analytics event.

The order's purchaserId is Groupon's id of the account that paid. Keep it to recognise the same buyer's later orders, or quote it to Groupon's support; it identifies the buyer and gives access to nothing.