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

Android集成Stripe+Backendless:支付成功但仪表盘无记录求助

Troubleshooting Stripe Charges Not Showing in Dashboard (Android + Backendless)

Hey there, let's break down why your charges aren't appearing in the Stripe dashboard even though your success callback fires. Here are actionable steps to diagnose the issue:

1. Double-Check the Amount Unit (Cents vs. Dollars)

Stripe requires the amount parameter to be in cents, not dollars. Looking at your code:

chargeParams.put("amount", price); // Amount in cents

But in your Android code, you're passing order.getOrder_price() directly to chargeItem.setPrice(). If order.getOrder_price() returns a dollar amount (e.g. 10 for $10), you're actually charging 10 cents instead of $10. Worse, if it's a decimal like 10.99, casting to int would truncate it to 10 cents—Stripe might reject this or create a charge so small you overlook it.

Fix this by converting the dollar amount to cents before sending it to the backend:

// Assuming order.getOrder_price() returns a double/float of dollars
chargeItem.setPrice((int) (order.getOrder_price() * 100));

2. Log Stripe Exceptions to Catch Hidden Errors

Your current catch block just returns false without logging what went wrong. Stripe throws very specific exceptions (e.g. invalid token, insufficient funds, wrong API key) that can tell you exactly why the charge failed. Update your Backendless service to log these details:

catch (StripeException e) {
    // Print the full error to Backendless logs (check Backendless console for this)
    e.printStackTrace();
    // Optional: Return the error message to your app for debugging
    // throw new RuntimeException(e.getMessage());
    return false;
}

Even if your callback says "success", it's possible the charge threw an exception but your code silently returned false—you just didn't see the error!

3. Verify You're Looking in the Correct Stripe Environment

Stripe has separate test and live dashboards. If you're using a test API key (sk_test_...), your charges will only show up in the test dashboard. If you accidentally checked the live dashboard, you won't see any test charges.

Double-check your Stripe.apiKey value to confirm which environment you're using.

4. Validate the Stripe Token

The token created by your Android app might be invalid or expired. To check:

  • In your Android onSuccess method, log the token ID (token.getId())
  • Go to your Stripe Test Dashboard > Test Data > Tokens and search for that token ID. If it doesn't exist, the token wasn't created properly.
  • You can also test the token directly using Stripe's API: run a POST request to https://api.stripe.com/v1/charges with your secret key, the token, and a valid amount. If this fails, the token is the issue.

5. Inspect the Created Charge Object

Your code discards the Charge object returned by Charge.create(). Save and log its details—this will tell you if the charge was actually created:

Charge charge = Charge.create(chargeParams);
// Log the charge ID and status (check Backendless logs for this)
System.out.println("Charge created: ID=" + charge.getId() + ", Status=" + charge.getStatus());

Then go to your Stripe dashboard and search for that charge ID. If it exists, you were just looking in the wrong place; if not, the charge never completed successfully.

6. Check Backendless Execution Logs

Backendless keeps logs of your service execution. Head to your Backendless Console > Manage > Logs and look for entries from your ChargeService.makeCharge method. You might find error messages or warnings that didn't bubble up to your app's callback.


内容的提问来源于stack exchange,提问作者Gadosey P.

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 03:51:36