Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

单页应用下微信支付(IOS可以,安卓失败)失败的坑,vue之类的路由注意了 #3

Open
hasbug opened this issue Sep 28, 2017 · 0 comments

Comments

@hasbug
Copy link
Owner

hasbug commented Sep 28, 2017

安卓和IOS在微信支付的时候,对于支付目录路径的识别是存在歧义的。具体文章大家可以参考这里:单页应用微信支付目录踩的坑
对于这个问题我的处理是通过url判断当前支付页面是否需要重新刷新(应付安卓兼容问题),大概代码(比较简单):

//刷新当前页面
      let urlArr = window.location.href.split('=');
      if(urlArr[2]){
        console.log(urlArr[2]);
      }else{
        //Toast('页面已经刷新');
        window.location.href = window.location.href+'&&refresh=true';
      }

今天不小心又踩了这个坑。
今日的支付地址大概如下:

https://wx.***.com/#/custom/pay?orderNo=15065813395614707

今天这个异常,是支付目录引起的,但在安卓下微信直接返回了“get_brand_wcpay_request:fail”,并没有URL未注册之类的提醒,根本无法知道什么情况。幸好最后让管理公众号的后端截图当前所设置的支付目录,才醒悟过来,支付目录需要设置到custom即可,问号之前的pay并不算是支付目录。

https://wx.***.com/#/custom

修改支付目录为:https://wx.***.com/#/custom/ 解决问题。

@hasbug hasbug changed the title 又踩了单页应用下微信支付(IOS可以,安卓失败)失败的坑 单页应用下微信支付(IOS可以,安卓失败)失败的坑,vue之类的路由注意了 Dec 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant