Home > Software engineering >  how to buy multiple products at once using the flutter in_app_purchase package
how to buy multiple products at once using the flutter in_app_purchase package

Time:01-14

I am using the flutter in_app_purchase package found here https://pub.dev/packages/in_app_purchase and have implemented it into my app according to the google code lab found here https://codelabs.developers.google.com/codelabs/flutter-in-app-purchases#0.

Problem:

I would like to have a user checkout with multiple non-consumable products at once. I am able to create a List<PurchaseParam> containing the products a user would like to checkout with but I am unable to find any functions in the in_app_purchase package that will allow me to handle multiple product payments at once.

Does anyone know of a way to use in_app_purchases to perform multiple purchases at once? (Looking for a function name or some reference material to get me on the right track).

Any help is greatly appreciated. Thank You!

CodePudding user response:

As of 13 January 2023, the in_app_purchase package does not provide an interface for purchasing multiple items at once (aside from quantity, in the case of purchasing multiple of the same item).

However, while I've not personally ever attempted this, it appears that perhaps, at least for iOS, you may be able to simply call buyNonConsumable() multiple times to add multiple products to the payment queue. Be aware that doing so will require the purchase UI and user confirmation for each individual item. I have no idea how this might be handled on Android.

References

  • Related