native-wechat icon indicating copy to clipboard operation
native-wechat copied to clipboard

await requestPayment(obj)没有返回支付信息

Open zhen-zhong opened this issue 1 year ago • 4 comments

作者你好,requestPayment微信支付条转到微信支付完之后,点击返回app,没有返回支付信息,不论是try还是catch都没有返回结果。请问,这是什么情况,是我哪里配置有问题吗?

zhen-zhong avatar Feb 01 '24 07:02 zhen-zhong

请提供出现此问题的所使用的的 React Native 版本、设备系统、与配置代码,以便我更好地排查。

Hector-Zhuang avatar Feb 01 '24 10:02 Hector-Zhuang

"react": "18.2.0", "react-native": "0.72.7", oppoA93 android12 支付成功后点击微信页面的返回按钮直接就返回app,也没有任何提示,该app已经上线了,所以是线上真实环境支付的。 image image image image

zhen-zhong avatar Feb 01 '24 13:02 zhen-zhong

很抱歉,由于工作调整,我目前没有微信支付相关参数调试此 issue,或你可向我邮箱发送联系方式,我会尽量帮助你解决。

Hector-Zhuang avatar Feb 02 '24 02:02 Hector-Zhuang

17638732656这是我的微信,我们可以在微信上讨论这个问题。 ---- 回复的原邮件 ---- | 发件人 | Héctor @.> | | 发送日期 | 2024年02月02日 10:11 | | 收件人 | Hector-Chong/native-wechat @.> | | 抄送人 | liyang @.>, Author @.> | | 主题 | Re: [Hector-Chong/native-wechat] await requestPayment(obj)没有返回支付信息 (Issue #31) |

很抱歉,由于工作调整,我目前没有微信支付相关参数调试此 issue,或你可向我邮箱发送联系方式,我会尽量帮助你解决。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zhen-zhong avatar Feb 02 '24 02:02 zhen-zhong

支付的回调与其他回调不同,是传给WXPayEntryActivity这个类的,所以需要在这个类做同样的消息处理操作。希望作者有时间处理一下。感谢作者提供这么棒的库。 image

fullahouse avatar Aug 30 '24 06:08 fullahouse

支付的回调与其他回调不同,是传给WXPayEntryActivity这个类的,所以需要在这个类做同样的消息处理操作。希望作者有时间处理一下。感谢作者提供这么棒的库。 image

很抱歉,最近工作比较繁忙,没有来得及查看 GitHub 上的消息。 我知道微信支付回调会调用 App 的 WXPayEntryActivity Activity,文档里有说明 WXPayEntryActivity 需要自己配置。

Hector-Zhuang avatar Sep 04 '24 14:09 Hector-Zhuang

文档里的WXPayEntryActivity 只是简单的finish掉了,就像提问者的截图所显示的那样,没有对支付回调的intent做处理,也就导致了reactnative层的requestPayment方法没有返回结果。 我参考WXEntryActivity做了如下修改,就可以正常收到返回结果了。

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class WXPayEntryActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        try {
          Intent intent = getIntent();
          Intent intentToBroadcast = new Intent();
    
          intentToBroadcast.setAction("com.hector.nativewechat.ACTION_REDIRECT_INTENT");
          intentToBroadcast.putExtra("intent", intent);
    
          sendBroadcast(intentToBroadcast);
    
          finish();
        } catch (Exception e) {
          e.printStackTrace();
        }
    }
}

fullahouse avatar Sep 04 '24 16:09 fullahouse

真的很感谢这么晚还在回复消息!这里文档确实有误,我已经更新上去了。不过,库的代码应该没有问题。

Hector-Zhuang avatar Sep 04 '24 16:09 Hector-Zhuang

我同时发现 Expo 模块的代码自动生成 WXPayEntryActivity 也缺少转发 intent 的部分,这个也修复好了。非常感谢提出这个 Bug。

Hector-Zhuang avatar Sep 04 '24 16:09 Hector-Zhuang