Buying through your assistant
Last updated ยท Page 5 of 6
- 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 100, within the option's own limit), 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. Once a checkout is paid, the lines it carried leave the session's cart:get_cartno longer lists them and the nextprepare_checkoutnever bills them again. A line added or changed after that checkout was prepared stays in the cart.
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 | Groupon declined the payment, at its checkout or in its fraud review. Not paid. The page the person comes back to offers to pay again with another payment method on the same checkout; if they do, the status becomes confirmed. |
refunded | Groupon confirmed the order, then refunded it. Its codes no longer work. |
cancelled, expired | Not paid. |
uncertain | LivingSocial could not confirm the outcome. The person should check their Groupon account before buying again. |
A checkout's orderBasket says whether the order Groupon took holds exactly the checkout's lines (as_sent) or more (changed_at_groupon): when the person is signed in at Groupon, Groupon's checkout can add their own Groupon cart, and the amount charged then differs from totalMinor. The status still says how the order ended.
LivingSocial learns the outcome from Groupon's order for the checkout, or when the person comes back from Groupon's page, so a status can lag behind a payment by a few minutes. 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. Two outcomes can still change: LivingSocial keeps reading a confirmed purchase for a refund for 30 days, and a rejected one for a payment made again until 24 hours after the person left for Groupon.