beehexa integrationsidebar
beehexa beehexa logo 1

We Build HexaSync Integration Platform for Connecting ERP, POS, CRM, Accounting, and eCommerce Applications to Automate Business Processes

Magento API create order

Magento 2 API (Updated 2024): Create an order

In this post, I will show you how to create an order using an offline payment method. Therefore, this endpoint below only requires the payment method and billing address information. Follow our example code to find out how to create your own order by Magento 2 API.

Step 1: Generate Access Token

First, to create a customer account, admin authorization is required. Complete the following steps to authorize access to resources:

In the POST request enter your store URL along with this endpoint.

POST <host>/rest/V1/integration/customer/token

Enter your customer username and password in Body sections, then click Send

  "username": "string",
  "password": "string"
}Code language: JSON / JSON with Comments (json)

Step 2: Create an order

When you request payment details, Magento makes an order and sends a confirmation of the order to the customer.

Create a new request with this endpoint:

POST <host>/rest/V1/carts/mine/payment-information

In the Authorization section:

  • Choose Type: Bearer Token
  • Then paste your token

In Payload section:

  "paymentMethod": {
    "method": "checkmo"
  "billing_address": {
    "email": "[email protected]",
    "region": "Nevada",
    "region_id": 39,
    "region_code": "NV",
    "country_id": "US",
    "street": ["3703 Wescam Court"],
    "postcode": "89406",
    "city": "Fallon",
    "telephone": "860-212-5597",
    "firstname": "Julie",
    "lastname": "Lawson"
}Code language: JSON / JSON with Comments (json)


An order ID

Create order code magento 2 api

When you review the order as Admin, the response contains full details about the order, such as customer information, payment details for the order and each individual item.

Step 3: Verify the order

  1. Log in to the store with the example account and check your order.
  2. Log in to your Magento Admin. Then go to Sales > Orders. Use the order Id to search for your pending order.
Verify order as admin

Above, I have just provided you with three steps on how to convert the quote to an order. I hope it would be helpful for you when creating an order using Magento API. For more information, you can refer to Magento DevDocs. If you have any questions or new ideas, feel free to leave a comment below.

Table of Contents

Ready to integrate and automate at scale ?

Learn how HexaSync lets you build enterprise-grade integrations and automations without having to code.

Receive Exclusive Productivity Tips Directly in Your Inbox

We’ll email you 1-3 times per week—and never share your information.

Get started for free

You can’t add more hours to the day. Beehexa is the next best thing.