Create Order - citiesocial/citiesocial-api-doc GitHub Wiki
Create Order
-
URL
/orders/create/
-
Method:
POST
-
URL Params
None
-
Data Params
{
"line_items": [
{
"variant_id": 123450001(integer),
"quantity": 2(integer)
},
{
"variant_id": 123450002(integer),
"quantity": 1(integer)
}
],
"email": "[email protected]"(string, must be valid email format),
"shipping_address": {
"first_name": "小明"(string),
"last_name": "王"(string),
"title": "先生"(string, must be "先生", "小姐" or ""),
"zip": "100"(string, must be numbers whose length is 3 or 5),
"city": "台北市"(string),
"address1": "中正區"(string),
"address2": "八德路一段"(string),
"phone": "0912345678"(string, 必須為10碼手機號碼)
},
"transaction_amount": 30(integer),
"channel_order_reference": "abcd1234"(string:128)
}
-
Success Response:
- Code: 201 CREATED
Content: As sample success response below.
- Code: 201 CREATED
-
Error Response:
-
Code: 400 BAD REQUEST
-
Content:
Invalid json format
{"errors": "Invalid json format."}
Variant id is not valid, please check variant_id is right.
{"errors": "variant_id is not valid."}
Price validation failed, please refresh price for variant.
{"errors": "total_price:30 does not equal transaction_amount:50"}
Unable to claim inventory, please refresh variant inventory.
{"errors": "Unable to claim inventory."}
-
Code: 401 UNAUTHORIZED
Content:{"message": "Unauthorized access"}
-
Code: 405 METHOD NOT ALLOWED
Content:"POST is required."
-
-
Sample Successful Response:
{
"order": {
"total_price": 30,
"name": "#1207",
"items": [
{
"shipment": null,
"estimated_shipping_date": null,
"name": "Active 水煙筒 - 原木",
"is_refunded": false,
"variant_id": 1793693507
},
{
"shipment": null,
"estimated_shipping_date": null,
"name": "Active 水煙筒 - 原木",
"is_refunded": false,
"variant_id": 1793693507
},
{
"shipment": null,
"estimated_shipping_date": null,
"name": "Active 水煙筒 - 橘 - 橘灰",
"is_refunded": false,
"variant_id": 1793680195
}
],
"financial_status": "pending",
"id": "5764308878",
"shipping_address": {
"city": "台北市",
"first_name": "小明",
"last_name": "王",
"zip": "100",
"title": "先生",
"address1": "中正區",
"address2": "八德路一段",
"phone": "0912345678"
},
"is_cancelled": false,
"email": "[email protected]",
"channel_order_reference": "abcd1234"
}
}