腾讯有数官方文档

创建子订单数据源

请求接口:

/data-api/v1/order/create_sub_order_data_source

请求方法:

POST

请求参数:

参数名 样例 描述
app_id abc 分配的app_id
nonce 61794670f155b 随机字符串
sign sha256 签名算法
timestamp 1569232087 请求时间戳(秒级)
signature aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5 签名结果

请求体类型:

application/json

请求体参数:

参数名 类型 描述
merchantId string 商家id

响应体结构:

参数名 二级字段 类型 描述
retcode integer 返回码
errmsg string 错误信息
data json object 响应内容
dataSource DataSource 数据源

请求示例:

curl 'https://域名/data-api/v1/order/create_sub_order_data_source?app_id=abc&nonce=61794670f155b&sign=sha256&timestamp=1569232087&signature=aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5' \
-X POST
-H 'Content-Type: application/json' \
-d '{
	"merchantId":"123"
}'

响应示例:

{
	"retcode":0,
	"errmsg":"",
	"data" {
		"dataSource": {
			"id": "102",
			"type": 0,
			"merchantId": "123"
		}
	}
}

添加子订单

请求接口:

/data-api/v1/order/add_sub_order

请求方法:

POST

请求参数:

参数名 样例 描述
app_id abc 分配的app_id
nonce 61794670f155b 随机字符串
sign sha256 签名算法
timestamp 1569232087 请求时间戳(秒级)
signature aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5 签名结果

请求体类型:

application/json

请求体参数:

参数名 类型 描述
dataSourceId string 数据源id(create方法返回的data.dataSource.id)
orders json array 子订单对象列表,子订单对象的结构请参考通用数据结构

响应体结构:

参数名 类型 描述
retcode integer 返回码
errmsg string 错误信息
data json object 响应内容

请求示例:

