Buying through your assistant
Page 6 of 9
- The assistant searches and reads offers with
search_offersandget_offer. - The person picks an option and a quantity and agrees to the price
get_offershowed. - The assistant calls
prepare_checkoutwithofferIdandoptionId(both ids come fromget_offer),quantity(1 to 50), anoperationKeyandconfirmSelection: true. It setsconfirmSelectiontotrueonly after the person has confirmed the choice. Anything else is refused.operationKeyis 8 to 128 characters (letters, digits,_,.,:and-) that the assistant makes up once for this purchase decision. If it has to retry the same decision it sends the same key, and the server answers the same checkout instead of making a second one. A different selection needs a new key.
- The answer's
handoffUrlopens a LivingSocial page where the person reviews the order and continues to Groupon's own checkout, where they pay. The link is private to that person, works once and expires after 15 minutes (handoffExpiresAtsays when). It isnullonce the person has opened Groupon's page for that checkout. To get a fresh link before then, the assistant callsprepare_checkoutagain with the sameoperationKey. - The assistant calls
get_purchase_statusto learn how the purchase ended. Only the statusconfirmedmeans it is paid.
otherOpenCheckouts in the prepare_checkout answer lists other purchases of the same session that the person may still be paying for. A session can hold up to three open checkouts.
A checkout's status is one of:
| Status | Meaning |
|---|---|
created | Prepared. The person has not opened the link yet. |
handed_off | The person opened Groupon's page. |
pending | Groupon has not reported an outcome yet. |
confirmed | Paid. This is the only paid status. |
rejected, cancelled, expired | Not paid. |
uncertain | LivingSocial could not confirm the outcome. The person should check their Groupon account before buying again. |
LivingSocial learns the outcome only when the person comes back from Groupon's page, so a status can lag behind a payment. uncertain appears only after 24 hours without an outcome. Before that, a checkout the person has left for Groupon shows as handed_off or pending.