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

Flutterwave Rave Android支付集成测试异常及回调问题求助

Fixing Rave Payment Integration Issues on Android

Hey there, let's walk through the problems you're facing and get your Rave payment flow working as expected!

Issue 1: Test Card Payment Errors ("unable to retrieve transaction fees" + "only test cards are allowed")

Looking at your code, I spotted a critical mismatch between your environment setting and testing workflow:

  • You’re using test cards but have staging mode disabled: In your makePayment method, you set .onStagingEnv(false) — this switches the SDK to production mode, where test cards are explicitly blocked (which explains the Logcat message, despite the typo). Enable staging mode for testing:

    .onStagingEnv(true) // Set this to true for test environment
    
  • Transaction reference (txRef) contains spaces: Your current txRef includes a space between the email and UUID: txRef = email + " " + UUID.randomUUID().toString();. Spaces can cause unexpected parsing issues with payment gateways. Replace it with a non-space separator like underscores:

    txRef = email.replace(" ", "_") + "_" + UUID.randomUUID().toString();
    
  • Double-check test credentials: Ensure your PublicKey and EncryptionKey are the test versions (not production keys) from your Rave dashboard. Using production keys in staging mode will trigger validation errors.

Issue 2: Bank Payment Errors & Missing Success Callback

For the bank payment flow, here’s what to investigate:

  • Fix SDK version to resolve "parents_limit not defined": This error is often tied to outdated versions of the Rave Android SDK. Update your dependency to the latest stable version to patch this bug.

  • Don’t rely solely on onActivityResult for bank payments: Bank transfers are typically asynchronous — the user might complete the payment outside your app, so the onActivityResult callback might not fire even if the transaction succeeds in the dashboard. You need to:

    1. Set up a webhook URL in your Rave dashboard to receive real-time transaction status updates.
    2. Add a server-side check to verify the transaction status via Rave’s API when your app resumes, to confirm if the payment went through.
  • JSON format error: This is likely a side effect of the outdated SDK version mentioned above. Upgrading should resolve this parsing issue.

Final Revised makePayment Method

Here’s how your corrected method should look (with staging mode enabled and fixed txRef):

private void makePayment(int amount) {
    // Generate a valid, space-free transaction reference
    txRef = email.replace(" ", "_") + "_" + UUID.randomUUID().toString();
    try {
        fullname = mUsername.split(" ");
        fName = fullname[0];
        lName = fullname[1];
    } catch (NullPointerException ex) {
        ex.printStackTrace();
        // Fallback in case username doesn't have a space
        fName = mUsername;
        lName = "";
    }
    /* Create instance of RavePayManager */
    new RavePayManager(this).setAmount(amount)
            .setCountry(country)
            .setCurrency(currency)
            .setEmail(email)
            .setfName(fName)
            .setlName(lName)
            .setNarration(narration)
            .setPublicKey(RiiditUtilTool.getPublicKey())
            .setEncryptionKey(RiiditUtilTool.getEncryptionKey())
            .setTxRef(txRef)
            .acceptAccountPayments(true)
            .acceptCardPayments(true)
            .acceptMpesaPayments(false)
            .acceptGHMobileMoneyPayments(false)
            .onStagingEnv(true) // Enabled staging mode for testing
            .allowSaveCardFeature(true)
            .withTheme(R.style.DefaultTheme)
            .initialize();
}

Additional Checks

  • Verify that your test card matches your selected country (NG) and currency (NGN) — use test cards specified for Nigerian NGN transactions.
  • Ensure your app has proper internet permissions to communicate with Rave's servers.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 06:36:03