Skip to content

Instantly share code, notes, and snippets.

@tureki
Created January 25, 2015 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tureki/5de6be28c69ab7e9e5f9 to your computer and use it in GitHub Desktop.
Save tureki/5de6be28c69ab7e9e5f9 to your computer and use it in GitHub Desktop.
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