支付爬坑记录之微擎

1 篇文章 0 订阅
1 篇文章 0 订阅

支付回调问题

采用方式,用微擎js函数库调用微信和支付宝支付

	util.pay({ 
		orderFee : 0.01, 
		payMethod : 'alipay', //微信支付(wechat)、百度钱包(baifubao)、支付宝(alipay)、银联支付(unionpay)
		orderTitle : '充值10元',
 		orderTid : 1234567104,
  		module : 'recharge', 
  		success : function(res) { 
  			alert('支付成功'); },
   		fail : function(result) { 
   			alert('fail : ' + result.message);
    	}, complete : function(result) {
     		alert('complete : ' + result.message);
      	}
      }); 

支付完成后会走微擎payResult( $ params){}方法。问题就出在参数 $ params中,他有两种参数返回。

  • . {"weid":null,"uniacid":"2","acid":"2","result":"success","type":"wechat","from":"notify","tid":"SN20091152009115","uniontid":"202009112020200911202020091120","transaction_id":null,"trade_type":"JSAPI","follow":0,"user":"oRkO-533Prc4A533Prc4A","fee":"66.00","tag":{"acid":2,"uid":"2406","transaction_id":"4200000420000042000004200000"},"is_usecard":"0","card_type":"0","card_fee":"66.00","card_id":"","paytime":1599827016} 详细的支付数据返回。
  • . {"tid":"SN20091152009115","result":"success","from":"return"} 简单数据返回

注意:

  • 通常判断result返回值两者都是success成功,但是from返回值两者是不同的,1. return ,2. notify。
  • 同时进行兼容
js文件引入说明
  1. 在这里插入图片描述
  2. 在这里插入图片描述
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值