Skip to content
Browse files

added cantMakePayments method to example code

  • Loading branch information...
1 parent e8694ff commit 4e6e86044cd3d3adcabf0278960006496a05e340 @sobri909 committed May 21, 2012
Showing with 19 additions and 12 deletions.
  1. +19 −12 README.markdown
View
31 README.markdown
@@ -20,21 +20,28 @@ SKProducts are cached per app run, so future requests for the same SKProduct wil
## Purchase a product
```objc
-NSString *itemKey = @"com.bigpaua.CoolApp.CoolFeature";
-[[MGStoreKit store] purchaseProduct:itemKey success:^(NSString *productId) {
+if (![MGStoreKit store].canMakePayments) {
- // It's your responsibility to save the purchases to keychain, Core Data,
- // or elsewhere. As a lightweight wrapper, MGStoreKit leaves these app
- // level details up to you.
-
- NSLog(@"Purchased:%@", productId);
+ NSLog(@"Not going to happen. The user can't make payments.");
-} failed:^(NSString *productId) {
+} else {
- // Failure is most likely the user changing their mind and tapping Cancel.
-
- NSLog(@"Failed:%@", productId);
-}];
+ NSString *itemKey = @"com.bigpaua.CoolApp.CoolFeature";
+ [[MGStoreKit store] purchaseProduct:itemKey success:^(NSString *productId) {
+
+ // It's your responsibility to save the purchases to keychain, Core Data,
+ // or elsewhere. As a lightweight wrapper, MGStoreKit leaves these app
+ // level details up to you.
+
+ NSLog(@"Purchased:%@", productId);
+
+ } failed:^(NSString *productId) {
+
+ // Failure is most likely the user changing their mind and tapping Cancel.
+
+ NSLog(@"Failed:%@", productId);
+ }];
+}
```
## Restore previous purchases

0 comments on commit 4e6e860

Please sign in to comment.
Something went wrong with that request. Please try again.