微信公众号实现微信支付(含前后端完整代码)

然后在页面中调用这个工具类就可以了,调用代码如下:

this.$wxPay(payInfo, function(res) {
          
   
								uni.setStorageSync(type, 1)
								uni.showToast({
          
   
									title: 支付成功!,
									duration: 3000
								})
								uni.reLaunch({
          
   
									url: ./xxx
								})
							}, function(e) {
          
   
								uni.showToast({
          
   
									title: 支付失败!,
									duration: 3000
								})
							})

我跳转到了另一个页面,在另一个页面判断type是否等于1,等于1时,修改对应用户表和订单日志表

后端接口代码如下: String appID = xxx; String mchID =xxx; //商户号 String appSecret = xxx; String key = “xxx”;

经验分享 程序员 微信小程序 职场和发展