APP下单
商户系统先调用该接口在微信支付服务后台生成预支付交易单,返回正确的预支付交易会话标识后再在APP里面调起支付。 官方文档
js
const { Formatter, Rsa } = require('wechatpay-axios-plugin')
wxpay.v3.pay.transactions.app.post({
mchid,
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
)
}
})