APP下单(合作伙伴模式)
商户系统先调用该接口在微信支付服务后台生成预支付交易单,返回正确的预支付交易会话标识后再在APP里面调起支付。 官方文档
js
const { Formatter, Rsa } = require('wechatpay-axios-plugin')
wxpay.v3.pay.partner.transactions.app.post({
sp_mchid,
sp_appid,
sub_mchid,
sub_appid,
description,
out_trade_no,
notify_url,
amount: { total, currency },
})
.then(({ data: { prepay_id: prepayid } }) => {
const noncestr = Formatter.nonce();
const timestamp = '' + Formatter.timestamp();
return {
appid,
partnerid,
prepayid,
noncestr,
timestamp,
package: 'Sign=WXPay',
sign: Rsa.sign(
Formatter.joinedByLineFeed(appid, timestamp, noncestr, prepayid),
merchantPrivateKeyInstance
)
}
})