[Solved!] Using sdkbox IAP plugin for iOS and server side validation issue

Hello All,

I am using the IAP plugin to do microtransactions for my game. I have everything set up in sandbox and it seems to be working but when integrated server side verification, there is an issue.

We get the recieptCipheredPayload and post that to a php script on our server that handles the verfication side of things. Using a test receipt we get back that its valid but doing an actual sandbox purchase fails saying its invalid with error code 21002

Apple says error code 21002 is “The data in the receipt-data property was malformed or missing.”

I am taking the payload directly from what SDKBOX gives me so I am at a loss. Please let me know what you think the issue might be.

When using a decoder I found online, the test receiptPayload I have decodes to readable json while the receipt I get back from SDKBOX decodes to garbage.

Solution:
I found a stack overflow post that recommended removing the receipt ‘\n’ and ‘\r’ characters and replacing ‘+’ with’%2B’ before sending it to the server. Doing it on the server side had no effect but doing it client side did the trick.

2 Likes

Thanks, that’s good to know.

Thanks GOD I found this. Work perfectly! Thanks BMG_Blake