OkayIAPManager 0.3.0

OkayIAPManager 0.3.0

Maintained by CoderGL.



  • By
  • zhangguoliang

OkayIAPManager

CI Status Version License Platform

Introduce

It's a easy In-App Purchase Lib. To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS 8.0 or later.

Installation

OkayIAPManager is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'OkayIAPManager'

Usage

/// start purchase
- (IBAction)action:(id)sender {
    
    [[OkayIAPManager shareInstance] startPurchWithProductId:@"cn.okay.IAPurch_1" orderId:@"xxx" completeHandle:^(OkayIAPurchType type, NSString *orderId, NSData *data, SKPaymentTransaction *transaction) {
        
    }];
}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    /// check drop order
    [[OkayIAPManager shareInstance] checkLoseIAPOrderCallBack:^(OkayIAPurchType type, NSString *order, NSData *data) {
        if (type == OkayIAPurchTypeSuccess) {
            /// simulate verify purchase result at your servers.
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                /// must be removeCurrentTransaction in the end.
                [[OkayIAPManager shareInstance] removeCurrentTransaction];
            });
        }
    }];
    
    return YES;
}

Author

zhangguoliang, [email protected]

License

OkayIAPManager is available under the MIT license. See the LICENSE file for more info.