I am new to this service and I like it, I want to make a simple purchase where I give users 200 coins for buying a consumable product. John(Hey-Flutter) from YouTube video covered it but the code he used is critically depreciated. also, the code he used to make purchases in Andriod is not the same one he used for iOS. please can someone show me how to do it as this will help many other people who watched his video but are stuck.
Page 1 / 1
Hey
Thank you for the kind words! In order to display consumable products to users, I’d recommend making a specific offering with your coin products inside of it, then fetching it specifically with something like this:
try {
Offerings offerings = await Purchases.getOfferings();
if (offerings.getOffering("coins").availablePackages.isNotEmpty) {
// Display packages within the coin offering for sale
}
} on PlatformException catch (e) {
// optional error handling
}
When your user is ready to purchase, you’ll then pass the package object to the SDK using `purchasePackage` in the same way that you would a subscription, just adapting based on if you have the coin products attached to an entitlement or not.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.