New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cc.fovea.cordova.purchase

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cc.fovea.cordova.purchase - npm Package Compare versions

Comparing version 8.1.0 to 8.1.1

.github/FUNDING.yml

10

doc/api.md

@@ -362,2 +362,3 @@ # API Documentation

- `product.valid` - Product has been loaded and is a valid product
- when product definitions can't be loaded from the store, you should display instead a warning like: "You cannot make purchases at this stage. Try again in a moment. Make sure you didn't enable In-App-Purchases restrictions on your phone."
- `product.canPurchase` - Product is in a state where it can be purchased

@@ -691,5 +692,2 @@ - `product.owned` - Product is owned

As usual, you can unregister the callbacks by using [`store.off()`](#off).
## <a name="ready"></a>*store.ready(callback)*

@@ -815,8 +813,6 @@ Register the `callback` to be called when the store is ready to be used.

## <a name="refresh"></a>*store.manageSubscriptions()*
## <a name="manageSubscriptions"></a>*store.manageSubscriptions()*
(iOS only)
Opens the Manage Subscription page (AppStore, Play, Microsoft, ...).
Opens the Manage Subscription page in iTunes.
##### example usage

@@ -823,0 +819,0 @@

{
"name": "cc.fovea.cordova.purchase",
"version": "8.1.0",
"version": "8.1.1",
"description": "Cordova Purchase plugin for iOS, Android, Windows (AppStore, Play, UWP)",

@@ -5,0 +5,0 @@ "cordova": {

@@ -9,10 +9,16 @@ # Cordova Purchase Plugin

Need professional help and support? [Contact us](mailto:contact@fovea.cc)!
Need professional help and support? [Contact Me](mailto:hoelt@fovea.cc).
**Author**: Jean-Christophe Hoelt - <hoelt@fovea.cc>
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!
**Active Contributors**:
* [Patreon](https://www.patreon.com/join/2219243?)
* [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7A4826SH6RJSE&source=url)
* [Josef Fröhle](https://github.com/Dexus)
## Summary

@@ -26,11 +32,11 @@

| | ios | android | win-8 | win-10/uwp |
|--|--|--|--|--|
| consumables | ✅ | ✅ | ✅ | ✅ |
| non consumables | ✅ | ✅ | ✅ | ✅ |
| subscriptions | ✅ | ✅ | ✅ | ✅ |
| restore purchases | ✅ | ✅ | ✅ | ✅ |
| receipt validations | ✅ | ✅ | | ✅ |
| downloadable content | ✅ | | | |
| introductory prices | ✅ | ✅ | | |
| | ios | android | win-8 | win-10/uwp | mac |
|--|--|--|--|--|--|
| consumables | ✅ | ✅ | ✅ | ✅ | ✅ |
| non consumables | ✅ | ✅ | ✅ | ✅ | ✅ |
| subscriptions | ✅ | ✅ | ✅ | ✅ | ✅ |
| restore purchases | ✅ | ✅ | ✅ | ✅ | ✅ |
| receipt validations | ✅ | ✅ | | ✅ | ✅ |
| downloadable content | ✅ | | | | ✅ |
| introductory prices | ✅ | ✅ | | ✅ | ✅ |

@@ -44,2 +50,3 @@ ### Supported platforms

- **Windows 10 Mobile**
- **macOS** version 10
- **Xbox One**

@@ -51,3 +58,3 @@ - (and any platform supporting Microsoft's UWP)

### Install the plugin (cordova)
### Install the plugin (Cordova)

@@ -58,36 +65,83 @@ ```sh

`BILLING_KEY` is only required for Android. Check [here](https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO#add-android-billing-key) for details.
`BILLING_KEY` is only required for Android. Check [here](https://github.com/j3k0/cordova-plugin-purchase/wiki/Setup-for-Android-Google-Play#add-android-billing-key) for details.
### Install the plugin (PhoneGap)
Add the following to your `config.xml` file:
<details>
<summary>phonegap cli-7.1.0</summary>
```xml
<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="6.0.0">
<param name="BILLING_KEY" value="MIIB..."/>
</gap:plugin>
```
---
</details>
<details>
<summary>phonegap cli-8.0.0</summary>
```xml
<plugin spec="https://github.com/j3k0/cordova-plugin-purchase.git#phonegap-cli-8.0.0">
<param name="BILLING_KEY" value="MIIB..."/>
</plugin>
```
---
</details>
_`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 recommended plugins
If the plugin cannot connect to the app store because it has no network connection, it will retry either periodically after a certain amount of time, or in case the device fires an ['online'](https://developer.mozilla.org/en-US/docs/Web/Events/online) event.
In order for the 'online' event to be properly received in the Cordova application, the [cordova-plugin-network-information](https://github.com/apache/cordova-plugin-network-information) plugin is required as well. Without it, this plugin will only be able to use the periodic check to determine if the device is back online.
<details>
<summary>
Install <strong>cordova-plugin-network-information</strong> (click for details).
</summary>
### Setup your Application
See [Setup iOS Applications](https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO#setup-ios-applications) and [Setup Android Applications](https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO#setup-android-applications).
Sometimes, the plugin cannot connect to the app store because it has no network connection. It will then retry either:
## Extensions
* periodically after a certain amount of time;
* when the device fires an ['online'](https://developer.mozilla.org/en-US/docs/Web/Events/online) event.
* [Simple Non-Renewing Subscriptions](https://github.com/j3k0/cordova-non-renewing-subscription)
* The easiest way to integrate purchase into an app that only needs a non-renewing subscription.
The [cordova-plugin-network-information](https://github.com/apache/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.
</details>
### Setup your Application
See [Setup iOS Applications](https://github.com/j3k0/cordova-plugin-purchase/wiki/Setup-for-iOS-and-macOS#setup-ios-applications) and [Setup Android Applications](https://github.com/j3k0/cordova-plugin-purchase/wiki/Setup-for-Android-Google-Play#setup-android-applications).
## Getting Started
If you don't know much about In-App Purchases, you'll find a good introduction
on the subject here: [In-App Purchase Guidelines](https://developer.apple.com/in-app-purchase/).
It's from Apple, but the exact same concepts apply to Android.
If you don't know much about In-App Purchases, you'll find a good overview
on the subject from those guys:
You probably want to start by installing the plugin into your project.
This is documented in the [Setup Guide](https://github.com/j3k0/cordova-plugin-purchase/wiki/Setup)
* Apple:
* [In-App Purchase Introduction](https://developer.apple.com/in-app-purchase/)
* [Auto-Renewable Subscriptions](https://developer.apple.com/app-store/subscriptions)
* Google:
* [In-App Purchases Best Practices](https://developer.android.com/distribute/best-practices/earn/in-app-purchases)
* [Billing Overview](https://developer.android.com/google/play/billing/billing_overview)
* Microsoft
* [Monetize with In-App Purchases](https://docs.microsoft.com/en-us/windows/uwp/monetize/in-app-purchases-and-trials)
Once your project is setup properly, add the minimal initialization code in
your project and check that it works. You'll find a [Minimal Example Here](doc/minimal-example.js).
They all share the same concepts, so they are a good reads in all cases, with some advice that apply to all platforms.
Find a more [Complete Example Here](https://github.com/Fovea/cordova-plugin-purchase-demo).
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/
If you can't get things to work, go through the [Troubleshooting Checklist](doc/troubleshooting.md).
In short, you'll have two main tasks to accomplish:
You're all good? Time to read some more documentation. Hooray!
1. Setup your application and In-App Products on AppStore, Play or Azure platforms using their respective web interfaces.
2. Add In-App Purchase code to your application.
For setup, the [wiki](https://github.com/j3k0/cordova-plugin-purchase/wiki/Home) contains good information.
For the code itself, the [API Documentation](doc/api.md) is a definitely a recommended read.
## Documentation

@@ -103,9 +157,15 @@

### for iOS
### For iOS
- [Getting Started with In-App Purchase on iOS](https://developer.apple.com/in-app-purchase/)
- Read about the business models supported by In-App Purchase and the types of items you can sell in your app.
- [In-App Purchase Configuration Guide for iTunes Connect](https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/Introduction.html)
- Learn how to set up and manage In-App Purchases with iTunes Connect.
- [In-App Purchase Configuration Guide for AppStore Connect](https://developer.apple.com/support/app-store-connect/)
- Learn how to set up and manage In-App Purchases with AppStore Connect.
### Extensions
Have a very simple need? Maybe this will help.
* [Simple Non-Renewing Subscriptions](https://github.com/j3k0/cordova-non-renewing-subscription)
* The easiest way to integrate purchase into an app that only needs a non-renewing subscription.
# Contribute

@@ -117,4 +177,4 @@

* ![](https://avatars1.githubusercontent.com/u/191881?s=64&v=4) Jean-Christophe Hoelt, Author
* ![](https://avatars3.githubusercontent.com/u/1674289?s=64&v=4) Josef Fröhle, Support
* ![](https://avatars1.githubusercontent.com/u/191881?s=64&v=4) [Jean-Christophe Hoelt](https://github.com/j3k0), Author
* ![](https://avatars3.githubusercontent.com/u/1674289?s=64&v=4) [Josef Fröhle](https://github.com/Dexus), Support
* Guillaume Charhon, initial Android code

@@ -121,0 +181,0 @@ * Matt Kane, initial iOS code

@@ -93,6 +93,3 @@ (function() {

///
/// As usual, you can unregister the callbacks by using [`store.off()`](#off).
///
//
// Remove pending callbacks registered with `order`

@@ -99,0 +96,0 @@ store.order.unregister = function(cb) {

@@ -73,3 +73,3 @@ (function () {

if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
store.log.warn("plugin -> user owns a non-registered product: " + purchase.productId);
continue;

@@ -76,0 +76,0 @@ }

@@ -49,2 +49,3 @@ (function() {

});
retry(init);
},

@@ -60,2 +61,3 @@ {

store.inappbilling.getAvailableProducts(iabLoaded, function(err) {
retry(iabReady);
store.error({

@@ -247,2 +249,40 @@ code: store.ERR_LOAD,

//
// ## Retry failed requests
//
// When setup and/or load failed, the plugin will retry over and over till it can connect
// to the store.
//
// However, to be nice with the battery, it'll double the retry timeout each time.
//
// Special case, when the device goes online, it'll trigger all retry callback in the queue.
var retryTimeout = 5000;
var retries = [];
function retry(fn) {
var tid = setTimeout(function() {
retries = retries.filter(function(o) {
return tid !== o.tid;
});
fn();
}, retryTimeout);
retries.push({ tid: tid, fn: fn });
retryTimeout *= 2;
// Max out the waiting time to 2 minutes.
if (retryTimeout > 120000)
retryTimeout = 120000;
}
document.addEventListener("online", function() {
var a = retries;
retries = [];
retryTimeout = 5000;
for (var i = 0; i < a.length; ++i) {
clearTimeout(a[i].tid);
a[i].fn.call(this);
}
}, false);
})();

@@ -91,2 +91,3 @@ (function() {

/// - `product.valid` - Product has been loaded and is a valid product
/// - when product definitions can't be loaded from the store, you should display instead a warning like: "You cannot make purchases at this stage. Try again in a moment. Make sure you didn't enable In-App-Purchases restrictions on your phone."
this.valid = options.valid;

@@ -93,0 +94,0 @@

@@ -308,8 +308,6 @@ /// ### Philosophy

///
/// ## <a name="refresh"></a>*store.manageSubscriptions()*
/// ## <a name="manageSubscriptions"></a>*store.manageSubscriptions()*
///
/// (iOS only)
/// Opens the Manage Subscription page (AppStore, Play, Microsoft, ...).
///
/// Opens the Manage Subscription page in iTunes.
///
/// ##### example usage

@@ -316,0 +314,0 @@ ///

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc