libgdx/gdx-pay

Restored transactions array is empty.

IskanderNazarov opened this issue · 7 comments

Hi. I'm trying to restore the already bought transactions, I do the next steps

purchaseManager = ScreenManager.getInstance().getGame().purchaseManager;
PurchaseManagerConfig pmc = new PurchaseManagerConfig();
for (String id : IAP_Manager.inst.IDS()) {
   pmc.addOffer(new Offer().setType(OfferType.CONSUMABLE).setIdentifier(id));
}

 purchaseManager.install(this, pmc, true);

When purchase manager is installed I do this

@Override
public void handleInstall() {
     purchaseManager.purchaseRestore();
}

After this the next code works

@Override
public void handleRestore(Transaction[] transactions) {
     System.out.println("IAP__ restored count = " + transactions.length);
}

But in console it prints IAP__ restored count = 0, though I has made several purchases
Under iOS it works fine, but for android the restored count is always zero.

P.S.
For each market I use its own products ids.

Please state which Android IAP implementation you are using: googleplay, googlebilling or amazon? Are you using 11.3 or 11.4-SNAPSHOT?

I'm using googleplay, I assume.
This is what I have in my gradle file

implementation "com.badlogicgames.gdxpay:gdx-pay-android:$gdxPayVersion"
        implementation "com.badlogicgames.gdxpay:gdx-pay-android-googleplay:${gdxPayVersion}@aar"

where gdxPayVersion = '0.11.2'

Please try googlebilling implementation with v11.4-SNAPSHOT if it works better for you.

In any case, it is recommended not to call purchaseRestore on every install (see here)

I call purchasesRestore only for Android, this is ok, isn't it?

It is okay for Google, but you will not receive purchases if the user is offline and did not use your app for more than a week.

Thanks very much, everything works perfectly with googlebilling

Great to hear! 👍