npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-appleiap

v1.0.0

Published

Cordova Plugin for Apple In-App purchase

Downloads

7

Readme

iOS In-App Purchase plugin

By Matt Kane

Allows In-App Purchases to be made from Phonegap. Wraps StoreKit.

Adding the Plugin to your project

Copy the .h and .m file to the Plugins directory in your project. Copy the .js file to your www directory and reference it from your html file(s). Finally, add StoreKit.framework to your Xcode project if you haven't already.

Using the plugin

###NOTE: In-app purchases can be complicated, with very unhelpful error messages and lots of things that need to be configured perfectly for them to work. I cannot provide support for them. Errors are highly unlikely to have been caused by the plugin. Please see the Apple Developer Forums for help! ###

Please read the In-App Purchase Programming Guide and the iTunes Connect Developer Guide.

The plugin creates the object window.plugins.inAppPurchaseManager with the following methods:

requestProductData(productId, successCallback, failCallback)

makePurchase(productId, quantity)

restoreCompletedTransactions()

You can also register the following callbacks:

window.plugins.inAppPurchaseManager.onPurchased = function(transactionIdentifier, productId, transactionReceipt) {}

window.plugins.inAppPurchaseManager.onRestored = function(originalTransactionIdentifier, productId, originalTransactionReceipt) {}

window.plugins.inAppPurchaseManager.onFailed = function(errorCode, errorText);

You should register the callbacks early in your app's initialisation process, because StoreKit will automatically attempt to complete any unfinished transactions when you launch the app. If the plugin does receive callbacks before you have registered a handler, they will be placed into a queue and executed when you do register one.

Before attempting to make a purchase you should first call requestProductData to retrieve the localised product data. If you don't do this, then any attempt to make a purchase will fail. A basic usage example is below:

	window.plugins.inAppPurchaseManager.onPurchased = function(transactionIdentifier, productId, transactionReceipt) {
		console.log('purchased: ' + productId);
		/* Give coins, enable subscriptions etc */
	}

	window.plugins.inAppPurchaseManager.onRestored = function(transactionIdentifier, productId, transactionReceipt) {
		console.log('restored: ' + productId);
		/* See the developer guide for details of what to do with this */
	}

	window.plugins.inAppPurchaseManager.onFailed = function(errno, errtext) {
		console.log('failed: ' + errtext);
	}

	window.plugins.inAppPurchaseManager.requestProductData("com.example.test", function(productId, title, description, price) {
    		console.log("productId: " + productId + " title: " + title + " description: " + description + " price: " + price);
    		window.plugins.inAppPurchaseManager.makePurchase(productId, 1);
    	}, function(id) {
    		console.log("Invalid product id: " + id);
	    }
	);

BUGS AND CONTRIBUTIONS

For IAP support, please use the Apple Developer Forum.

The latest bleeding-edge version is available on GitHub If you have a patch, fork my repo and send me a pull request. Submit bug reports on GitHub, please.

Licence

The MIT License

Copyright (c) 2011 Matt Kane

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.