Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Cordova-plugin-purchase to do in-app purchase with ionic framework?

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.

like image 768
Roy Avatar asked Jul 23 '15 18:07

Roy


People also ask

Can I use ionic with Cordova?

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.

How do I add plugins to ionic project?

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 .


2 Answers

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

like image 50
beaver Avatar answered Nov 11 '22 05:11

beaver


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

like image 44
jeko Avatar answered Nov 11 '22 04:11

jeko