Create Order API
The API is used to create orders in the 1mg system. Merchant partners must call this API to create an order in the 1mg system as the last step of the cart checkout journey. The API requires details about the cart items, coupons, prescriptions, payment options for the order, and other related information to place the order.
There are two possible values for the payment_method param in the request payload, COD or ONLINE. If the payment method is ONLINE, the responsibility of collecting the payment from the customer lies on the merchant partner. Merchants must collect the payment from the customer before calling the “Confirm Order“ API. Also, 1mg will need a set of APIs from the merchant partners to access the payment details for the order. These APIs are explained in the respective section of the doc.
Path Parameters
- merchant_id string required
Header Parameters
- X-Access-Key stringExample: 1mg_client_access_key
- application/json
Request Body
- merchant_order_id string
- payable_amount string
- payment_method string
- coupon_code string
user object
email stringmobile stringfirst_name stringlast_name stringaddress object
pincode stringcontact_number stringname stringstreet1 stringstreet2 stringtype string- prescriptions string[]
skus object
117004 integer139559 integer340278 integer367281 integer528051 integer
- 200
- 400
OK
Response Headers
Date string
Content-Type string
Transfer-Encoding string
Connection string
Vary string
X-Request-ID string
VISITOR-ID string
X-VISITOR-ID string
Server string
Access-Control-Allow-Methods string
Access-Control-Allow-Headers string
Access-Control-Allow-Origin string
Content-Encoding string
- application/json
- Schema
- Example (from schema)
- example-0
- example-1
Schema
- object
{}
Success Response COD Order
{
"data": {
"order_id": "PO29523366580001",
"merchant_order_id": "2333asa3s25222"
},
"partial_complete": false,
"is_success": true,
"status_code": 200
}
Success Response ONLINE mode
{
"data": {
"order_id": "PO29523368980003",
"action": "map_payment",
"payment_id": 2946454,
"merchant_order_id": "2333asa3s25223",
"payment_aggregator": "EKACARE"
},
"partial_complete": false,
"is_success": true,
"status_code": 200
}
Bad Request
Response Headers
Date string
Content-Type string
Content-Length integer
Connection string
X-Request-ID string
VISITOR-ID string
X-VISITOR-ID string
Server string
Access-Control-Allow-Methods string
Access-Control-Allow-Headers string
Access-Control-Allow-Origin string
- application/json
- Schema
- Example (from schema)
- Example
Schema
- object
{}
{
"is_success": false,
"status_code": 400,
"error": {
"errors": [
{
"message": "create_merchant_order : Could not acquire lock"
}
],
"message": "create_merchant_order : Could not acquire lock"
}
}