Create an order
POST/v1/orders
Credits a paid order: the member earns points, and every redemption in redemption_ids is captured. Send it once payment is captured, not when the order is placed, so a declined card never earns.
Permissions: Secret key with checkout:write.
Guide
Checkout and ordersRequest headers#
Idempotency-KeystringRequiredRequired on this endpoint. Any string up to 255 characters; use a UUID v4. Missing returns400 idempotency_key_required.Max Length 255
Request body#
external_order_idstringRequiredYour order id, up to 128 characters. Unique in your brand forever.Max Length 128member_idstring (uuid)Leave it out for a guest order. It is recorded but earns nothing.location_idstring (uuid)RequiredchannelstringRequiredapporweb.One ofapp,webfulfillmentstringRequiredpickup,delivery,curbsideordine_in.One ofpickup,delivery,curbside,dine_incurrencystringRequiredUSD.subtotal_centsintegerRequiredBefore discounts, tax and tip.Min 0- The cart lines.
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
placed_atstring (date-time)RequiredRFC 3339 time the guest placed the order.discount_centsintegerRequiredAll discounts.0if none.Min 0tax_centsintegerRequiredInteger cents.Min 0tip_centsintegerRequired0if none.Min 0total_centsintegerRequiredWhat the guest paid.Min 0redemption_idsarray of string (uuid)Thereservedredemption this order uses. One at launch.Max Items 1attributionobjectComing soonComing soon.Show attributesHide attributes
link_idstringComing soon The tracked link that brought the guest, from an unPLUG message.
The subtotal after discounts is $12.50 minus $3.50, so $9.00. At 10 Beans per dollar that is 90 Beans. Maya goes from 420 to 510 Beans, and the wallet item is used. member is a snapshot right after the order. It's on this response and in the order.credited webhook, but not when you read the order later. Webhooks order.credited, points.changed and reward.redeemed fire.
Response fields#
Returns 201 with Order
idstring (uuid)unPLUG's id for the order.external_order_idstringNullableYour order id. Unique in your brand, forever.statusstringOne ofcredited,partially_refunded,refundedmember_idstring (uuid)Nullablenullfor a guest order, which earns nothing.location_idstring (uuid)channelstringapporwebfor orders you send. Points earned at the register also show up, as orders within_store. May grow.One ofapp,web,in_storefulfillmentstringNullablepickup,delivery,curbsideordine_in.placed_atstring (date-time)When the guest placed the order. The earn rate and bonuses in force at this time apply.currencystringUSD.subtotal_centsintegerSum of the lines, before discounts, tax and tip.Min 0discount_centsintegerAll discounts on the order, including the unPLUG redemption.Min 0tax_centsintegerRecorded for reports. They never earn.Min 0tip_centsintegerRecorded for reports. They never earn.Min 0total_centsintegerWhat the guest paid: subtotal minus discount, plus tax and tip.Min 0itemsarray of CartItemThe cart lines, same shape as preview.Show attributesCartItem
line_idstringYour id for the line, unique within the cart.pos_item_idstringSquare catalog item variation id.namestringquantityintegerMin 1unit_price_centsintegerInteger cents.Min 0pos_category_idsarray of stringmodifiersarray of objectShow attributesHide attributes
pos_modifier_idstringnamestringprice_centsintegerInteger cents.Min 0
points_earnedintegerPoints from the earn rate, on the subtotal after discounts, rounded down.bonus_pointsintegerExtra points from promotions in force atplaced_at.redemptionsarray of object[{ "id", "status" }]for each redemption the order used.Show attributesHide attributes
idstring (uuid)statusstring
memberobjectNullable{ "points_balance", "tier" }right after the order was credited. Only on the create response and theorder.creditedwebhook.Show attributesHide attributes
points_balanceintegertierTierRefShow attributesTierRef
idstring (uuid)namestring
created_atstring (date-time)When unPLUG recorded the order.
Retries and duplicates#
- Timeout or 5xx. Send the same body with the same
Idempotency-Key. You get the original response, withIdempotent-Replayed: true. - Retry after 24 hours, or with a new key.
external_order_idstill blocks a second credit: you get409 order_already_existswith the existing order's id. Treat it as success. - Expired hold. If a redemption in
redemption_idsis unknown, canceled or expired, the whole request fails with422 redemption_expiredand nothing is written. The guest has already paid the discounted price, so decide your policy: send the order withoutredemption_idsso it still earns, then reconcile the discount.
{
"type": "https://docs.unplugdining.com/reference/errors#order_already_exists",
"title": "Order already exists",
"status": 409,
"code": "order_already_exists",
"detail": "An order with external_order_id app-30417 already exists.",
"param": "external_order_id",
"order_id": "c9e5a3f1-7d2b-4e8c-a0f6-3b1d9e5c7a24",
"request_id": "req_7Hq2kD9xLm"
}Coming soon Guests who order without signing in will be able to claim the order's points later.
Error descriptions#
The Idempotency-Key header is missing.
, 400 invalid_param A required field is missing or has the wrong format. param names it.
, 404 location_not_found An id doesn't exist in your brand.
This external_order_id was already credited.
A request with this key is still running. Retry after a second.
The member was deleted. Send the order without member_id.
A redemption is unknown, canceled or expired. Nothing was written.
redemption_ids has more than one id.
This key was used with a different body.
Any endpoint can also return the common errors.