创建先享后付订单
如用户可使用服务,则请求【创建先享后付订单】接口,创建订单。 官方文档
js
wxpay.v3.payscore.payafterOrders.post({
appid,
out_order_no,
service_id,
service_start_time,
service_end_time,
service_start_location,
service_end_location,
service_introduction,
fees,
discounts,
risk_amount,
attach,
need_user_confirm,
openid,
name,
phone,
userid,
address,
}, { headers })
.then(
({
data: {
appid,
mchid,
out_order_no,
service_id,
order_id,
miniprogram_businesstype,
miniprogram_appid,
miniprogram_path,
miniprogram_username,
package: packageStr,
},
}) => ({
appid,
mchid,
out_order_no,
service_id,
order_id,
miniprogram_businesstype,
miniprogram_appid,
miniprogram_path,
miniprogram_username,
package: packageStr,
})
)
查询先享后付订单
在收到订单确认成功通知前,商户也可以通过【查询先享后付订单】接口主动查询订单确认情况;前置条件: 商户下单已受理后。 官方文档
js
wxpay.v3.payscore.payafterOrders.get({
params,
})
.then(
({
data: {
appid,
mchid,
out_order_no,
service_id,
state,
finish_type,
service_start_time,
service_end_time,
real_service_start_time,
real_service_end_time,
pay_succ_time,
service_start_location,
service_end_location,
real_service_start_location,
real_service_end_location,
service_introduction,
fees,
discounts,
risk_amount,
total_amount,
attach,
finish_ticket,
finish_transaction_id,
pay_type,
},
}) => ({
appid,
mchid,
out_order_no,
service_id,
state,
finish_type,
service_start_time,
service_end_time,
real_service_start_time,
real_service_end_time,
pay_succ_time,
service_start_location,
service_end_location,
real_service_start_location,
real_service_end_location,
service_introduction,
fees,
discounts,
risk_amount,
total_amount,
attach,
finish_ticket,
finish_transaction_id,
pay_type,
})
)