微信支付分 - 完结支付分订单API

2023-10-11 14:35:20 浏览数 (1)

说明:

和旧版接口相比,去除了finish_type,和finish_ticket.

请求示例:

代码语言:javascript复制
{
	"post_payments": [{
		"amount": 1,
		"name": "无人售货柜购物",
		"description": "冰箱购物收费"
	}],
	"total_amount": 1,
	"time_range": {
		"end_time": "20191202141923"
	},
	"appid": "wxd9564b8666be8516",
	"service_id": "00004000000000530082451787938770"
}

返回示例:

代码语言:javascript复制
{
	"appid": "wxd95642b8666be851",
	"location": {
		"start_location": "北京市石景山区"
	},
	"mchid": "15242932721",
	"need_collection": true,
	"order_id": "1000000000201912021121095610061",
	"out_order_no": "201912022676717242360258560",
	"post_discounts": [],
	"post_payments": [{
		"amount": 1,
		"description": "冰箱购物收费",
		"name": "无人售货柜购物"
	}],
	"risk_fund": {
		"amount": 10000,
		"description": "",
		"name": "ESTIMATE_ORDER_COST"
	},
	"service_id": "000040000000200530082451787938770",
	"service_introduction": "智慧零售",
	"state": "DOING",
	"state_description": "MCH_COMPLETE",
	"time_range": {
		"end_time": "20191202141923",
		"start_time": "20191202102926"
	},
	"total_amount": 1
}

常见请求错误返回:

错误一:

代码语言:javascript复制
{
	"code": "PARAM_ERROR",
	"message": "创建订单未填写服务结束时间,则结束时间必填"
}

解决方式: 1.创建支付分订单时如果填写end_time,完结时为了省事,可以不填; 2.创建支付分订单时,如果未填写end_time,完结时需要填写,而且填写的end_time必须 > start_tim,且不能晚于调接口时间; 3.个人建议:创建支付分订单时,填写start_time(OnAccept),不填写end_time; 在完结订单的时候,不填写start_time,结束时间end_time填nowTime。 

错误二:

代码语言:javascript复制
{
	"code": "PARAM_ERROR",
	"message": "完结订单状态不合法"
}

解决方式:

1.一般这种情况,可能是该订单已经完结了,无法再次完结,建议先查询支付分订单状态。

错误三:

代码语言:javascript复制
{
	"code": "PARAM_ERROR",
	"message": "真实结束时间小于预计开始时间"
}
代码语言:javascript复制
{
	"code": "PARAM_ERROR",
	"message": "服务开始时间不能早于调用接口时间,或传入固定值OnAccept表示用户确认订单成功时间为服务开始时间"
}

解决方式:

1.创建订单start_time写OnAccept,end_time不填写;完结订单时start_time不写,end_time写new Date()记得格式化。

0 人点赞