Skip to main content

preview_order

Previews an order before creation: validates the shop / address / items, applies coupons, and returns the final price breakdown along with the preview_id and confirmation_token used to place the order.
Order flow: search_shops → shop_id + cart_id (carries delivery coordinates) → get_shop_menu to pick items → quote_cart to price the cart and get quote_id → select_address to get address_id → preview_order → preview_id + confirmation_token → create_order. A preview must be based on an existing cart_id.

Parameters

coupon_ids three states:
  • Omit the parameter → the gateway auto-selects the best coupon
  • Pass [] (empty array) → explicitly use no coupon
  • Pass ["<coupon_id>", ...] → use the specified coupons (IDs come from a previous preview’s available_coupons[].coupon_id)

Returns

All amount fields are in cents (integer), not yuan. e.g. payable_price: 1500 means ¥15.00.
shop_activities.total_discount / activities[].amount are in yuan (float, e.g. 3.0) — the only exception to this response’s “all amounts in cents” rule. A type=discount activity is normally already reflected in price.payable_price; total_discount is display-only, do not subtract it from the payable amount again.
Example shop_activities shape (a shop with activities):

Error Codes

See Error Handling for the full list.

Example Call