Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattt/CargoBay
The Essential StoreKit Companion
https://github.com/mattt/CargoBay
Last synced: 3 months ago
JSON representation
The Essential StoreKit Companion
- Host: GitHub
- URL: https://github.com/mattt/CargoBay
- Owner: mattt
- License: mit
- Archived: true
- Created: 2012-09-10T02:50:12.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2021-06-22T17:08:43.000Z (over 3 years ago)
- Last Synced: 2024-07-19T03:44:51.747Z (4 months ago)
- Language: Objective-C
- Size: 250 KB
- Stars: 1,764
- Watchers: 77
- Forks: 157
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CargoBay
> **Note**: This project is no longer being maintained.
[`StoreKit`](http://developer.apple.com/library/ios/#documentation/StoreKit/Reference/StoreKit_Collection/) is the Apple framework for [making In-App Purchases](https://developer.apple.com/library/IOS/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Introduction.html). 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](https://developer.apple.com/library/IOS/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html#//apple_ref/doc/uid/TP40008267-CH5-SW12)
- 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## Usage
### Product Requests
```objective-c
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**
```objective-c
- (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
```objective-c
[[CargoBay sharedManager] verifyTransaction:transaction password:nil success:^(NSDictionary *receipt) {
NSLog(@"Receipt: %@", receipt);
} failure:^(NSError *error) {
NSLog(@"Error %d (%@)", [error code], [error localizedDescription]);
}];
```## License
CargoBay is available under the MIT license. See the LICENSE file for more info.