Order from a store
Buy a product from an online store: say which item, how many, which choices, where to ship it and the most it may cost. Rehearse to the payment step first, then place the order.
What an order does
An order is a booking that buys goods. You make it with POST /v3/bookings, like any other booking. Ophelia opens the item's page, makes your choices, adds it to the bag and walks the store's checkout.
entity_id. A product has no availability to read: go straight to the booking.authorize.max_commitment: "begin". Ophelia stops at the payment step with no card typed and answers the store's total.commit (the default) with a way to pay. Ophelia checks the total against your ceiling and presses the order button.begin first.The request
entity_idbooking_url as url.quantityselections{"size": "M", "color": "Olive"}. At most 8, each name and value up to 80 characters. Names are lower-cased. Ophelia makes each choice on the page before it adds the item.customername, email and phone.customer.addressstreet, line2, city, state, zip_code, country. The billing address goes in the card (Pay).authorize.fill_identitytrue lets Ophelia type the email and phone. Without it they are not typed.authorize.max_total128 means $128.00. Above 0. Required at commit.authorize.currencymax_total is in, such as USD. A total in another currency is refused.authorize.max_commitment"begin" to rehearse. Absent means commit.idempotency_keyThe ceiling rule: an order at commit needs authorize.max_total and authorize.currency. On a shopping site, or a site whose kind is not known, a booking counts as an order when it names a quantity or selections or carries a way to pay. A booking on a site that may charge a fee needs the ceiling too. Without it you get 422 max_total_required and nothing is attempted. Paying with the person's account (account_on_file) needs the ceiling on any kind of booking, and without it the request is refused with 400 naming the field.
Rehearse: the quote
At begin, Ophelia adds the item, walks the checkout to the payment step and stops. No card is typed. The answer is succeeded with no confirmation_number, and it carries the store's total in booking.purchase.quote.
totaltotal_amountcurrencylinesname, quantity, unit_price, line_totalbreakdownsubtotal, shipping, tax and total, where the store showed themfinalfalse when the store's words say the total is not final yetShow the person the total and the lines before you place the order. Set max_total to the amount they agreed to.
Place the order
Send the same request at commit: leave out max_commitment, add a way to pay (Pay) and use a new idempotency_key. Before the order button, Ophelia checks that the bag holds exactly the item and quantity you asked for, and that the total is in your currency and within max_total. If any check fails, the button is not pressed.
confirmation_numberconfirmation.order_numberconfirmation.totalconfirmation.total_amountconfirmation.currencyconfirmation.itemsname, price, quantityamount_centscurrencyAn order's confirmation uses the keys above for what the receipt showed. Any of them may be absent when the receipt did not show it. Other keys in it, such as screen and url, vary by store.
Buy Now
On the person's own account, authorize.buy_now: true presses the item's own "Buy Now" button in place of adding it to the bag. It needs max_commitment: "commit" sent in the request (the default does not count) and authorize.payment: "account_on_file". Anything else is 400, field authorize.buy_now. How to pay from the account is on Pay.
What can go wrong
Every answer in this table means nothing was bought. Fix what it names and try again with a new idempotency_key.
400 field quantity400 field selections400 field authorize.currency422 max_total_requiredcommit. Add authorize.max_total and authorize.currency.422 needs_inputcommit, the item has a choice you did not name. Its missing item names the choice and the values on offer. Ask the person and add it to selections. See When a drive pauses.409 over_max_total409 total_unreadable409 currency_mismatchauthorize.currency.409 cart_mismatch409 variant_unavailable409 selection_unconfirmed409 out_of_stock409 not_bookable_here409 address_rejected409 payment_method_unavailable409 order_refusederror carries its words. Nothing was bought.409 card_declinedSome answers are different. not_confirmed_after_otp, transaction_status_unknown and booked_a_different_entity mean it may have bought: do not send the order again, tell the person, and check with the store. For any other code at commit, read GET /v3/bookings/{booking_id} and check with the store before you order again. See Handle errors.
Next: Use a person's own account.