相信大家在做小程序的时候不可避免的会碰到支付功能
小程序的支付和pc的是有区别的
小程序的支付方法为 wx.requestPayment

wx.requestPayment({
timeStamp: '', //时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间
nonceStr: '', //随机字符串,长度为32个字符以下
package: '', //统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=***
signType: 'MD5', //签名算法
paySign: '', //签名
success (res) {
console.log(msg, '成功')
},
fail (res) {
console.log(msg, '失败')
}
complete (msg) {
console.log(msg, '结束')
}
})

微信小程序支付、小程序支付功能、小程序支付方法、微信小程序支付方法-LMLPHP

一些必填的类型为string类型
在这里有些可能需要前端转换换一下格式
如:String(需要的字段)

05-25 19:34