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

Google Play订阅支付成功却未返回购买数据与签名的调试求助

Troubleshooting Missing Purchase Data & Signature After Successful Google Play Beta Payment

Hey there, let's break down why you're seeing "Payment successful" but not getting the purchase data and signature in your app. Based on the code snippets you shared, here are the key areas to check and fix:

1. Critical: Wrong Item Type for Subscriptions

Looking at your custom launchPurchaseFlow method, you're using ITEM_TYPE_INAPP when calling getBuyIntent:

Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, ITEM_TYPE_INAPP, extraData);

But your SKU zoomlee_family_y looks like a yearly subscription (the _y suffix). Subscriptions require ITEM_TYPE_SUBS instead of ITEM_TYPE_INAPP. Using the wrong type can cause the purchase flow to complete but fail to return valid purchase data/signature.

Fix this line to:

Bundle buyIntentBundle = mService.getBuyIntent(3, mContext.getPackageName(), sku, ITEM_TYPE_SUBS, extraData);

2. Ensure onActivityResult Forwards to IabHelper

The IabHelper relies on onActivityResult to receive the purchase result from Google Play. If you haven't implemented this, the callback won't fire properly. Add this to your Activity:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // Let IabHelper handle the result first
    if (!billingHelper.handleActivityResult(requestCode, resultCode, data)) {
        // If not handled, pass to super class
        super.onActivityResult(requestCode, resultCode, data);
    }
}

3. Verify Your OnIabPurchaseFinishedListener Implementation

You're passing this as the listener to launchPurchaseFlow, so your Activity should implement OnIabPurchaseFinishedListener. Make sure your onIabPurchaseFinished method properly captures the purchase data:

@Override
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
    if (result.isFailure()) {
        Log.e("IAB_DEBUG", "Purchase failed: " + result.getMessage());
        return;
    }

    // Check if the purchase matches your subscription SKU
    if (PRO_MONTH_SKU.equals(purchase.getSku())) {
        // Extract purchase data and signature here
        String purchaseJson = purchase.getOriginalJson();
        String purchaseSignature = purchase.getSignature();
        
        Log.d("IAB_DEBUG", "Purchase Data: " + purchaseJson);
        Log.d("IAB_DEBUG", "Purchase Signature: " + purchaseSignature);
        
        // Add your validation logic (local or server-side) here
        applySubscriptionState(); // Update your app's subscription state
    }
}

4. Check RSA Key Validity

Ensure the rsa_key you're using is the public key copied directly from your Google Play Console (under Monetization > Products > Subscriptions > App signing). Double-check for extra spaces, line breaks, or missing characters—even a tiny typo can break signature verification and data retrieval.

5. Validate Beta Test Setup

  • Make sure your test account is added to the Beta testers list in Google Play Console, and you've accepted the test invitation via the opt-in link.
  • If you're using a closed Beta, unlisted accounts won't get proper purchase callbacks even if payment goes through.

6. Avoid Prematurely Disposing IabHelper

Your disposeBillingHelper method should only be called when your Activity is being destroyed (in onDestroy), not in onResume or other lifecycle methods that might run before the purchase callback fires. Add this to your Activity:

@Override
protected void onDestroy() {
    super.onDestroy();
    disposeBillingHelper();
    EventBus.getDefault().unregister(this); // Don't forget to unregister EventBus!
}

7. Dig Into Logs

Filter your Logcat for tags like IAB_DEBUG, Loadsuccess, and whichfirst to check:

  • Is onIabSetupFinished actually firing with a success result?
  • Is onIabPurchaseFinished being called at all? If yes, what does the result message say?
  • Are there any error messages from the IabHelper about failed intent retrieval or response codes?

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 04:02:54