You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Razorpay支付网关钱包支付完成后无法返回原应用问题求助

RazorPay Android SDK 钱包支付完成后无法返回应用解决方案

核心问题排查与修复步骤:

  • 检查回调方法拼写是否正确
    你代码中提到的onFailour为拼写错误,PaymentResultWithDataListener接口的回调方法标准名为onSuccess和onFailure,拼写错误会导致SDK无法识别回调实现,无法触发后续逻辑。
  • 检查AndroidManifest.xml配置是否完整
    钱包支付依赖DeepLink完成跳转回调,需正确配置CheckoutActivity的intent-filter,示例如下:
    <activity
        android:name="com.razorpay.CheckoutActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:exported="true"
        android:theme="@style/CheckoutTheme">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:host="rzp.io"
                android:scheme="https" />
            <!-- scheme值需替换为你在RazorPay商户后台绑定的应用专属标识,通常为应用包名 -->
            <data
                android:host="payment"
                android:scheme="your_app_package" />
        </intent-filter>
    </activity>
    
    同时注意如果你的支付页面Activity设置了singleTask/singleInstance等特殊launchMode,需要重写onNewIntent方法,将接收到的回调Intent传递给RazorPay SDK处理:
    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
    }
    
  • 检查混淆配置是否正确
    若开启了代码混淆,需在proguard-rules.pro中添加RazorPay专属混淆规则,避免SDK相关类和回调方法被混淆删除:
    -keepclassmembers class * {
        @android.webkit.JavascriptInterface <methods>;
    }
    -keepattributes JavascriptInterface
    -keepattributes *Annotation*
    -dontwarn com.razorpay.**
    -keep class com.razorpay.** {*;}
    -optimizations !method/inlining/*
    -keepclasseswithmembers class * {
      public void onPayment*(...);
    }
    
  • 排查钱包应用版本问题
    部分非正式版、修改版的PhonePe、GPay应用未实现标准的支付回调跳转逻辑,可更换官方正式版钱包复测。

内容的提问来源于stack exchange,提问作者Ranjit

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 01:27:06