Closed sergisolanellas closed 10 years ago
yes. correct. I will check and update for iOS 7.
Thanks
Hi @saturngod - I was wondering if this was closed because it was changed or if it was closed because you acknowledged it. Is there a new method for checking the receipt of a transaction using IAPHelper? Thanks :)
Hi @basicallydan, only need to change the NSData this:
NSURL receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; NSData receipt = [NSData dataWithContentsOfURL:receiptURL];
[[IAPShare sharedHelper].iap checkReceipt:receipt AndSharedSecret:@"secret_key" onCompletion:^(NSString response, NSError error) { // Do something }
Thanks for your reply - Does that actually refer to the latest transaction, though? According to this documentation it's for the purchased app.
To be clear, I'm trying to use this method inside this completion block:
[[IAPShare sharedHelper].iap buyProduct:product onCompletion:^(SKPaymentTransaction* trans) {
// Stuff with trans
}
If they've purchased multiple IAPs in the app, which receipt will be returned?
Yes, I use this code:
SKProduct *product = [[IAPShare sharedHelper].iap.products objectAtIndex:[sender tag]];
[[IAPShare sharedHelper].iap buyProduct:product onCompletion:^(SKPaymentTransaction* trans){
if(trans.error){
// Show error
}else if(trans.transactionState == SKPaymentTransactionStatePurchased) {
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
[[IAPShare sharedHelper].iap checkReceipt:receipt AndSharedSecret:@"shared_key" onCompletion:^(NSString *response, NSError *error) {
// Do something
}
}
}
So, I suppose appStoreReceiptURL returns the most recent receipt?
Hello,
I use your contribution and it works perfect, but in a new app i created only in iOS7, appears "transactionreceipt" deprecated.
How can correct it ? Only need to change with this ?
NSURL receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; NSData receipt = [NSData dataWithContentsOfURL:receiptURL];
Thanks