Preview a checkout
POST/v1/checkouts/preview
Tells you what the member could use on this cart and why everything else doesn't apply. It has no side effects: nothing is held or spent, so call it whenever the cart changes. Show only the applicable entries as tappable.
Permissions: Secret key with checkout:write, or a member token for its own member.
Guide
Checkout and ordersRequest headers#
Idempotency-KeystringAny string up to 255 characters; use a UUID v4. Kept 24 hours per key (or member) and endpoint. Same key and body replays the first response withIdempotent-Replayed: true.Max Length 255
Request body#
The cart, plus:
member_idstring (uuid)The member. Leave it out for a guest checkout with a code. With a member token it is always the token's member.location_idstring (uuid)RequiredFrom GET /v1/locations.channelstringRequiredapporweb.One ofapp,webfulfillmentstringRequiredpickup,delivery,curbsideordine_in. May grow.One ofpickup,delivery,curbside,dine_incurrencystringRequiredUSD.subtotal_centsintegerRequiredThe sum of every line (unit price plus modifiers, times quantity), before discounts, tax and tip.Min 0- The cart lines. See below.
Show attributesCartItem
line_idstringRequiredYour id for the line, unique within the cart.pos_item_idstringSquare catalog item variation id.namestringRequiredquantityintegerRequiredMin 1unit_price_centsintegerRequiredInteger cents.Min 0pos_category_idsarray of stringmodifiersarray of objectShow attributesHide attributes
pos_modifier_idstringnamestringprice_centsintegerInteger cents.Min 0
codesarray of stringPromo codes the guest typed, shared or unique.reward_idsarray of string (uuid)Catalog rewards to check. Empty checks every catalog reward.wallet_item_idsarray of string (uuid)Wallet items to check. Empty checks every available item in the member's wallet.
Response fields#
Returns 200 with Preview
member_idstring (uuid)Nullablenullfor a guest checkout.points_balanceintegerNullableThe member's balance now.points_to_earnintegerPoints this cart earns as sent, before any discount. Here $12.50 at 10 Beans per dollar. If Maya uses the pastry, the order earns on $9.00 instead: 90 Beans.applicablearray of PreviewEntryEverything the member can use on this cart: catalog rewards they can afford, wallet items, valid codes.Show attributesPreviewEntry
typestringAlso onnot_applicableentries:reward(withreward_idandpoints_cost),wallet_item(withwallet_item_id) orcode(withcode). Send that id or code to POST /v1/redemptions. May grow.One ofreward,wallet_item,codereward_idstring (uuid)wallet_item_idstring (uuid)codestringnamestringLabel to show. Also onnot_applicableentries.points_costintegerForreward.discount_centsintegerThe discount on this cart. Show this amount; don't recalculate it.affected_line_idsarray of stringCart lines the discount applies to. Empty for a discount on the whole subtotal.reasonReasonCodeShow valuesHide values
below_minimum_subtotalwrong_channelwrong_locationwrong_fulfillmentoutside_available_timesitem_not_in_carttier_requirednot_enough_pointsper_member_limit_reachedbudget_exhaustednot_startedexpiredalready_used
messagestringNot-applicable entries only. Safe to show guests.
not_applicablearray of PreviewEntryCatalog rewards, wallet items and codes that don't apply, each with areasonfrom the reason codes and amessageyou can show the guest as is.Show attributesPreviewEntry
typestringOne ofreward,wallet_item,codereward_idstring (uuid)wallet_item_idstring (uuid)codestringnamestringpoints_costintegerForreward.discount_centsintegerApplicable entries only.affected_line_idsarray of stringApplicable entries only.reasonReasonCodeShow valuesHide values
below_minimum_subtotalwrong_channelwrong_locationwrong_fulfillmentoutside_available_timesitem_not_in_carttier_requirednot_enough_pointsper_member_limit_reachedbudget_exhaustednot_startedexpiredalready_used
messagestringNot-applicable entries only. Safe to show guests.
challenge_progressarray of objectComing soon How this order would move the member's challenges. Always empty at launch.
Error descriptions#
A required cart field is missing. param names it.
A field has the wrong format, for example an unknown fulfillment.
No member with this id.
No location with this id in your brand.
The member was deleted.
Free drip coffee costs 500 Beans and Maya has 420, so it is in not_applicable. An unknown or expired code is not an error here either: it comes back in not_applicable, so you can show the message next to the code field.
Any endpoint can also return the common errors.