android-inapp-billing-v3 icon indicating copy to clipboard operation
android-inapp-billing-v3 copied to clipboard

Purchases are not loaded on other devices

Open ghost opened this issue 6 years ago • 3 comments

Report a bug.

What is the current behavior?

The application has 5 buttons of payment, method "purchase" and I am having complaints that the purchases do not load themselves after changing the device.

Example:

1.- Client downloads the application and purchases the full version. 2.- Client changes the device with the same gpay account. 3.- Client downloads the application in the new device. The previous payment is not restored. With what the client must buy again.

Don't forget to mention:

  • which version of library you use: v1.0.44
  • was it working in previous versions? Use this version from the beginning.
  • do you use fragments or not: no.
  • how do you instanciate BillingProcessor (singleton or not): Use the attached example exactly, just edit the "updateTextViews". Example:

` private void updateTextViews() {

    if (bp.isPurchased(PRODUCT_ID)) {
        btnBuyAds.setEnabled(false);
        mAdView.setVisibility(View.GONE);
        if (!btnBuyAds.isEnabled() || !btnBuyList.isEnabled() || !btnBuyMassive.isEnabled() || !btnBuySLList.isEnabled()){
            btnBuyFull.setEnabled(false);
        }
    }

}`

  • which device/OS version do you use for testing (or its an emulator): Emulador y: Nexus 6P (Android 8.1.0) Xiaomi Mi A2 (Android 8.1.0) Samsung Grand Prime (Android 5.1) Asus ZenPad (Android 5.1) Asus ZenPhone2 (Android 6.0.1)

  • have you uploaded it to Google Play or not (if yes, when which channel: Prod/Beta/Alpha): Yes, Prod.

  • do you test with real products, or with a testing onces (e.g. android.test.purchased): Real products.

ghost avatar Nov 22 '18 04:11 ghost

any update?

dogukankse avatar Dec 19 '18 21:12 dogukankse

@KRIPT4 I assume that you are talking about Non-Consumable managed in-app product. In that case did you tried checking the purchase status against your products in the following method like,

    /*
    * Called when purchase history was restored and the list of all owned PRODUCT ID's 
    * was loaded from Google Play
    */
 @Override
  public void onPurchaseHistoryRestored() {
   checkPurchases();
  }

  /*
    * Called when BillingProcessor was initialized and it's ready to purchase 
    */
 @Override
  public void onBillingInitialized() {
   checkPurchases();
  }

private void checkPurchases() {
  if (bp.loadOwnedPurchasesFromGoogle()) {
                final List<String> ownedProducts = bp.listOwnedProducts();
                for (String product : ownedProducts) {
                    if (product.equalsIgnoreCase(PRODUCT_ID)) {
                            setUnlockedVersion(true); // purchase found
                            return;
                                       }
                }

              setUnlockedVersion(false); // no purchase found
}

Also, if everything done right, user cannot purchase same the non-consumable product again. They will get an error "Product Already Owned". Take a look at that. If anything else reply, I will try to do my best...

jpvs0101 avatar Dec 20 '18 06:12 jpvs0101

@jpvs0101 I have the same issue. Bought an in app purchase managed product (one time) on one device, it's not loaded on the other. I debugged into your library and found that it's not being returned by billingService.getPurchases. EDIT: After restarting the device and after clearing the play services cache (completely) I showed up. NOT on the first try but after a few minutes after re trying. Strange.

DennyWeinberg avatar Jul 04 '19 19:07 DennyWeinberg