Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSString *stringReceipt = [[[NSString alloc] initWithData:transaction.transactionReceipt encoding:NSUTF8StringEncoding] autorelease];
- stringReceipt = [stringReceipt stringByReplacingOccurrencesOfString:@"=" withString:@":"];
- stringReceipt = [stringReceipt stringByReplacingOccurrencesOfString:@";" withString:@","];
- NSRange range = NSMakeRange([stringReceipt length] - 3, 1);
- stringReceipt = [stringReceipt stringByReplacingCharactersInRange:range withString:@""];
- NSDictionary *tempDictionary = [stringReceipt JSONValue];
- // NSLog(@"%@", tempDictionary);
- NSString *purchaseInfo = [tempDictionary objectForKey:@"purchase-info"];
- // NSLog(@"%@", purchaseInfo);
- NSData *receiptData = [self decodeBase64WithString:purchaseInfo];
- NSString *decodedString = [[[NSString alloc] initWithData:receiptData encoding:NSUTF8StringEncoding] autorelease];
- decodedString = [decodedString stringByReplacingOccurrencesOfString:@"=" withString:@":"];
- decodedString = [decodedString stringByReplacingOccurrencesOfString:@";" withString:@","];
- NSRange decRange = NSMakeRange([decodedString length] - 3, 1);
- decodedString = [decodedString stringByReplacingCharactersInRange:decRange withString:@""];
- NSDictionary *decodedDict = [decodedString JSONValue];
- NSString *originalID = [decodedDict objectForKey:@"original-transaction-id"];
- [self recoverSubscription:originalID];
- NSLog(@"%@", originalID);
Add Comment
Please, Sign In to add comment