gdx-pay icon indicating copy to clipboard operation
gdx-pay copied to clipboard

PurchaseManager does not support consumables and subscriptions at the same time.

Open xfwang515 opened this issue 3 years ago • 3 comments

List<Offer> offers = new ArrayList<>(); offers.add(new Offer().setType(OfferType.CONSUMABLE).setIdentifier(BuyCoinType.coins1.produceId)); offers.add(new Offer().setType(OfferType.CONSUMABLE).setIdentifier(BuyCoinType.coins2.produceId)); offers.add(new Offer().setType(OfferType.CONSUMABLE).setIdentifier(BuyCoinType.coins3.produceId));

offers.add(new Offer().setType(OfferType.SUBSCRIPTION).setIdentifier(BuyCoinType.weekly.produceId)); offers.add(new Offer().setType(OfferType.SUBSCRIPTION).setIdentifier(BuyCoinType.monthly.produceId)); offers.add(new Offer().setType(OfferType.SUBSCRIPTION).setIdentifier(BuyCoinType.yearly.produceId));

// throw new IllegalStateException("Cannot support OfferType Subscription and other types in the same app");

What should I do if there are both "consumables" and "subscriptions" in the game?

xfwang515 avatar Dec 25 '20 03:12 xfwang515

Either use two purchase managers, or for the repo, enhance the framework and open a PR contributing your changes.

MrStahlfelge avatar Dec 25 '20 09:12 MrStahlfelge

Its relatively easy to use two Purchase managers. I tried it with one of my apps last year and it works fine (and people on mobile seems to like subscriptions).

Anyway I think it should be reflected in the readme and wiki that you can not have both pay models with one Purchase Manager because here the readme suggest the opposite:

PurchaseManagerConfig pmc = new PurchaseManagerConfig();
pmc.addOffer(new Offer().setType(OfferType.ENTITLEMENT).setIdentifier(YOUR_ITEM_SKU));
pmc.addOffer(new Offer().setType(OfferType.CONSUMABLE).setIdentifier(YOUR_ITEM_SKU));
pmc.addOffer(new Offer().setType(OfferType.SUBSCRIPTION).setIdentifier(YOUR_ITEM_SKU));
// some payment services might need special parameters, see documentation
pmc.addStoreParam(storename, param)

Trurl101 avatar Aug 11 '21 11:08 Trurl101

If you have a good suggestion what to add where to the wiki, I'll be happy to add it!

MrStahlfelge avatar Aug 18 '21 07:08 MrStahlfelge