This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
cc.fovea.cordova.purchase with all
npm packages installed. Try it out:
cc.fovea.cordova.purchase lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
In-App Purchases for Cordova
Need professional help and support? Contact Me.
I dedicate a considerable amount of my free time to developing and maintaining this Cordova plugin, along with my other Open Source software. To help ensure this plugin is kept updated, new features are added and bugfixes are implemented quickly, please donate a couple of dollars (or a little more if you can stretch) as this will help me to afford to dedicate time to its maintenance. Please consider donating if you're using this plugin in an app that makes you money, if you're being paid to make the app, if you're asking for new features or priority bug fixes. Thank you!
This plugin allows In-App Purchases to be made from Cordova, PhoneGap and Ionic applications.
It lets you handle in-app purchases on many platforms with a single codebase.
cordova plugin add cordova-plugin-purchase [--variable BILLING_KEY="<BILLING_KEY>"]
BILLING_KEY is only required for Android. Check here for details.
Add the following to your
<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="6.0.0"> <param name="BILLING_KEY" value="MIIB..."/> </gap:plugin>
<plugin spec="https://github.com/j3k0/cordova-plugin-purchase.git#phonegap-cli-8.0.0"> <param name="BILLING_KEY" value="MIIB..."/> </plugin>
phonegap-cli-8.1.1 is not supported if you need Android, because it ships with a buggy
cordova-android version (
7.1.2) that doesn't allow installation of .aidl files. If you don't need android, you can use the latest version of the plugin.
Install cordova-plugin-network-information (click for details).
Sometimes, the plugin cannot connect to the app store because it has no network connection. It will then retry either:
The cordova-plugin-network-information plugin is required in order for the
'online' event to be properly received in the Cordova application. Without it, this plugin will only be able to use the periodic check to determine if the device is back online.
If you don't know much about In-App Purchases, you'll find a good overview on the subject from those guys:
They all share the same concepts, so they are a good reads in all cases, with some advice that apply to all platforms.
To ease the beggining of your journey into the intimidating world of In-App Purchase with Cordova, we wrote a guide which hopefully will help you get things done: https://purchase.cordova.fovea.cc/
In short, you'll have two main tasks to accomplish:
For setup, the wiki contains good information.
For the code itself, the API Documentation is a definitely a recommended read.
Have a very simple need? Maybe this will help.
The MIT License
Copyright (c) 2014-2019, Jean-Christophe Hoelt and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.