placeOrder
Turns a cart into an order, optionally creating a payment over the full order total.
Before calling this, the cart must hold customer data that includes an email address — apply it with
applyCustomerDataToCart and wait until Cart.customerDataIsValid is true. The cart must also
still exist, must not have expired, must not be empty, its ticket types must still be available, and any
ticket holder data required by Cart.ticketHolderForms must be present and valid. If any of that fails, the
mutation resolves an error and no order is created.
The paymentMethodKey argument takes a PaymentMethod.key from Cart.paymentMethods. When it is supplied, a
payment over the full order total is created and attached to the new order. When it is omitted, the order is
placed without any payment and PlaceOrderPayload.redirectUrl resolves to null.
Select PlaceOrderPayload.redirectUrl to open the payment session at the provider and obtain the URL you
must send the customer to. It also resolves to null when the order needs no payment, for example when the
order total is zero; if the provider cannot open the session, the field resolves an error. Persist Order.id
from PlaceOrderPayload.order before redirecting, and follow the payment up with Query.orderStatus; the
order is not paid at the moment this mutation resolves.
mutation PlaceOrder($cartId: ID!, $paymentMethodKey: ID) { placeOrder(input: {cartId: $cartId, paymentMethodKey: $paymentMethodKey}) { order { id } redirectUrl } }mutation PlaceOrder($cartId: ID!, $paymentMethodKey: ID) { placeOrder(input: {cartId: $cartId, paymentMethodKey: $paymentMethodKey}) { order { id } redirectUrl } }
The cart is not deleted by placing the order; its expiration is pushed back so it stays resolvable for a
while, and it is exposed again as OrderStatus.sourceCart.
Arguments
| Argument | Description | Type |
|---|---|---|
| input | PlaceOrderInput! |
Type
This field resolves to PlaceOrderPayload, which has the following fields:
| Field | Description | Type |
|---|---|---|
order | Order | |
redirectUrl | Url |