I have been struggling with the implementation of in-app purchase for both iOS and Andriod in ionic. I came across tutorials regarding both the cordova-plugin-purchase and the ng-storekit, but seems like the tutorials were based on the version 3.4.1 of cordova-plugin-purchase, and the latest version now has undergone huge modification that the code is no longer applicable. I tried following the demo and API guide on Cordova-plugin-purchase, but no luck. Even window.store
or window.storekit
returns false.
Has anyone work with the latest version of Cordova-plugin-purchase in Ionic and successfully implement IAP? Any working examples demonstrating the initialisation and the purchase flow? Thank you very much.
While developers can still use Cordova in the Ionic stack, the future is Ionic with Capacitor (or Capacitor on its own with any popular web stack!). These apps are known as Web Native apps, in contrast to the older hybrid approach.
First, log into the Ionic Hub, then navigate to the Native Plugins Keys page. Click Assign to App , then New App . Enter a name, then click Create App .
Maybe this brand new plugin (iOS/Android supported) could help you:
https://github.com/AlexDisler/cordova-plugin-inapppurchase
The author has written a recent post on his blog:
Add In App Purchases To Your Ionic Cordova App - Step By Step Guide With An Example App
and there is also a complete Ionic demo app on his Github repo:
https://github.com/AlexDisler/cordova-inapppurchases-app
If you only need iOS support, Fovea's purchase plugin maintained backward compatibility with its legacy API. If neither window.store nor window.storekit is defined, then you probably didn't install it properly.
The new API is very well documented, supported and provides a demo app here if you wan't try it easily: https://github.com/Fovea/cordova-plugin-purchase-demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With