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
1
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 4.1.0 to 5.0.0

setenv

27

doc/api.md

@@ -264,3 +264,10 @@ # API Documentation

See the [logging levels](#logging-levels) constants.
## <a name="sandbox"></a>*store.sandbox*
The `sandbox` property defines if you want to invoke the platform purchase sandbox
- Windows will use the IAP simulator if true (see Windows docs)
- Android: NOT IN USE
- iOS: NOT IN USE
## Constants

@@ -271,6 +278,7 @@

store.FREE_SUBSCRIPTION = "free subscription";
store.PAID_SUBSCRIPTION = "paid subscription";
store.CONSUMABLE = "consumable";
store.NON_CONSUMABLE = "non consumable";
store.FREE_SUBSCRIPTION = "free subscription";
store.PAID_SUBSCRIPTION = "paid subscription";
store.NON_RENEWING_SUBSCRIPTION = "non renewing subscription";
store.CONSUMABLE = "consumable";
store.NON_CONSUMABLE = "non consumable";

@@ -438,2 +446,3 @@ ### error codes

- During application startup, products may go instantly from `REGISTERED` to `APPROVED` or `OWNED`, for example if they are purchased non-consumables or non-expired subscriptions.
- Non-Renewing Subscriptions are iOS products only. Please see the [iOS Non Renewing Subscriptions documentation](https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/ios.md#non-renewing) for a detailed explanation.

@@ -772,2 +781,12 @@ #### state changes

##### restore purchases example usage
Add a "Refresh Purchases" button to call the `store.refresh()` method, like:
`<button onclick="store.refresh()">Restore Purchases</button>`
To make the restore purchases work as expected, please make sure that
the "approved" event listener had be registered properly,
and in the callback `product.finish()` should be called.
## *store.log* object

@@ -774,0 +793,0 @@ ### `store.log.error(message)`

@@ -70,1 +70,88 @@ # iOS Configuration

- Edit [www/index.js](https://github.com/dpa99c/cordova-plugin-purchase-demo/blob/master/www/js/index.js) and set the `id` fields under `store.register` are for your IAP Identifiers.
### <a name="non-renewing"></a>Non-Renewing iOS Subscriptions
iOS has a special product type called Non-Renewing Subscriptions. You use this when you want something subscription based, but don't want Apple to auto-renew and manage your subscriptions. This means that the burden is on you, the developer, to manually implement necessary functionality like syncing between devices, prompting for renewals, etc. Apple will verify this functionality during the AppStore review process and reject your app if it does not implement this.
Anecdotally, non-renewing subscriptions are easier to implement and test than auto-renewing subscriptions, because you don't need to deal with receipt validation or wait hours for test subscriptions to expire. You also have more flexibility on subscription time periods than the limited options of auto-renewing subscriptions.
Although non-renewing subscriptions are officially subscriptions, you can think of them like consumable products, that you can purchase repeatedly during development and testing.
Key things to remember are:
- You must prompt the user to renew when a subscription is about to expire. This isn't required by Apple, this is simply good business sense. Otherwise, users will have a gap between their subscription expiring and when they renew.
- If a user purchases a new subscription before the existing has expired, you must add additional time to their subscription. For instance, if they purchase a year's subscription, then after 10 months they purchase another one, the subscription must now have 14 months remaining. This is required by Apple.
- You must sync between all devices using the same Apple ID. Alternatively, if your app has a custom authentication mechanism that is not tied to an Apple ID, you must sync between all devices that login using your custom authentication. You must provide testing credentials to Apple during the AppStore review process so they can verify this. This is required by Apple.
Please read the [Apple Documentation](https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html) for official information.
What follows is an example of how to implement non-renewing subscriptions in your JavaScript code. Remember, this is iOS only. When registering your product, use `store.NON_RENEWING_SUBSCRIPTION`.
This is made more difficult because non-renewing subscriptions always receive a series of lifecycle events everytime the app is started, which requires you to implement more code to handle various edge cases. Necessary helper functions you need to write are explained in the example below, called on a hypothetical `my_app_utils` class which contains a persistent state that lasts even if the app is killed, such as with HTML5 Local Storage.
This full body of code, which registers all necessary handlers and refreshes the `store`, must be executed every time the app starts.
```javascript
// Register the non-renewing subscription product with the store. You must
// create this in iTunes Connect.
store.register({
id: "my_product_id",
alias: "My Product",
type: store.NON_RENEWING_SUBSCRIPTION
});
// Called when store.order("my_product_id") is executed. The user can
// still cancel after this has been called.
store.when("my_product_id").initiated(function(p) {
// Write a function that identifies this product ID as having been
// initiated to purchase.
my_app_utils.setIsProductPurchaseInitiated("my_product_id", true);
});
// Called when the user has cancelled purchasing the product, after it has
// been initiated.
store.when("my_product_id").cancelled(function(p) {
// Write a function that marks this product ID as not being purchased
my_app_utils.setIsProductPurchaseInitiated("my_product_id", false);
});
// Purchase has been executed successfully. Must call finish to charge the user
// and put the product into the owned state.
store.when("my_product_id").approved(function(p) {
p.finish();
});
// Called when the product purchase is finished. This gets called every time
// the app starts after the product has been purchased, so we use a helper
// function to determine if we actually need to purchase the non-renewing
// subscription on our own server.
store.when("my_product_id").owned(function(p) {
if (my_app_utils.getIsProductPurchaseInitiated("my_product_id")) {
// Prevent another upgrade from happening
my_app_utils.setIsProductPurchaseInitiated("my_product_id", false);
// All necessary logic to purchase the product, such as talking
// to your server, changing the UI, etc.
my_app_utils.purchaseNonRenewingSubscription('my_product_id');
}
else {
console.log("my_product_id purchase NOT initiated, NOT upgrading!");
}
});
// Errors communicating with the iTunes server happen quite often,
// so it's highly recommended you implement some feedback to the user.
store.error(function(e){
console.log("storekit ERROR " + e.code + ": " + e.message);
my_app_utils.alertUserAboutITunesError({
title: 'Subscription Purchase Error',
template: 'We could not reach the Apple iTunes ordering server. ' +
'Please ensure you are connected to the Internet and try ' +
'again.'
});
});
// Refresh the store to start everything
store.refresh();
```

43

doc/windows.md

@@ -8,11 +8,4 @@ # Windows (Store/Phone 8.1) Configuration

```
store.inappbilling.setTestMode(); //Don't call this in production
//Optionally add callbacks
store.inappbilling.setTestMode(function() {
//successfully loaded test data
},
function() {
//failed to load test data
});
//call this before store.refresh
store.sandbox = true; //Don't call this in production
```

@@ -47,2 +40,18 @@

</Product>
<Product ProductId="durable1" ProductType="Durable">
<MarketData xml:lang="en-us">
<Name>Durable test (purchased)</Name>
<Price>9.99</Price>
<CurrencySymbol>$</CurrencySymbol>
<CurrencyCode>USD</CurrencyCode>
</MarketData>
</Product>
<Product ProductId="durable2" ProductType="Durable">
<MarketData xml:lang="en-us">
<Name>Durable test (not purchased)</Name>
<Price>9.99</Price>
<CurrencySymbol>$</CurrencySymbol>
<CurrencyCode>USD</CurrencyCode>
</MarketData>
</Product>
</ListingInformation>

@@ -54,2 +63,6 @@ <LicenseInformation>

</App>
<!-- Setting a prepurchased durable -->
<Product ProductId="durable1">
<IsActive>true</IsActive>
</Product>
</LicenseInformation>

@@ -70,1 +83,13 @@ </CurrentApp>

```
## Using the plugin with Visual Studio tools for Cordova
After adding the plugin to the config.xml in Visual Studio. If you receive an error about a missing `BILLING_KEY` parameter.
Add the following into your config.xml
```
<vs:plugin name="cc.fovea.cordova.purchase" version="4.0.0" src="https://github.com/j3k0/cordova-plugin-purchase.git">
<param name="BILLING_KEY" value="YOUR GOOGLE BILLING KEY HERE TO TARGET ANDROID" />
</vs:plugin>
```
{
"name": "cc.fovea.cordova.purchase",
"version": "4.1.0",
"version": "5.0.0",
"description": "Cordova Purchase plugin for iOS and Android (AppStore and PlayStore)",

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

@@ -11,6 +11,7 @@ (function(){

///
/*///*/ store.FREE_SUBSCRIPTION = "free subscription";
/*///*/ store.PAID_SUBSCRIPTION = "paid subscription";
/*///*/ store.CONSUMABLE = "consumable";
/*///*/ store.NON_CONSUMABLE = "non consumable";
/*///*/ store.FREE_SUBSCRIPTION = "free subscription";
/*///*/ store.PAID_SUBSCRIPTION = "paid subscription";
/*///*/ store.NON_RENEWING_SUBSCRIPTION = "non renewing subscription";
/*///*/ store.CONSUMABLE = "consumable";
/*///*/ store.NON_CONSUMABLE = "non consumable";

@@ -17,0 +18,0 @@ ///

@@ -42,10 +42,8 @@ (function(){

if (cb instanceof store.Error)
if (cb instanceof store.Error) {
store.error.callbacks.trigger(cb);
else if (cb.code && cb.message)
store.error.callbacks.trigger(new store.Error(cb));
else if (typeof cb === "function")
}
else if (typeof cb === "function") {
store.error.callbacks.push(cb);
}

@@ -64,2 +62,9 @@ /// ### alternative usage

}
else if (cb.code && cb.message) {
store.error.callbacks.trigger(new store.Error(cb));
}
else if (cb.code) {
// error message is null(unknown error)
store.error.callbacks.trigger(new store.Error(cb));
}
///

@@ -66,0 +71,0 @@

@@ -51,2 +51,38 @@ (function () {

store.iabGetPurchases = function() {
store.inappbilling.getPurchases(
function(purchases) { // success
// example purchases data:
//
// [
// {
// "purchaseToken":"tokenabc",
// "developerPayload":"mypayload1",
// "packageName":"com.example.MyPackage",
// "purchaseState":0,
// "orderId":"12345.6789",
// "purchaseTime":1382517909216,
// "productId":"example_subscription"
// },
// { ... }
// ]
if (purchases && purchases.length) {
for (var i = 0; i < purchases.length; ++i) {
var purchase = purchases[i];
var p = store.get(purchase.productId);
if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
continue;
}
store.setProductData(p, purchase);
}
}
store.ready(true);
},
function() { // error
// TODO
}
);
};
})();

@@ -59,5 +59,9 @@ /*global storekit */

function storekitFinish(product) {
if (product.type === store.CONSUMABLE) {
if (product.transaction.id)
if (product.type === store.CONSUMABLE || product.type === store.NON_RENEWING_SUBSCRIPTION) {
if (product.transaction && product.transaction.id) {
storekit.finish(product.transaction.id);
}
else {
store.log.debug("ios -> error: unable to find transaction for " + product.id);
}
}

@@ -64,0 +68,0 @@ else if (product.transactions) {

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

store.when("re-refreshed", function() {
iabGetPurchases();
store.iabGetPurchases();
});

@@ -94,42 +94,5 @@

iabGetPurchases();
store.iabGetPurchases();
}
function iabGetPurchases() {
store.inappbilling.getPurchases(
function(purchases) { // success
// example purchases data:
//
// [
// {
// "purchaseToken":"tokenabc",
// "developerPayload":"mypayload1",
// "packageName":"com.example.MyPackage",
// "purchaseState":0,
// "orderId":"12345.6789",
// "purchaseTime":1382517909216,
// "productId":"example_subscription"
// },
// { ... }
// ]
if (purchases && purchases.length) {
for (var i = 0; i < purchases.length; ++i) {
var purchase = purchases[i];
var p = store.get(purchase.productId);
if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
continue;
}
store.setProductData(p, purchase);
}
}
store.ready(true);
},
function() { // error
// TODO
}
);
}
store.when("requested", function(product) {

@@ -136,0 +99,0 @@ store.ready(function() {

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

expirationDate: license.expirationDate,
isConsumable: license.isConsumable,
isActive: license.isActive

@@ -106,2 +105,19 @@ };

store.iabGetPurchases = function() {
store.inappbilling.getPurchases(function(purchases) {
if (purchases && purchases.length) {
for (var i = 0; i < purchases.length; ++i) {
var purchase = purchases[i];
var p = store.get(purchase.license.productId);
if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
continue;
}
store.setProductData(p, purchase);
}
}
store.ready(true);
}, function() {});
};
})();

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

var type = this.type = options.type || null;
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION)
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION && type !== store.NON_RENEWING_SUBSCRIPTION)
throw new TypeError("Invalid product type");

@@ -286,2 +286,3 @@

/// - During application startup, products may go instantly from `REGISTERED` to `APPROVED` or `OWNED`, for example if they are purchased non-consumables or non-expired subscriptions.
/// - Non-Renewing Subscriptions are iOS products only. Please see the [iOS Non Renewing Subscriptions documentation](https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/ios.md#non-renewing) for a detailed explanation.
///

@@ -288,0 +289,0 @@ /// #### state changes

@@ -33,2 +33,12 @@ (function() {

///
/// ##### restore purchases example usage
///
/// Add a "Refresh Purchases" button to call the `store.refresh()` method, like:
///
/// `<button onclick="store.refresh()">Restore Purchases</button>`
///
/// To make the restore purchases work as expected, please make sure that
/// the "approved" event listener had be registered properly,
/// and in the callback `product.finish()` should be called.
///

@@ -35,0 +45,0 @@ var initialRefresh = true;

@@ -284,2 +284,11 @@ /// ### Philosophy

/// ## <a name="sandbox"></a>*store.sandbox*
///
/// The `sandbox` property defines if you want to invoke the platform purchase sandbox
///
/// - Windows will use the IAP simulator if true (see Windows docs)
/// - Android: NOT IN USE
/// - iOS: NOT IN USE
store.sandbox = false;
// #include "constants.js"

@@ -286,0 +295,0 @@ // #include "product.js"

var cordova = require('cordova');
module.exports = {
setTestMode: function(win, fail, args){
//switch between live and similator mode for IAP testing
this.currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
Windows.ApplicationModel.Package.current.installedLocation.getFolderAsync("www").done(
function (folder) {
folder.getFileAsync("in-app-purchase.xml").done(
function (file) {
console.log("got the xml file for currentAppSimulator", file);
this.currentApp.reloadSimulatorAsync(file).done(
function () {
// Get the license info
this.productLicenses = this.currentApp.licenseInformation.productLicenses;
if (this.currentApp && this.productLicenses) {
console.log("loaded xml file");
win();
} else {
console.log("failed xml file");
fail();
}
}.bind(this),
function (err) {
console.log("This is still not working!!");
console.log(err);
var setTestMode = function (win, fail, args) {
//switch between live and similator mode for IAP testing
this.currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator;
Windows.ApplicationModel.Package.current.installedLocation.getFolderAsync("www").done(
function (folder) {
folder.getFileAsync("in-app-purchase.xml").done(
function (file) {
console.log("got the xml file for currentAppSimulator", file);
this.currentApp.reloadSimulatorAsync(file).done(
function () {
// Get the license info
this.productLicenses = this.currentApp.licenseInformation.productLicenses;
if (this.currentApp && this.productLicenses) {
console.log("loaded xml file");
win(true);
} else {
console.log("failed xml file");
fail();
}
);
}.bind(this));
}.bind(this)
);
},
}.bind(this),
function (err) {
console.log("error loading Windows IAP simulator");
console.log(err);
fail();
}
);
}.bind(this));
}.bind(this)
);
};
module.exports = {
init: function (win, fail, args) {
if (store && store.sandbox){
setTestMode(win, fail, args);
return;
}
if (!this.currentApp){

@@ -37,0 +42,0 @@ this.currentApp = Windows.ApplicationModel.Store.CurrentApp;

@@ -5,2 +5,4 @@ var store = {};

store.sandbox = false;
(function() {

@@ -10,2 +12,3 @@ "use strict";

store.PAID_SUBSCRIPTION = "paid subscription";
store.NON_RENEWING_SUBSCRIPTION = "non renewing subscription";
store.CONSUMABLE = "consumable";

@@ -67,3 +70,3 @@ store.NON_CONSUMABLE = "non consumable";

var type = this.type = options.type || null;
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION) throw new TypeError("Invalid product type");
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION && type !== store.NON_RENEWING_SUBSCRIPTION) throw new TypeError("Invalid product type");
this.state = options.state || "";

@@ -193,3 +196,7 @@ this.title = options.title || options.localizedTitle || null;

var ret = cb;
if (cb instanceof store.Error) store.error.callbacks.trigger(cb); else if (cb.code && cb.message) store.error.callbacks.trigger(new store.Error(cb)); else if (typeof cb === "function") store.error.callbacks.push(cb); else if (typeof altCb === "function") {
if (cb instanceof store.Error) {
store.error.callbacks.trigger(cb);
} else if (typeof cb === "function") {
store.error.callbacks.push(cb);
} else if (typeof altCb === "function") {
ret = function(err) {

@@ -199,2 +206,6 @@ if (err.code === cb) altCb();

store.error(ret);
} else if (cb.code && cb.message) {
store.error.callbacks.trigger(new store.Error(cb));
} else if (cb.code) {
store.error.callbacks.trigger(new store.Error(cb));
}

@@ -864,3 +875,3 @@ return ret;

store.when("re-refreshed", function() {
iabGetPurchases();
store.iabGetPurchases();
});

@@ -924,20 +935,4 @@ var BILLING_RESPONSE_RESULT = {

}
iabGetPurchases();
store.iabGetPurchases();
}
function iabGetPurchases() {
store.inappbilling.getPurchases(function(purchases) {
if (purchases && purchases.length) {
for (var i = 0; i < purchases.length; ++i) {
var purchase = purchases[i];
var p = store.get(purchase.productId);
if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
continue;
}
store.setProductData(p, purchase);
}
}
store.ready(true);
}, function() {});
}
store.when("requested", function(product) {

@@ -1032,2 +1027,18 @@ store.ready(function() {

};
store.iabGetPurchases = function() {
store.inappbilling.getPurchases(function(purchases) {
if (purchases && purchases.length) {
for (var i = 0; i < purchases.length; ++i) {
var purchase = purchases[i];
var p = store.get(purchase.productId);
if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
continue;
}
store.setProductData(p, purchase);
}
}
store.ready(true);
}, function() {});
};
})();

@@ -1040,2 +1051,2 @@

module.exports = store;
module.exports = store;

@@ -5,2 +5,4 @@ var store = {};

store.sandbox = false;
(function() {

@@ -10,2 +12,3 @@ "use strict";

store.PAID_SUBSCRIPTION = "paid subscription";
store.NON_RENEWING_SUBSCRIPTION = "non renewing subscription";
store.CONSUMABLE = "consumable";

@@ -67,3 +70,3 @@ store.NON_CONSUMABLE = "non consumable";

var type = this.type = options.type || null;
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION) throw new TypeError("Invalid product type");
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION && type !== store.NON_RENEWING_SUBSCRIPTION) throw new TypeError("Invalid product type");
this.state = options.state || "";

@@ -193,3 +196,7 @@ this.title = options.title || options.localizedTitle || null;

var ret = cb;
if (cb instanceof store.Error) store.error.callbacks.trigger(cb); else if (cb.code && cb.message) store.error.callbacks.trigger(new store.Error(cb)); else if (typeof cb === "function") store.error.callbacks.push(cb); else if (typeof altCb === "function") {
if (cb instanceof store.Error) {
store.error.callbacks.trigger(cb);
} else if (typeof cb === "function") {
store.error.callbacks.push(cb);
} else if (typeof altCb === "function") {
ret = function(err) {

@@ -199,2 +206,6 @@ if (err.code === cb) altCb();

store.error(ret);
} else if (cb.code && cb.message) {
store.error.callbacks.trigger(new store.Error(cb));
} else if (cb.code) {
store.error.callbacks.trigger(new store.Error(cb));
}

@@ -1164,4 +1175,8 @@ return ret;

function storekitFinish(product) {
if (product.type === store.CONSUMABLE) {
if (product.transaction.id) storekit.finish(product.transaction.id);
if (product.type === store.CONSUMABLE || product.type === store.NON_RENEWING_SUBSCRIPTION) {
if (product.transaction && product.transaction.id) {
storekit.finish(product.transaction.id);
} else {
store.log.debug("ios -> error: unable to find transaction for " + product.id);
}
} else if (product.transactions) {

@@ -1496,2 +1511,2 @@ store.log.debug("ios -> finishing all " + product.transactions.length + " transactions for " + product.id);

module.exports = store;
module.exports = store;

@@ -5,2 +5,4 @@ var store = {};

store.sandbox = false;
(function() {

@@ -10,2 +12,3 @@ "use strict";

store.PAID_SUBSCRIPTION = "paid subscription";
store.NON_RENEWING_SUBSCRIPTION = "non renewing subscription";
store.CONSUMABLE = "consumable";

@@ -67,3 +70,3 @@ store.NON_CONSUMABLE = "non consumable";

var type = this.type = options.type || null;
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION) throw new TypeError("Invalid product type");
if (type !== store.CONSUMABLE && type !== store.NON_CONSUMABLE && type !== store.PAID_SUBSCRIPTION && type !== store.FREE_SUBSCRIPTION && type !== store.NON_RENEWING_SUBSCRIPTION) throw new TypeError("Invalid product type");
this.state = options.state || "";

@@ -193,3 +196,7 @@ this.title = options.title || options.localizedTitle || null;

var ret = cb;
if (cb instanceof store.Error) store.error.callbacks.trigger(cb); else if (cb.code && cb.message) store.error.callbacks.trigger(new store.Error(cb)); else if (typeof cb === "function") store.error.callbacks.push(cb); else if (typeof altCb === "function") {
if (cb instanceof store.Error) {
store.error.callbacks.trigger(cb);
} else if (typeof cb === "function") {
store.error.callbacks.push(cb);
} else if (typeof altCb === "function") {
ret = function(err) {

@@ -199,2 +206,6 @@ if (err.code === cb) altCb();

store.error(ret);
} else if (cb.code && cb.message) {
store.error.callbacks.trigger(new store.Error(cb));
} else if (cb.code) {
store.error.callbacks.trigger(new store.Error(cb));
}

@@ -864,3 +875,3 @@ return ret;

store.when("re-refreshed", function() {
iabGetPurchases();
store.iabGetPurchases();
});

@@ -924,20 +935,4 @@ var BILLING_RESPONSE_RESULT = {

}
iabGetPurchases();
store.iabGetPurchases();
}
function iabGetPurchases() {
store.inappbilling.getPurchases(function(purchases) {
if (purchases && purchases.length) {
for (var i = 0; i < purchases.length; ++i) {
var purchase = purchases[i];
var p = store.get(purchase.productId);
if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
continue;
}
store.setProductData(p, purchase);
}
}
store.ready(true);
}, function() {});
}
store.when("requested", function(product) {

@@ -1016,3 +1011,2 @@ store.ready(function() {

expirationDate: license.expirationDate,
isConsumable: license.isConsumable,
isActive: license.isActive

@@ -1057,2 +1051,18 @@ };

};
store.iabGetPurchases = function() {
store.inappbilling.getPurchases(function(purchases) {
if (purchases && purchases.length) {
for (var i = 0; i < purchases.length; ++i) {
var purchase = purchases[i];
var p = store.get(purchase.license.productId);
if (!p) {
store.log.warn("plugin -> user owns a non-registered product");
continue;
}
store.setProductData(p, purchase);
}
}
store.ready(true);
}, function() {});
};
})();

@@ -1064,2 +1074,2 @@

module.exports = store;
module.exports = store;

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 not supported yet

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