I am looking for the complete "happy path" to place an order using Magento2's REST API. So far these are all the steps I have followed. What else am I missing?
Create a user: [POST] /rest/V1/customers
Log In (create a token): [POST] /rest/V1/integration/customer/token
Get Product Categories for navigation: [GET] /rest/V1/categories
Get Products:
4.1 Get Category Products: [GET] /rest/V1/categories/{category_id}/products
4.2 Or search for a product: [GET] /rest/V1/products
Create a cart: [POST] /rest/V1/carts/mine
Add items to cart: [POST] /rest/V1/carts/mine/items
Get cart payment information [GET] /rest/V1/carts/mine/payment-information
...
What other things do I have to do to place the order?
create empty cart url : http://www.xxxxxx.com/rest/V1/carts/mine call: post response: cartID eg: 4290
Add item to the cart url : http://www.xxxxxx.com/rest/V1/carts/mine/items body:
{"cartItem":{
"sku":"JFCO00017","qty":1,"name":"Devil May Cry III 3 Dante Cosplay Costume","price":81.55,"product_type":"simple","quote_id":"4290","product_option":{"extension_attributes":{"custom_options":[{"option_id":"thumbnail","option_value":"\/d\/e\/devilmaycryiii3dantecosplay_1_.jpg"},{"option_id":"color_2","option_value":"Red"},{"option_id":"google_size","option_value":"xxs"}]}}}
}
Add billling info url : http://www.xxxxxx.com/rest/V1/carts/mine/billing-address body:
{
"address": {
"city": "noida",
"company": "iprag",
"countryId": "IN",
"email": "[email protected]",
"firstname": "Manish",
"lastname": "Kumar",
"postcode": "201301",
"region": "UP",
"saveInAddressBook": 1,
"street": ["D-84"],
"telephone": "8802xxxx90"
},
"useForShipping": true
}
get shipping-methods url : http://www.xxxxxx.com/rest/V1/carts/mine/shipping-methods
{
"carrier_code": "flatrate",
"method_code": "flatrate",
"carrier_title": "Flat Rate",
"method_title": "Fixed",
"amount": 10,
"base_amount": 10,
"available": true,
"error_message": "",
"price_excl_tax": 10,
"price_incl_tax": 10
}
add shipping info url : http://www.xxxxxx.com/rest/V1/carts/mine/shipping-information body:
{
"addressInformation": {
"billingAddress": {
"city": "noida",
"company": "iprag",
"email": "[email protected]",
"firstname": "Manish",
"lastname": "Kumar",
"postcode": "335001",
"region": "UP",
"street": ["D-84"],
"telephone": "9413433217"
},
"shippingAddress": {
"city": "noida",
"company": "iprag",
"email": "[email protected]",
"firstname": "Manish",
"lastname": "Kumar",
"postcode": "335001",
"region": "UP",
"street": ["D-84"],
"telephone": "9413433217"
},
"shippingCarrierCode": "flatrate",
"shippingMethodCode": "flatrate"
}
}
response: payment method and cart detail
Order place URL : http://www.xxxxxx.com/rest/V1/carts/mine/order body :
{
"paymentMethod":{"method":"checkmo"},
"shippingMethod":
{
"method_code":"flatrate",
"carrier_code":"flatrate",
"additionalProperties":{}
}
}
response: orderid