On a iPhone 4/iOS 4 device, sandbox App Store is reporting this error during verification.
21002: The data in the receipt-data property was malformed.
On a iPhone 5/iOS 6 device, the same code works (status == 0, receipt returned) without any problems.
I've restarted the device, made sure the Apple ID is logged out, even made a new test user account. Same result.
Any ideas?
This Error means the JSON Object that you have created to send for verification is not in correct format.
{ "receipt-data" : "(receipt bytes here)" }
So My suggestion is to Debug the same on iPhone 4/iOS 4. In case, you are Using Json Framework to create JSON object (for receipt validation) it will work only with iOS 5.0 & above.
Adding Code I had Implemented a few months I Used SBJson to write N parse.
`
For your sandbox environment use: https://sandbox.itunes.apple.com/verifyReceipt
For actual verification use: https://buy.itunes.apple.com/verifyReceipt
You can check this at Apple's official page.