Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.
/ IAPHelper Public archive
forked from saturngod/IAPHelper

in app purchases helper for iOS

Notifications You must be signed in to change notification settings

bumptech/IAPHelper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IAPHelper is base on Ray Wenderlich tutorial. This library is change to ARC and Block Structure to use more easier.

#How to use

Add

  • IAPHelper.h
  • IAPHelper.m
  • IAPShare.h
  • IAPShare.m

in your product.

Add

  • Storekit framework

In the file that you want to use in app purcahses

#import IAPShare.h

…
…
…

if([IAPShare sharedHelper].iap) {
	[IAPShare sharedHelper].iap = [[IAPHelper alloc] initWithProductIdentifiers:dataSet];
}

Get Product List

 [[IAPShare sharedHelper].iap requestProductsWithCompletion:^(SKProductsRequest* request,SKProductsResponse* response)
   {
   	//todo here
   	// you can get product list from response.products 
   	// or [[IAPShare sharedHelper].iap.products
   	// 	
   }];

Buy Product

    SKProduct* product =[[IAPShare sharedHelper].iap.products objectAtIndex:indexPath.row];

[[IAPShare sharedHelper].iap buyProduct:product 
                           onCompletion:^(SKPaymentTransaction* trans){ 
                               NSLog(@"Done");
                           }
                                 OnFail:^(SKPaymentTransaction* trans) {
                                     NSLog(@"Error");
                                 }];

Restore Product

[[IAPShare sharedHelper].iap restoreProductsWithCompletion:^(SKPaymentTransaction* trans){
   
    NSLog(@"Restore Done");
    
}OnFail:^(SKPaymentTransaction* trans)
{
    
}];

##Todo

  • Add Subscription In App Purcahses
  • Check Server Record Transaction

About

in app purchases helper for iOS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%