{"id":2588,"date":"2024-12-31T20:23:00","date_gmt":"2024-12-31T20:23:00","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-order\/"},"modified":"2025-04-24T09:38:26","modified_gmt":"2025-04-24T04:08:26","slug":"magento-2-api-create-order","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-api-create-order\/","title":{"rendered":"Magento 2 API &#8211; Create Order"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello, Magento peeps!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My previous blog post on the&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API<\/a>&nbsp;series was all about using&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-set-shipping-billing-information\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 API to set shipping and billing information<\/a>. I will show how to create order using Magento 2 REST API in today\u2019s post.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Magento 2 Create an Order API is useful for placing the order after successful payment by the customer. It plays a vital role in the order placement after the customer has entered the shipping &amp; billing information and completed the payment. The create order API in Magento 2 returns an order id, marking the successful order creation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s begin with the&nbsp;<em><strong>Magento 2 API \u2013 Create an Order<\/strong><\/em>!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create Order Using REST API in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In order to create an order in Magento 2 using REST API, the client needs to submit the payment information through a POST request to Magento 2 along with the customer token. It returns the order id in response, which marks the order creation. An example of the same is provided below:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Method:&nbsp;<\/strong>POST<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>URL:&nbsp;<\/strong><em>store_url\/rest\/V1\/carts\/mine\/payment-information<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Header:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Bearer Token:<\/strong>&nbsp;&lt;customer_token&gt;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Body:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"paymentMethod\": {\n                \"method\": \"checkmo\"\n     },\n    \"billing_address\": {\n                \"email\": \"jignesh.meetanshi@gmail.com\",\n                \"region\": \"Gujarat\",\n                \"region_id\": 580,\n                \"region_code\": \"GJ\",\n                \"country_id\": \"IN\",\n                \"street\": [\"Shiv Elite\"],\n                \"postcode\": \"364001\",\n                \"city\": \"Bhavnagar\",\n                \"telephone\": \"8141102201\",\n                \"firstname\": \"Jignesh\",\n                \"lastname\": \"Parmar\"\n     }\n}<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2022\/06\/Magento-2-API-Payment-Information-e1655366244278-1.png\" alt=\"Magento 2 API Payment Information e1655366244278\" class=\"wp-image-50681\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Re<\/strong><strong>s<\/strong><strong>ponse:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On successful authorization of the request and verification of the payment, Magento 2 returns the id of the created id.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>74<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 provides API endpoints for all the vital events required for the eCommerce stores. In case you are developing a new website or working on a mobile app based on Magento 2, you can use the APIs to connect the new storefront with Magento 2. The Magento 2 API to create order is useful for placing the order by submitting the payment information. I hope you will find this guide helpful to create an order using Magento 2 API. Likewise you can&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/create-order-in-magento-2-admin-panel\/\">create order in admin panel Magento 2<\/a>&nbsp;to assist your customers in order placement when they require. In case, you still have any doubts or queries, feel free to comment. I will be happy to help you.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not forget to share this useful blog post with your developer friends via social media.  <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks for reading.  <\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-set-shipping-billing-information\/\">Magento 2 API &#8211; Set Shipping &amp; Billing Info<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button btn-orange\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/meetanshi.com\/blog\/magento-2-api-create-an-invoice\/\">Magento 2 API &#8211; Create an Invoice<\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello, Magento peeps! My previous blog post on the&nbsp;Magento 2 API&nbsp;series was all about using&nbsp;Magento 2 API to set shipping and billing information. I will&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-2588","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=2588"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2588\/revisions"}],"predecessor-version":[{"id":12865,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/2588\/revisions\/12865"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=2588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=2588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=2588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}