Create order interface

Create a user shopping order, supporting single product or multiple product ordering, can specify shipping address, coupons and other information.

Points to note

  • The API uses the POST method and requires data to be submitted in application/ format
  • Access requires user login
  • The order status is pending payment, waiting for user payment
  • You can create an order by product ID or product detail list
  • Support using coupons and specified delivery address

Request address

{ๅŸŸๅๅœฐๅ€}/api/order/create

Description:{ๅŸŸๅๅœฐๅ€}Replace it with your domain name, such ashttps://en.anqicms.com/api/order/create

Request Syntax

POST {ๅŸŸๅๅœฐๅ€}/api/order/create
Content-Type: application/json

Request Headers

This interface also involves common request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request parameters

Field name Type Required Description
goods_id int No Product ID, can be used when placing an order for a single product
quantity int No Product quantity, can be used when placing an order for a single product
goods_sku_id int No SKU ID, use for placing an order for a single item
details object[] No Multiple product information, either goods_id or details must be provided
remark string No Order remarks
type string No Order type, goods, vip
coupon_code string No Coupon code
coupon_code_id int No Coupon code ID
coupon_id int No Coupon ID, discount coupons
address object No Shipping address information
cart_ids int[] No List of shopping cart IDs

Details item parameters

Field name Type Required Description
goods_id int Is Product ID
quantity int Is Product Quantity

Address parameters

Field name Type Required Description
id int No Address ID
name string Is Recipient
phone string Is Contact phone number
Province string Is Province
City string Is City
Country string Is district
address information string Is detailed address
postal code string Is postcode

Response header

This interface only involves public response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field name Type Description
code int Error code
msg string Error description
data object Order Information

Data result parameter

Field name Type Description
id int Order ID
order_id string Order Number
payment_id string PaymentๆตๆฐดID
user_id int User ID
remark string Order remarks
type string Order Type
original amount int Order Original Total Price
amount int Total Actual Order Amount
Paid Time int Payment Time
End Time int Estimated Auto Completion Time
deliver_time int Delivery Time
Finished Time int Order Completion Time
Discount amount int Discount Amount
seller_id int seller ID
seller amount int seller's earnings
share user ID int Promoter ID
share_parent_user_id int Promoter's superior ID
Share amount int Promoter's earnings
share_parent_amount int incomes_of_promoter_s_upline
express_company string express_company
tracking number string express delivery waybill number
created_time int order timestamp
updated_time int update timestamp
status int Order status: -1 Cancelled, 0 Pending payment, 1 Paid, 2 Shipped, 3 Completed, 8 Refunding, 9 Refunded
refund_status int Refund status: -1 Refund failed, 0 No refund or in progress, 1 Refunded

Usage Example

Request example (single product)

POST /api/order/create HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "goods_id": 188,
  "quantity": 1,
  "type": "goods",
  "remark": "ๆ™ฎ้€šๅ•†ๅ“่ฎขๅ•"
}

Example Request (multiple products)

POST /api/order/create HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "details": [
    {
      "goods_id": 188,
      "quantity": 1
    },
    {
      "goods_id": 189,
      "quantity": 2
    }
  ],
  "type": "goods",
  "address": {
    "name": "็Ž‹ๅ…ˆ็”Ÿ",
    "phone": "13888888888",
    "province": "ๆฒณๅ—็œ",
    "city": "้ƒ‘ๅทžๅธ‚",
    "country": "ไธญๅŽŸๅŒบ",
    "address_info": "ไธญๅŽŸ่ฅฟ่ทฏ233ๅท",
    "postcode": "450000"
  },
  "remark": "ๅคšๅ•†ๅ“่ฎขๅ•",
  "coupon_code": "COUPON2023"
}

Response Example

{
  "code": 0,
  "msg": "",
  "data": {
    "id": 46,
    "created_time": 1669212548,
    "updated_time": 1669212548,
    "order_id": "202211232209080046",
    "payment_id": "",
    "user_id": 1000,
    "address_id": 0,
    "remark": "ๆ™ฎ้€šๅ•†ๅ“่ฎขๅ•",
    "type": "goods",
    "status": 0,
    "refund_status": 0,
    "origin_amount": 9900,
    "amount": 9900,
    "paid_time": 0,
    "end_time": 0,
    "deliver_time": 0,
    "finished_time": 0,
    "discount_amount": 0,
    "seller_id": 15,
    "seller_amount": 7920,
    "share_user_id": 0,
    "share_parent_user_id": 0,
    "share_amount": 0,
    "share_parent_amount": 0,
    "express_company": "",
    "tracking_number": ""
  }
}

error code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Not authorized
200 API request OK