合单JSAPI支付
使用合单支付接口,用户只输入一次密码,即可完成多个订单的支付。目前最多一次可支持50笔订单进行合单支付。 官方文档
js
const { Formatter, Rsa } = require('wechatpay-axios-plugin')
wxpay.v3.combineTransactions.jsapi.post({
combine_appid,
combine_mchid,
combine_out_trade_no,
scene_info,
sub_orders,
combine_payer_info,
time_start,
time_expire,
notify_url,
limit_pay,
})
.then(({ data: { prepay_id } }) => {
const nonceStr = Formatter.nonce();
const timeStamp = '' + Formatter.timestamp();
const packageStr = 'prepay_id=' + prepay_id;
return {
appId,
timeStamp,
nonceStr,
package: packageStr,
signType: 'RSA',
paySign: Rsa.sign(
Formatter.joinedByLineFeed(appId, timeStamp, nonceStr, packageStr),
merchantPrivateKeyInstance
)
}
})