Skip to content

Place Order ​

Create an order from a cart and complete the checkout process.

Authentication ​

This query supports both authenticated customers and guest users:

  • Authenticated customers: Provide a valid customer authentication token in the Authorization header. Obtain this token via the Customer Login API.
  • Guest users: Provide the Guest Cart Token cartToken obtained from the Create Cart mutation.
Authorization: Bearer <accessToken>

Response ​

FieldTypeDescription
idIDThe cart id the order was placed from (numeric — this is an action result, not a fetchable IRI; use orderId for the created order).
orderIdStringThe created order id — only set on the on-site path. null when a payment redirect is required (the order is created after the gateway confirms).
redirectBooleantrue when the payment method needs the shopper sent to a payment page before the order exists.
redirectUrlStringThe payment page to open when redirect is true; null otherwise.
successBooleantrue when the call succeeded — either the order was placed or a redirect is required. Order-placement failures are returned in errors[], not here.
messageStringHuman-readable result — "order placed", or an explanation that the shopper must be redirected to complete payment.

Two outcomes ​

This mutation has two success shapes — branch on redirect:

  • redirect: false (cash-on-delivery, money-transfer) — the order exists; read orderId.
  • redirect: true (stripe, payu, phonepe, razorpay, paypal) — no order yet. orderId is null; send the shopper to redirectUrl to pay. The order is created when the gateway returns to your success URL. message explains this so a client that only checks the payload knows why there is no order id.

On a genuine failure (empty cart, missing address/shipping/payment, suspended account, minimum-order not met) the mutation returns errors[] with the exact reason and checkoutOrder is null.

Before the order can be placed ​

Every step of the checkout must be complete. The mutation fails with errors[] and a null payload when any of them is outstanding:

RequirementSatisfied by
The cart holds at least one itemAdd to Cart
A billing address is setSet Checkout Address
A shipping address is set, for a cart with shippable itemsSet Checkout Address
A shipping method is selectedSet Shipping Method
A payment method is selectedSet Payment Method

Stock is re-checked at this point as well, so an item that sold out while the shopper was in checkout fails the call even though every step was completed.

A coupon is not a prerequisite. An invalid or expired one blocks the order, but placing an order without any coupon is the normal case.

Order status after placing ​

A newly placed order is pending, or pending_payment while a redirect gateway completes. It then moves through the store's own workflow:

StatusMeaning
pendingOrder created and awaiting processing.
pending_paymentAwaiting payment confirmation from the gateway.
processingPayment confirmed and the order is being prepared.
completedFully invoiced and shipped.
canceledCanceled before fulfilment.
closedClosed after a refund.
fraudFlagged by the store as fraudulent.

What happens on success ​

  • The cart is emptied and its token stops resolving.
  • The order confirmation email is sent to the shopper.
  • Stock is decremented for every ordered item.
  • The shopper can track the order through Get Customer Orders.

On a redirect payment none of this happens yet — the cart survives until the gateway returns and the order is actually created.

Released under the MIT License.