STAGINGOpen PROD

The redemption codes

Last updated ยท Page 11 of 11

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-staging-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.

The order's grouponOrderReference is Groupon's order number (1000-...), the one in Groupon's mail and the shopper's My Groupon: show it on your order page, so the shopper can quote it to Groupon's customer support. supplierReference carries the same number. Cancel an order answers it too.

Keep what an order needs to serve the shopper and to reconcile your sales: bookingId, status, value and dates. Keep a redemption code only while you show it to the shopper, and purchaserId only while you serve that buyer. Beyond that, your agreement with Groupon and your own privacy notice decide how long you keep order data.