Order Processing with REST APIs Tutorial
Step 7. Create an order
The shopping cart contains three items totaling $108. The shipping charges are $10, making the grand total $118. We’re now ready to convert the quote to an order.
Send payment information
When you submit payment information, Magento creates an order and sends an order confirmation to the customer. Since we are using an offline payment method in this tutorial, we do not need to provide detailed payment information. The endpoint used in this example requires only the payment method and billing address information.
Endpoint
POST http://<host>/rest/default/V1/carts/mine/payment-information
Headers
Content-Type
application/json
Authorization
Bearer <customer token>
Payload
Response
An orderID
, such as 3
.
Review the order as an admin
When you request an order object, the response contains full details about the order, including customer information, payment details, as well as totals and subtotals for the order and each individual item.
Endpoint
GET http://<host>/rest/default/V1/orders/3
where 3
is the orderid
Headers
Content-Type
application/json
Authorization
Bearer <administrator token>
Payload
Not applicable
Response
Verify this step
- Log in to the Luma store as the customer. The dashboard shows the order.
- Log in to Admin. Click Sales > Orders. The order is displayed in the grid. Its status is Pending.