I have an in-app purchase for which I want to check the receipt of the store. I would like to test this on a random machine on the Internet using the itunes API. The receipt is stored in Parse after the transaction is completed. I follow the guide on the Apple developer website . First I get the transaction from Parse:
curl -X GET \ -H "X-Parse-Application-Id: [...]" \ -H "X-Parse-REST-API-Key: [...]" \ https:
which is as follows:
{ "transactionReceipt":{"__type":"Bytes","base64":"asdfqwertyASDFQWERTY="}, "transactionType":"Purchased", "transactionIdentifier":"[...]", "transactionDate":{"__type":"Date","iso":"2012-09-10T06:58:44.071Z"}, "createdAt":"2012-09-10T06:58:37.234Z", "updatedAt":"2012-09-10T06:58:37.234Z", "objectId":"HyPWJBlWzt" }
Then I take the base64 value inside the Receipt transaction and twist it with the Apple endpoint to get a receipt:
curl -H "Accept: application/json" \ -H "Content-Type: application/json" \ -X POST -d '{"receipt-data":"asdfqwertyASDFQWERTY="}' \ https://buy.itunes.apple.com/verifyReceipt
And all that I get is not very useful:
{"status":21002, "exception":"java.lang.IllegalStateException"}
which, it seems to me, corresponds to "Data in the receipt property was distorted." Getting curl to flush the whole operation with -trace-ascii didn’t show anything that I thought was relevant, I'm sure the problem is not with the connection itself.
A little exaggerated. It looks like the transaction was found from the end (setting multiple bytes in the receipt data raises java.lang.IllegalArgumentException), so I assume that it is somehow related to the transaction itself. Has anyone seen this before?
Thanks!
source share