Magento 2 Create an order using Integration token in REST API
-
14-04-2021 - |
質問
I want to place orders on behalf of a customer. I have an integration token for this. I have followed the below steps.
- Create Empty Cart = POST
/V1/carts
(Passing customer Id as param) - Add product to cart = POST
"/V1/carts/".$quote_id."/items"
(Passing product data) - Get Shipping methods = POST
"/V1/carts/".$quote_id."/estimate-shipping-methods"
- 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?
解決
I have followed the below steps to place an order on behalf of a customer using integration token.Now it is working fine.
- Create Empty Cart: /V1/carts/mine => POST with payload {'customer_id':{customerId}}. It returns the cartId
- Add Products to cart: /V1/carts/{cartId}/items => POST Request
- Get Cart Totals: /V1/carts/{cartId}/totals => GET Request
- Estimate Shipping methods: /V1/carts/{cartId}/estimate-shipping-methods => POST Request ( It list all availble shipping methods)
- Set Billing and Shipping: /V1/carts/{cartId}/shipping-information => POST Request (It returns the availble payment methods)
- Set Payment and place order: /V1/carts/mine/payment-information => POST Request (It returns the Order increment Id)
- 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}
所属していません magento.stackexchange