Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReceiptData is rejected by Apple #13

Open
objectiveSee opened this issue Nov 3, 2014 · 1 comment
Open

ReceiptData is rejected by Apple #13

objectiveSee opened this issue Nov 3, 2014 · 1 comment

Comments

@objectiveSee
Copy link

I am using this module to get the NSData representation of a IAP receipt and then sending it to my server which in turns sends it to Apple. The receipt is coming back as rejected by Apple due to malformed data. I noticed that when I get the NSData of a receipt using DHAppleReceiptParser then the length of the data is 346. When I get the NSData using self.transactionReceipt then the length is 2390. I would like to move away from using self.transactionReceipt since it is deprecated, however this module is not working. Any thoughts as to why DHAppleReceiptParser is returning the wrong length of receipt data, or why Apple is rejecting what it responds with?

Here is my code using DHAppleReceiptParser:

DHAppStoreReceipt *receiptObject = [DHAppStoreReceipt mainBundleReceipt];
DHInAppReceipt *inAppReceipt = [receiptObject receiptForProductId:self.payment.productIdentifier];
NSData *receiptData = [inAppReceipt receiptData];

And the code which works using self.transactionReceipt:

NSData *receiptData = self.transactionReceipt;
@objectiveSee objectiveSee mentioned this issue Nov 3, 2014
@raspu
Copy link

raspu commented Jul 28, 2015

I am having the same problem, it seems that the [inAppReceipt receiptData] is not supposed to be validated by Apple, you can only send the whole receipt data from the original file:

NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];

It seems to me, that this library is only useful to parse the files locally on the device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants