TransWikia.com

Magento 2 Create an order using Integration token in REST API

Magento Asked by Jancy Abraham on October 1, 2021

I want to place orders on behalf of a customer. I have an integration token for this. I have followed the below steps.

  1. Create Empty Cart = POST /V1/carts (Passing customer Id as param)
  2. Add product to cart = POST "/V1/carts/".$quote_id."/items" (Passing product data)
  3. Get Shipping methods = POST "/V1/carts/".$quote_id."/estimate-shipping-methods"
  4. Set shipping and billing = POST "V1/carts/".$quote_id."/shipping-information"

The above steps are working fine. Now I need to set the payment method and place the order. How can I do it?

One Answer

I have followed the below steps to place an order on behalf of a customer using integration token.Now it is working fine.

  1. Create Empty Cart: /V1/carts/mine => POST with payload {'customer_id':{customerId}}. It returns the cartId
  2. Add Products to cart: /V1/carts/{cartId}/items => POST Request
  3. Get Cart Totals: /V1/carts/{cartId}/totals => GET Request
  4. Estimate Shipping methods: /V1/carts/{cartId}/estimate-shipping-methods => POST Request ( It list all availble shipping methods)
  5. Set Billing and Shipping: /V1/carts/{cartId}/shipping-information => POST Request (It returns the availble payment methods)
  6. Set Payment and place order: /V1/carts/mine/payment-information => POST Request (It returns the Order increment Id)
  7. To get the order Details: /V1/orders => GET Request with search criteria

searchCriteria[filter_groups][0][filters][0][field]=increment_id&searchCriteria[filter_groups][0][filters][0][value]={IncrementId}

Correct answer by Jancy Abraham on October 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP