# Generate an Order
# Dxplaination of Interface Call Request
This connection applies to scenarios where theticket payment validation
scheme is used or where the request for OrderPayment is not required. For more information, see development guidelines Section 3.3
Note: This interface can be re-invoked to update the entire order data directly iforder_id
orout_order_id
already exists
A status = 10 order will be created when the request is successful (see the status enumeration below)
Each ticket can only be consumed once, and the order creation interface can be adjusted multiple times, but it is not necessary to generate new tickets depending on the situation. Scenario A: The first time ticketA is generated, ticketA is invalid after pulling up the cash register to consume ticketA The second adjustment will generate a new ticketB
Scenario B: The first generation of ticketA, do not adjust the cashier consumption of this ticket, then within 24 hours to adjust the generation or ticketA, more than 24 hours to generate a new ticketA'
At present, only those who enter the order after successful payment will synchronize the order to the order center.
For cases where a contract payment requires a split bill, synchronize the bill with the mother bill.
http请求方式:POST
https://api.weixin.qq.com/shop/order/add?access_token=xxxxxxxxx
# Example I of request parameters (normal payment scenario)
{
"create_time": "2020-03-25 13:05:25",
"out_order_id": "xxxxx", // 必填,普通场景下的外部订单ID;合单支付(多订单合并支付一次)场景下是主外部订单ID
"openid": "oTVP50O53a7jgmawAmxKukNlq3XI",
"path": "/pages/order.html?out_order_id=xxxxx", // 这里的path中的最好有一个参数的值能和out_order_id的值匹配上
"scene": 1177, // 下单时小程序的场景值,可通过[getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html)或[onLaunch/onShow](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onLaunch-Object-object)拿到
"out_user_id": "323232323",
"order_detail":
{
"product_infos":
[
{
"out_product_id": "12345",
"out_sku_id":"23456",
"product_cnt": 10,
"sale_price": 100, //生成这次订单时商品的售卖价,可以跟上传商品接口的价格不一致
"real_price": 100, // 扣除优惠后单件sku的分摊价格(单位:分),如果没优惠则与sale_price一致
"path": "pages/productDetail/productDetail?productId=2176180",
"title" : "洗洁精",
"head_img": "http://img10.360buyimg.com/n1/s450x450_jfs/t1/85865/39/13611/488083/5e590a40E4bdf69c0/55c9bf645ea2b727.jpg",
},
...
],
"pay_info": {
"pay_method_type": 0, // 0: 微信支付, 1: 货到付款, 2: 商家会员储蓄卡(默认0)
"prepay_id": "42526234625", // pay_method_type = 0时必填
"prepay_time": "2020-03-25 14:04:25"
},
"price_info": { // 注意价格字段的单价是分,不是元
"order_price": 1600,
"freight": 500,
"discounted_price": 100,
"additional_price": 200,
"additional_remarks": "税费"
}
},
"delivery_detail": {
"delivery_type": 1, // 1: 正常快递, 2: 无需快递, 3: 线下配送, 4: 用户自提
},
"address_info": {
"receiver_name": "张三",
"detailed_address": "详细收货地址信息",
"tel_number": "收货人手机号码",
"country": "国家,选填",
"province": "省份,选填",
"city": "城市,选填",
"town": "乡镇,选填"
}
}
# Examples of back-up
{
"errcode": 0,
"errmsg":"ok",
"data":
{
"order_id":32434234,
"out_order_id": "xxxxx",
"ticket": "xxxxxxx",
"ticket_expire_time": "2020-12-01 00:00:00",
"final_price": 10500 //final_price=product_price+freight-discounted_price+additional_price
}
}
# Dxplaination of request parameters
参数 | type | Is it compulsory? | Introductions |
---|---|---|---|
create_time | string | yes | Created time, yyyy-MM-dd HH: mm: ss |
out_order_id | string | yes | Merchant Custom Order ID |
openid | string | yes | User's openid |
path | string | yes | Merchant Weixin Mini Program The page path of the order, used for WeChat side order center jump |
scene | number | yes | The scene value of Weixin Mini Program when placing an order can be obtained from getLaunchOptionsSync or [onLaunch / onShow [[TAG-1-EN@@ |
order_detail.product_infos[].out_product_id | string | yes | Merchant Custom Item ID |
order_detail.product_infos[].out_sku_id | string | yes | Merchant custom product skuID, can fill in the character string (if there is no sku under this product_id) |
order_detail.product_infos[].product_cnt | number | yes | Number of purchases |
order_detail.product_infos[].sale_price | number | yes | The sale price (in units of cents) of an item at the time of the creation of an order may not be consistent with the price of the item uploaded to the item interface |
order_detail.product_infos[].real_price | number | yes | The average price of a single SKU after deducting the discount (unit: cent), if there is no discount, the same as the sale_price |
order_detail.product_infos[].head_img | string | yes | Headmap of the item at the time of creation of the order |
order_detail.product_infos[].title | string | yes | The title of the item at the time of the order is generated |
order_detail.product_infos[].path | string | yes | Bound Weixin Mini Program product path |
order_detail.pay_info.pay_method_type | number | yes | Payment method, 0, WeChat payment, 1: payment on arrival, 2: merchant membership storage card (default 0) |
order_detail.pay_info.prepay_id | string | no | Pre-payment ID, payment method "WeChat" is required |
order_detail.pay_info.prepay_time | string | no | Prepayment time (time to get prepay_id), payment method is "WeChat payment" required, yyyy-MM-dd HH: mm: ss |
order_detail.price_info.order_price | number | yes | The final amount paid for the order (in units of cents) |
order_detail.price_info.freight | number | yes | Shipping costs (in units of cents) |
order_detail.price_info.discounted_price | number | no | Amount of concession (in units of cents) |
order_detail.price_info.additional_price | number | no | Additional amount (in units of cents) |
order_detail.price_info.additional_remarks | string | no | Note of Additional Amount |
delivery_detail.delivery_type | number | yes | 1: Normal courier, 2: No courier required, 3: Offline delivery, 4: Self-pickup by user (default 1) |
address_info | object | no | Address information, delivery_type = 2 No need to set, delivery_type = 4 Fill in the address of the pick-up store |
address_info.receiver_name | string | yes | Name of the recipient |
address_info.detailed_address | string | yes | Detailed shipping address information |
address_info.tel_number | string | yes | Recipient's mobile phone number |
address_info.country | string | no | country |
address_info.province | string | no | province |
address_info.city | string | no | city |
address_info.town | string | no | Township |
# About prices
Order_price = total product price (sum (sale_price)) + freight - discounted_price
# Dxplaination of callback parameters
参数 | type | Introductions |
---|---|---|
errcode | number | Error code |
errmsg | string | Error message |
data.order_id | number(uint64) | Trading Component Platform Order ID |
data.out_order_id | string | Trading Component Platform Order ID |
data.ticket | string | Pull up the ticket at the cash register |
data.ticket_expire_time | string | Ticket validity deadline |
data.final_price | number | Order final price (in units of cents) |
# Enumeration - status
枚举值 | describe |
---|---|
10 | Payment to be made |
11 | Cash register payment is completed (automated transfer and treated equally to 10 for merchants) |
20 | Pending shipment (paid / user paid the final payment) |
30 | To be received |
100 | complete |
200 | Orders are cancelled after all goods are sold. |
250 | Users actively cancel / pending payment cancel / Merchants cancel |