How to create order using /V1/orders/create Rest API Magento 2?

Create Sales Order by REST API Magento 2 is useful to generate dynamic orders from the third-party platform in Magento System.

You can create an order using the required value from the given Payload. Send Payload in your request with PUT action.

For the Demonstrate purpose pass data like Shipping method, Flatrate shipping, Added Custom discount Shopping cart Rule, and COD as a payment method in payload request.

Check Create Invoice Using Magento 2 REST API
Check Create Shipment Using Magento 2 REST API

We have taken reference for the “Push It Messenger Bag (24-WB04)” simple product from the Magento Sample Data.

Request: {YOUR_URL}/rest/V1/orders/create

Action Type: PUT

Payload Body:

{
  "entity": {
        "base_currency_code": "USD",
        "base_discount_amount": -4.5,
        "base_grand_total": 45.5,
        "base_shipping_amount": 5,
        "base_subtotal": 45,
        "base_tax_amount": 0,
        "customer_email": "rakesh@rakeshjesadiya.com",
        "customer_firstname": "rakesh",
        "customer_group_id": 1,
        "customer_id": 2,
        "customer_is_guest": 0,
        "customer_lastname": "jesadiya",
        "customer_note_notify": 1,
        "discount_amount": -4.5,
        "email_sent": 1,
        "coupon_code": "Test1",
        "discount_description": "Test1",
        "grand_total": 45.5,
        "is_virtual": 0,
        "order_currency_code": "USD",
        "shipping_amount": 5,
        "shipping_description": "Flat Rate - Fixed",
        "state": "new",
        "status": "pending",
        "store_currency_code": "USD",
        "store_id": 1,
        "store_name": "Main Website\nMain Website Store\n",
        "subtotal": 45,
        "subtotal_incl_tax": 45,
        "tax_amount": 0,
        "total_item_count": 1,
        "total_qty_ordered": 1,
        "weight": 1,
        "items": [
        {
            "base_discount_amount": 4.5,
            "base_original_price": 45,
            "base_price": 45,
            "base_price_incl_tax": 45,
            "base_row_invoiced": 0,
            "base_row_total": 45,
            "base_tax_amount": 0,
            "base_tax_invoiced": 0,
            "discount_amount": 4.5,
            "discount_percent": 10,
            "free_shipping": 0,
            "is_virtual": 0,
            "name": "Push It Messenger Bag",
            "original_price": 45,
            "price": 45,
            "price_incl_tax": 45,
            "product_id": 14,
            "product_type": "simple",
            "qty_ordered": 1,
            "row_total": 45,
            "row_total_incl_tax": 45,
            "sku": "24-WB04",
            "store_id": 1
        }
        ],
        "billing_address": {
            "address_type": "billing",
            "city": "Ahmedabad",
            "company": "Rbj",
            "country_id": "US",
            "email": "rakesh@rakeshjesadiya.com",
            "firstname": "rakesh",
            "lastname": "jesadiya",
            "postcode": "30332",
            "region": "Georgia",
            "region_code": "GA",
            "region_id": 19,
            "street": [
                "Street 1",
                "Street 2"
            ],
            "telephone": "123456"
        },
        "payment": {
            "method": "cashondelivery"
        },
        "extension_attributes": {
            "shipping_assignments": [
                {
                    "shipping": {
                        "address": {
                            "address_type": "shipping",
                            "city": "Ahmedabad",
                            "company": "Rbj",
                            "country_id": "US",
                            "customer_address_id": 2,
                            "email": "rakesh@rakeshjesadiya.com",
                            "firstname": "rakesh",
                            "lastname": "jesadiya",
                            "postcode": "30332",
                            "region": "Georgia",
                            "region_code": "GA",
                            "region_id": 19,
                            "street": [
                                "Street 1",
                                "Street 2"
                            ],
                            "telephone": "123456"
                        },
                        "method": "flatrate_flatrate"
                    }
                }
            ]
        }
    }
}

When you run API using above payload,
You got the response from success order data with order_increment id as below format.

