Magento 2 API docs
I am trying to place an order using magento 2 REST API. What i have done so far is given below,
- Created an empty cart(
quoteCartManagementV1: /V1/carts
) - Added item to my cart(
quoteCartItemRepositoryV1: /V1/carts/mine/items
) - Assign billing and shipping info to my cart(
checkoutShippingInformationManagementV1 /V1/carts/{cartid}/shipping-information
) - Checking out using the cart I created above(
quoteCartManagementV1: /V1/carts/{cartid}/order
)
I have performed first three of the above four steps successfully, but while performing step no. 4 I am getting the following response from magento 2 REST API,
{"message":"Please enter a customer email."}
My Request against this response was,
{"paymentMethod":{"method":"checkmo"}}
Is there anything wrong in my work flow? Please help!!
Best Answer
1. Get Customer Token
method : POST
2. Get Cart ID (Quote ID) - using customer id.
method : POST
Authorization : Bearer <customer token>
3. Add Configurable product in cart.
method : POST
Authorization : Bearer <customer token>
body data : json
4. Get & put Shipping Information.
method : POST
Authorization : Bearer <customer token>
body data : json
5. Get payment method.
method : POST
Authorization : Bearer <customer token>
6. Place an order.
method : POST
Authorization : Bearer <customer token>
body data : json
And finally, this will return order ID, which you just placed!