Skip to content

flubbermedia/FMPurchaseManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Purpose

FMPurchaseManager is a wrapper on the StoreKit framework that makes the whole purchase process easier.

*NOTE: the supported build target is iOS 5.1 (Xcode 4.4)

Installation

Add the <StoreKit/StoreKit.h> framework and drag the FMPurchaseManager class files into your project.

Usage

(see sample Xcode project /Demo)

First of all you must setup the two blocks that are called during the purchase process.

  1. Handle the product request completion

    [FMPurchaseManager setProductRequestCompletion:
    ^(NSArray *products, NSArray *invalidProductIdentifiers) {
    	//you receive an array of SKProduct objects
    	//and a list of invalid product identifiers
    }];
  2. Handle the purchase completion

    [FMPurchaseManager setProductPurchaseCompletion:
    ^(SKPaymentTransaction *transaction, NSString *productIdentifier, NSError *error) {
    	if (error == nil)
    	{
    		//the purchase has completed, do whatever you want with the transaction
    	}
    	else
    	{
    		//something went wrong with your purchase or the user cancelled it
    	}
    }];

Once you prepared the completion blocks you can:

  • request the products with the related identifiers [FMPurchaseManager requestProducts:someProducts]
  • buy a product with its identifier [FMPurchaseManager buyProduct:anIdentifier]
  • restore the previously purchased products [FMPurchaseManager restorePurchases]

Credits

FMPurchaseManager was created by Maurizio Cremaschi and Andrea Ottolina for Flubber Media Ltd.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published