All Projects β†’ atjason β†’ Iaphelper

atjason / Iaphelper

IAPHelper simply wraps the API of Apple's In-App Purchase using Swift.

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Iaphelper

envato-purchase-code-verifier
πŸš‚ A nifty tool for Envato Authors needing to create purchase code verifier as easy and as fast as possible.
Stars: ✭ 19 (-87.58%)
Mutual labels:  purchase
Laravel Wallet
Easy work with virtual wallet
Stars: ✭ 401 (+162.09%)
Mutual labels:  purchase
Quickshop Reremake
QuickShop is a shop plugin, that allows players to sell items from a chest with no commands. It allows players to purchase any number of items easily. In fact, this plugin doesn't even have any commands that a player would ever need!
Stars: ✭ 82 (-46.41%)
Mutual labels:  purchase
hms-iap-clientdemo-android-studio
This demo app provides all 3 types of product to demonstrate the procedure and capability of Huawei IAP.
Stars: ✭ 36 (-76.47%)
Mutual labels:  purchase
Tpinappreceipt
Reading and Validating In App Purchase Receipt Locally.
Stars: ✭ 305 (+99.35%)
Mutual labels:  purchase
In App Purchase
A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
Stars: ✭ 868 (+467.32%)
Mutual labels:  purchase
wc4bp
WooCommerce BuddyPress Integration
Stars: ✭ 18 (-88.24%)
Mutual labels:  purchase
Inapppy
Python In-app purchase validator for Apple AppStore and GooglePlay.
Stars: ✭ 110 (-28.1%)
Mutual labels:  purchase
Patronkit
A framework to add patronage to your apps.
Stars: ✭ 370 (+141.83%)
Mutual labels:  purchase
Nativescript Purchase
πŸ’° A NativeScript plugin for making in-app purchases!
Stars: ✭ 80 (-47.71%)
Mutual labels:  purchase
hms-iap-serverdemo
IAP server sample encapsulates APIs of the HUAWEI IAP server. It provides many sample programs for your reference or usage. The repository contains 8 branches of java, csharp, golang, nodejs, perl, php, python and ruby demo.
Stars: ✭ 20 (-86.93%)
Mutual labels:  purchase
PurchaseHelper
Sample app to explain the In-App purchase implementation in Android using Play-billing library
Stars: ✭ 30 (-80.39%)
Mutual labels:  purchase
Android Checkout
Library for Android In-App Billing (Version 3+)
Stars: ✭ 986 (+544.44%)
Mutual labels:  purchase
google-play-billing-validator
Npm module for Node.js to validate In-app purchases and Subscriptions on your backend
Stars: ✭ 72 (-52.94%)
Mutual labels:  purchase
Apphudsdk
Build, Measure and Grow iOS subscription business
Stars: ✭ 93 (-39.22%)
Mutual labels:  purchase
Google-IAP
Android Library for easing Google Play Billing to your apps with support for Subscriptions, In-App Purchases and Consumables with a beautiful sample app.
Stars: ✭ 129 (-15.69%)
Mutual labels:  purchase
Mixerp
Open Source ERP, HRM, MRP, MPS
Stars: ✭ 472 (+208.5%)
Mutual labels:  purchase
Redux Framework
Redux is a simple, truly extensible options framework for WordPress themes and plugins!
Stars: ✭ 1,602 (+947.06%)
Mutual labels:  purchase
Flutter iap
Flutter iap plugin
Stars: ✭ 101 (-33.99%)
Mutual labels:  purchase
Betterlifepsi
Betterlife Intelligent PSI(Purchase, Sales and Inventory) system
Stars: ✭ 43 (-71.9%)
Mutual labels:  purchase

What's IAPHelper

IAPHelper simply wraps the API of Apple's In-App Purchase using Swift. Very lightweight and easy to use.

IAPHelper Usage

Request Product List

var productIdentifiers = Set<ProductIdentifier>()
productIdentifiers.insert("product_id_1")
productIdentifiers.insert("product_id_2")

IAP.requestProducts(productIdentifiers) { (response, error) in
	if let products = response?.products where !products.isEmpty {
		// Get the valid products
	   
	} else if let invalidProductIdentifiers = response?.invalidProductIdentifiers {
		// Some products id are invalid
	   
	} else {
		// Some error happened
	}
}

Purchase Product

 IAP.purchaseProduct(productIdentifier, handler: { (productIdentifier, error) in
	if let identifier = productIdentifier {
		// The product of 'productIdentifier' purchased.
	     
	} else if let error = error as? NSError {
      if error.code == SKError.Code.paymentCancelled.rawValue {
		// User cancelled
        
      } else {
		// Some error happened
      }
    }
})

Restore

 IAP.restorePurchases { (productIdentifiers, error) in
	 if !productIdentifiers.isEmpty {
	 	// Products restored
	   
	 } else if let error = error as? NSError {
       if error.code == SKError.Code.paymentCancelled.rawValue {
	  	// User cancelled
        
       } else {
	  	// Some error happened
       }
      
    } else {
      // No previous purchases were found.
    }
}

Validate Receipt

IAP.validateReceipt(Constants.IAPSharedSecret) { (statusCode, products) in
	if statusCode == ReceiptStatus.NoRecipt.rawValue {
		// No Receipt in main bundle
	} else {
		// Get products with their expire date.
	}
})

Note: IAPHelper directly validate with Apple's server. It's simple, but has risk. You decide to use your own server or not. Here's what Apple suggested:

Use a trusted server to communicate with the App Store. Using your own server lets you design your app to recognize and trust only your server, and lets you ensure that your server connects with the App Store server. It is not possible to build a trusted connection between a user’s device and the App Store directly because you don’t control either end of that connection.

Integrate IAPHelper in Your Project

Just copy IAPHelper.swift to your project, and use it as the demo shows.

IAPHelper Demo

NOTE: You need to change the app bundle id and product id to your own. And also set your shared secret in Constants.swift.

Apps using IAPHelper

It would be great to show your apps using IAPHelper here. Pull requests welcome :)

Note

This library can't help you understand the basic concepts for IAP. For it, please refer to these documents.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].