Cordova Plugin for iOS and Android to buy InApp payment subscriptions.
- Android 5+
- iOS 11+
To install the cordova plugin perform: 'cordova plugin add cordova-plugin-impac-inapppayment'
The plugin creates the object
window.plugins.impacInappPayment and is accessible after deviceready has been fired.
For iOS make sure to set the product ids. Make sure to do this as early as possible. It would be best to perfom it directly after deviceready.
After setting the ids you have to set the validation configuration for your server. The configurations expects a valid token, the url of the endpoint and a string for the authorizationType this could be "Bearer" or "Basic".
The purchase process is complete asynchron, therefor you need to listen to updates with onupdate.
Load the available products with getProductList. Make sure you've set the ids before in ios.
Before you buy a product make sure the user is entitled to purchase products and the app can communicate with the store.
To purchase a product perform buyProduct with the product id. If you want to upgrade or downgrade a subscription on android, make sure to also add the old sku. Otherwise you create a new subscrition.