CargoBay

The Essential StoreKit Companion

  • Owner: mattt/CargoBay
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

CargoBay

The Essential StoreKit Companion

StoreKit is the Apple framework for making In-App Purchases. It's pretty good, but it has a few rough edges.

CargoBay smooths out those rough parts by providing:

  • One step receipt & transaction verification, done securely according to Apple's guidelines
  • Block-based interface for requesting product information
  • Ability to request product information for identifiers asynchronously from a remote web service
  • Block-based callbacks for payment queue observation delegate methods
  • Automatic check for transaction uniqueness

This project is part of a series of open source libraries covering the mission-critical aspects of an iOS app's infrastructure. Be sure to check out its sister projects: GroundControl, SkyLab, houston, and Orbiter.

Usage

Product Requests

NSArray *identifiers = @[
  @"com.example.myapp.apple",
  @"com.example.myapp.pear",
  @"com.example.myapp.banana"
];

[[CargoBay sharedManager] productsWithIdentifiers:[NSSet setWithArray:identifiers]
success:^(NSArray *products, NSArray *invalidIdentifiers) {
  NSLog(@"Products: %@", products);
  NSLog(@"Invalid Identifiers: %@", invalidIdentifiers);
} failure:^(NSError *error) {
  NSLog(@"Error: %@", error);
}];

Payment Queue Observation

AppDelegate.m

- (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)options {
  [[CargoBay sharedManager] setPaymentQueueUpdatedTransactionsBlock:^(SKPaymentQueue *queue, NSArray *transactions) {
    NSLog(@"Updated Transactions: %@", transactions);
  }];

  [[SKPaymentQueue defaultQueue] addTransactionObserver:[CargoBay sharedManager]];

  // ...
}

Verifying Receipts

[[CargoBay sharedManager] verifyTransaction:transaction password:nil success:^(NSDictionary *receipt) {
  NSLog(@"Receipt: %@", receipt);
} failure:^(NSError *error) {
    NSLog(@"Error %d (%@)", [error code], [error localizedDescription]);
}];

Contact

Mattt Thompson

License

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

Main metrics

Overview
Name With Ownermattt/CargoBay
Primary LanguageObjective-C
Program languageRuby (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2012-09-10 02:50:12
Pushed At2021-06-22 17:08:43
Last Commit At2021-06-22 10:08:43
Release Count13
Last Release Name2.1.1 (Posted on )
First Release Name0.1.0 (Posted on )
用户参与
Stargazers Count1.8k
Watchers Count76
Fork Count155
Commits Count208
Has Issues Enabled
Issues Count60
Issue Open Count0
Pull Requests Count22
Pull Requests Open Count0
Pull Requests Close Count11
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private