Created
January 25, 2015 09:32
-
-
Save tureki/5de6be28c69ab7e9e5f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSSet *products = [NSSet setWithArray:@[@"PRODUCT"]]; | |
[[RMStore defaultStore] requestProducts:products success:^(NSArray *products, NSArray *invalidProductIdentifiers) { | |
for (int i = 0; i < [products count]; ++i) | |
{ | |
SKProduct *p = products[i]; | |
NSLog(@"Product title: %@" , p.localizedTitle); | |
NSLog(@"Product description: %@" , p.localizedDescription); | |
NSLog(@"Product price: %@" , p.price); | |
NSLog(@"Product id: %@" , p.productIdentifier); | |
NSLog(@"------"); | |
} | |
} failure:^(NSError *error) { | |
NSLog(@"Something went wrong"); | |
}]; | |
[[RMStore defaultStore] restoreTransactionsOnSuccess:^(NSArray *transactions){ | |
NSLog(@"Transactions restored:%@",transactions); | |
for (int i = 0; i < [transactions count]; ++i) | |
{ | |
SKPaymentTransaction *p = transactions[i]; | |
NSLog(@"p.payment.productIdentifier: %@" , p.payment.productIdentifier); | |
NSLog(@"p.transactionDate: %@" , p.transactionDate); | |
NSLog(@"------"); | |
} | |
if([transactions count]==0) | |
{ | |
[[RMStore defaultStore] addPayment:@"PTTPlus_1M" success:^(SKPaymentTransaction *transaction) { | |
NSLog(@"Product purchased"); | |
} failure:^(SKPaymentTransaction *transaction, NSError *error) { | |
NSLog(@"Something went wrong"); | |
}]; | |
} | |
} failure:^(NSError *error) { | |
NSLog(@"Something went wrong"); | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment