0

I am trying to validate IAP and to send to my server receipt which I then send to apple server to validate, I am using sandbox account and I get all the time status 21002 ( receipt missing or malformed ). I have in Objective C code

SKPaymentTransaction *transaction

object and I am sending

transaction.transactionReceipt

to my server and then pack and pass to apple server. How to encode on client

transaction.transactionReceipt with base64 ?

Do I need to encode with base64 on client transaction.transactionReceipt ?

Kampai
  • 22,848
  • 21
  • 95
  • 95
PaolaJ.
  • 10,872
  • 22
  • 73
  • 111

1 Answers1

4

Since iOS7 there is another way to get the receipt data. Here is what I do:

NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL];

NSData *receiptData = [NSData dataWithContentsOfURL:receiptUrl];

NSString *receiptBase64 = [receiptData base64EncodedStringWithOptions:0];

Then you send receiptBase64 to your server :)

Tiago Almeida
  • 14,081
  • 3
  • 67
  • 82