curl 'https://域名/data-api/v1/order/add_order?app_id=abc&nonce=61794670f155b&sign=sha256&timestamp=1569232087&signature=aee30792812d7b09ba7d3aa67c24e16c6a7ea81282ac728ad5966dd1b3eef6d5' \
-X POST
-H 'Content-Type: application/json' \
-d '{
	"dataSourceId":"102",
	"orders": [
		{
    		    "external_sub_order_id": "23200240460094000_15452001",
    		    "external_order_id": "23200240460094000",
		    "create_time": "1556618179",
		    "merchant_id": "1455222",
		    "merchant_name": "百丽",
		    "goods_num_total": 3,
		    "goods_weight": 400,
		    "goods_amount_total": 562200,
		    "freight_amount": 1000,
		    "payable_amount": 45000,
		    "payment_amount": 44000,
		    "order_amount": 57000,
		    "order_status": "1110",
		    "user_info": {
		        "open_id": "ok4Qb0U0dFqJ2KiSoGBXKCIqXnFY",
		        "app_id": "wxc8f3e27b33ae9e8e",
		        "union_id": " k4Qb0U0dFqJ2K",
		        "user_phone": "2E23E488C628E4F90EE9BCE456F869D2",
		        "user_id": "q2Qb0U0dFqJ2KGE",
		        "member_id": "8f323e76jsw3ae9e8e",
		        "user_first_order_time": 1556618179
		    },
		    "goods_info": [
		        {
		            "external_sku_id": "cS1cWjrkFbFUA",
		            "sku_name_chinese": "鞋子蓝色",
		            "is_gift": 0,
		            "external_spu_id": "F-306233",
		            "spu_name_chinese": "鞋子",
		            "sale_unit": "双",
		            "goods_num": 2,
		            "goods_weight": 350,
		            "store_info": {
		                "external_store_id": "9L33",
		                "store_name": "文华仓",
		                "store_city": "福州市"
		            },
		            "chan_info": {
		                "chan_id": "101111",
		                "chan_type": "WXAPP",
		                "chan_scene": "1001"
		            }
		        },
		        {
		            "external_sku_id": "caaajrkFbFUA",
		            "sku_name_chinese": "连衣裙红色",
		            "is_gift": 0,
		            "external_spu_id": "F-306233",
		            "spu_name_chinese": "连衣裙",
		            "sale_unit": "件",
		            "goods_num": 1,
		            "goods_weight": 350,
		            "store_info": {
		                "external_store_id": "9L33",
		                "store_name": "文华仓",
		                "store_city": "福州市"
		            },
		            "chan_info": {
		                "chan_id": "101111",
		                "chan_type": "WXAPP",
		                "chan_scene": "1005"
		            }
		        }
		    ],
		    "commission_info": [
		        {
		            "commission_type": "PERCENT",
		            "commission_fee": 100
		        },
		        {
		            "commission_type": "VALUE",
		            "commission_fee": 200
		        }
		    ],
		    "promotion_info": [
		        {
		            "promotion_type": "X_UNIT_DISCOUNT",
		            "external_promotion_id": "277329",
		            "promotion_name": "五一优惠券",
		            "promotion_amount": 120
		        },
		        {
		            "promotion_type": "ORDER_FULL_CUT",
		            "external_promotion_id": "277329",
		            "promotion_name": "会员优惠券",
		            "promotion_amount": 100
		        }
		    ],
		    "coupon_info": [
		        {
		            "coupon_type": "MERCHANT_COUPON",
		            "coupon_amount_total": 200,
		            "coupon_detail": [
		                {
		                    "external_coupon_id": "UWBE8873basfJ",
		                    "coupon_batch_id": "37BHknfE832DW",
		                    "coupon_name": "会员10元优惠券",
		                    "amount_coupon": "100"
		                },
		                {
		                    "external_coupon_id": "46568873basfJ",
		                    "coupon_batch_id": "37BHknfE832DW",
		                    "coupon_name": "节日10元优惠券",
		                    "amount_coupon": "100"
		                }
		            ]
		        },
		        {
		            "coupon_type": "WECHAT_PAY_COUPON",
		            "coupon_amount_total": 30,
		            "coupon_detail": [
		                {
		                    "external_coupon_id": "4558873basfJ",
		                    "coupon_batch_id": "37455fE832DW",
		                    "coupon_name": "支付2元优惠券",
		                    "coupon_amount": "20"
		                },
		                {
		                    "external_coupon_id": "4558873basfJ",
		                    "coupon_batch_id": "37455fE832DW",
		                    "coupon_name": "支付叠加1元优惠券",
		                    "coupon_amount": "10"
		                }
		            ]
		        }
		    ],
		    "payment_info": [
		        {
		            "payment_type": "00009",
		            "trans_id": "243245125",
		            "trans_amount": 100
		        },
		        {
		            "payment_type": "00004",
		            "trans_id": "2566245125",
		            "trans_amount": 200
		        }
		    ],
		    "express_info": {
		        "logistics_status": "3010",
		        "goods_total_weight": 150,
		        "receiver_name": "Jerry",
		        "receiver_phone": "2E23E488C628E4F90EE9BCE456F869D2",
		        "receiver_address": "广东省深圳市XXX",
		        "receiver_country_code": "156",
		        "receiver_province_code": "440000",
		        "receiver_city_code": "440001",
		        "receiver_district_code": "440001",
		        "expected_delivery_time": "9:00-12:00",
		        "expected_delivery_date": "20190501",
		        "express_package_info": {
		            "express_company_code": "100003",
		            "express_company_name": "顺丰",
		            "express_code": 27427185,
		            "ship_time": 1556618179,
		            "express_page": {
		                "miniprogram_path": "http:XXXX",
		                "miniprogram_appid": "CDEEss",
		                "miniprogram_h5": "http://XXX"
		            },
		            "express_package_info": [
		                {
		                    "external_sku_id": "7888372",
		                    "number": 1
		                },
		                {
		                    "external_sku_id": "FE-788837201",
		                    "number": 3
		                }
		            ]
		        },
		        "invoice": [
		            {
		                "if_need_invoice": 1,
		                "invoice_type": "1002",
		                "invoice_title": "UUnw829auH",
		                "invoice_content": "F371BYSWfe",
		                "invoice_addition_info": "无",
		                "invoice_company": "广东深圳公司",
		                "invoice_taxpayer": 510107723420661,
		                "registry_address": "广东深圳市",
		                "registry_phone": "2E23E488C628E4F90EE9BCE456F869D2",
		                "registry_bank_name": "工商银行",
		                "registry_bank_account": 698374522,
		                "invoice_delivery_address": "广东深圳市",
		                "invoice_delivery_name": "Jerry",
		                "invoice_delivery_phone": "2E23E488C628E4F90EE9BCE456F869D2",
		                "invoice_num": 8377205631
		            },
		            {
		                "if_need_invoice": true,
		                "invoice_type": "1001",
		                "invoice_title": "aaUnw829auH",
		                "invoice_content": "aa71BYSWfe",
		                "invoice_addition_info": "无",
		                "invoice_company": "广东深圳公司",
		                "invoice_taxpayer": 510107723420661,
		                "registry_address": "广东深圳市",
		                "registry_phone": "2E23E488C628E4F90EE9BCE456F869D2",
		                "registry_bank_name": "工商银行",
		                "registry_bank_account": 698374522,
		                "invoice_delivery_address": "广东深圳市",
		                "invoice_delivery_name": "tom",
		                "invoice_delivery_phone": "2E23E488C628E4F90EE9BCE456F869D2",
		                "invoice_num": 8377205631
		            }
		        ],
		        "points_total": 200
		    },
		    "is_deleted": 0
		}
	]
}'

响应示例:

{
  "retcode":0,
  "errmsg":"",
  "data": {}
}