IAP Receipt Data Malformed

Hey guys,

Im trying to do server-side receipt validation for a consumable product, however transaction.receipt appears to be returning a string version of NSData. Here is a sample:

“<7b0a0922 7369676e 61747572 6522203d 20224171 45534e75 45477a4e 4c632b4d 5a713630 5079515a 312b3570 30364779 36753441 38726943 376f596a 51523456 4d4f5a78 4b704577 746f626a 5250786a 37646c66 7a39414e 37627652 6b4c4755 554b496b 34773579 63534d48 6f326542 48505669 5761364d 75635472 30424c66 7255716f 676a4650 32346366 5944694e 2f4b476c 73395652 43385843 66445853 58614851 6c586d65 52765046 53487331 …>”

Is there any way to get the correct encoded string that can be used for validation with Apple’s receipt system?

Thanks!

bump

bump

Same problem here. I need to verify this on the server side but all i get from apple is status 21002 ( The data in the receipt-data property was malformed or missing. )

Edit: I solved the problem. In case anybody finds this via google (like I did), the data is binary and the representation as posted by brandon above are the hex values. So this is what you need to do:

  1. strip spaces, < and >,

  2. convert the hex values to ascii

  3. encode the whole thing as base64

Luckily theres already a script which handles this, see

https://github.com/SatheeshJM/Auto-Renewable-In-App-Purchase-Validation-using-Corona-SDK/blob/ca8f5db8546df916c511c687b385a186899d45aa/validate.lua#L80-L98

Same problem here. I need to verify this on the server side but all i get from apple is status 21002 ( The data in the receipt-data property was malformed or missing. )

Edit: I solved the problem. In case anybody finds this via google (like I did), the data is binary and the representation as posted by brandon above are the hex values. So this is what you need to do:

  1. strip spaces, < and >,

  2. convert the hex values to ascii

  3. encode the whole thing as base64

Luckily theres already a script which handles this, see

https://github.com/SatheeshJM/Auto-Renewable-In-App-Purchase-Validation-using-Corona-SDK/blob/ca8f5db8546df916c511c687b385a186899d45aa/validate.lua#L80-L98