wx.requestPayment fail 的 res 没有 异常码?

微信问答 文章 2021-12-07 11:40 637 0 全屏看文

AI助手支持GPT4.0

wx.requestPayment fail 的 res 没有 异常码?There is no exception code in res of wx.requestPayment fail?

wx.requestPayment fail 的 res 没有 异常码?

wx.requestPayment fail 的 res 只有errMsg, 没有 异常码, 如果区分一些不同错误场景做相应的了逻辑?

比如用户放弃支付,或者其他。总不能直接识别errMsg吧?errMsg是不太可靠的。

The res of wx.requestpayment fail only has errmsg and no exception code. If you distinguish some different error scenarios, do you make corresponding logic? For example, users give up payment, or others. Can't you directly identify errmsg? Errmsg is not very reliable.

鍥炵瓟锛�

Lv: Max Human:
支付我也特意确认了下没有errCode,各端取消的errMsg是一致的(安卓、ios、IDE),鸿蒙的没有手机不清楚。所以我改为这种了。手机号那个取消的errMsg各端都不一样。fail: err => {  if (err.errMsg === 'requestPayment:fail cancel') {    // dosomething  } else {    util.toast('支付失败,请稍后重试')  }    }
Memory:

由于前端交互复杂,用户取消或者支付失败可以统一处理为用户遇到错误或者主动放弃,不必细化区分。

xplee:

是这样的,参考一下JSAPI调起支付文档中的返回结果

https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_4.shtml

-EOF-

AI助手支持GPT4.0