{
    "base_currency_code": "USD",
    "base_discount_amount": -4.5,
    "base_grand_total": 45.5,
    "base_shipping_amount": 5,
    "base_subtotal": 45,
    "base_tax_amount": 0,
    "base_total_due": 45.5,
    "billing_address_id": 204,
    "coupon_code": "Test1",
    "created_at": "2018-09-16 18:12:42",
    "customer_email": "rakesh@rakeshjesadiya.com",
    "customer_firstname": "rakesh",
    "customer_group_id": 1,
    "customer_id": 2,
    "customer_is_guest": 0,
    "customer_lastname": "jesadiya",
    "customer_note_notify": 1,
    "discount_amount": -4.5,
    "discount_description": "Test1",
    "email_sent": 1,
    "entity_id": 103,
    "grand_total": 45.5,
    "increment_id": "000000107",
    "is_virtual": 0,
    "order_currency_code": "USD",
    "protect_code": "a0c46ced9e5dfca13a9f4af86a237aeb",
    "shipping_amount": 5,
    "shipping_description": "Flat Rate - Fixed",
    "state": "new",
    "status": "pending",
    "store_currency_code": "USD",
    "store_id": 1,
    "store_name": "Main Website\nMain Website Store\nDefault Store View",
    "subtotal": 45,
    "subtotal_incl_tax": 45,
    "tax_amount": 0,
    "total_due": 45.5,
    "total_item_count": 1,
    "total_qty_ordered": 1,
    "updated_at": "2018-09-16 18:12:42",
    "weight": 1,
    "items": [
        {
            "base_discount_amount": 4.5,
            "base_original_price": 45,
            "base_price": 45,
            "base_price_incl_tax": 45,
            "base_row_invoiced": 0,
            "base_row_total": 45,
            "base_tax_amount": 0,
            "base_tax_invoiced": 0,
            "created_at": "2018-09-16 18:12:42",
            "discount_amount": 4.5,
            "discount_percent": 10,
            "free_shipping": 0,
            "is_virtual": 0,
            "item_id": 124,
            "name": "Push It Messenger Bag",
            "order_id": 103,
            "original_price": 45,
            "price": 45,
            "price_incl_tax": 45,
            "product_id": 14,
            "product_type": "simple",
            "qty_ordered": 1,
            "row_total": 45,
            "row_total_incl_tax": 45,
            "sku": "24-WB04",
            "store_id": 1,
            "updated_at": "2018-09-16 18:12:42"
        }
    ],
    "billing_address": {
        "address_type": "billing",
        "city": "Ahmedabad",
        "company": "Rbj",
        "country_id": "US",
        "email": "rakesh@rakeshjesadiya.com",
        "entity_id": 204,
        "firstname": "rakesh",
        "lastname": "jesadiya",
        "parent_id": 103,
        "postcode": "30332",
        "region": "Georgia",
        "region_code": "GA",
        "region_id": 19,
        "street": [
            "Street 1",
            "Street 2"
        ],
        "telephone": "123456"
    },
    "payment": {
        "account_status": null,
        "additional_information": [
            ""
        ],
        "cc_last4": null,
        "entity_id": 103,
        "method": "cashondelivery",
        "parent_id": 103
    },
    "status_histories": [],
    "extension_attributes": {
        "shipping_assignments": [
            {
                "shipping": {
                    "address": {
                        "address_type": "shipping",
                        "city": "Ahmedabad",
                        "company": "Rbj",
                        "country_id": "US",
                        "customer_address_id": 2,
                        "email": "rakesh@rakeshjesadiya.com",
                        "entity_id": 205,
                        "firstname": "rakesh",
                        "lastname": "jesadiya",
                        "parent_id": 103,
                        "postcode": "30332",
                        "region": "Georgia",
                        "region_code": "GA",
                        "region_id": 19,
                        "street": [
                            "Street 1",
                            "Street 2"
                        ],
                        "telephone": "123456"
                    },
                    "method": "flatrate_flatrate"
                },
                "items": null
            }
        ]
    }
}