Skip to content

flubbermedia/FMPurchaseManager

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

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