Hi
I’m using the unity iap and discovered all my receipts were invalid on amazon. Since I hadn’t looked at that code for ages, I went back to revisit it.
So I just tried the demo package included with the iap service. Set up the sandbox environment and:
-
Any test purchase will fail, saying that “invalid receipt, not unlocking content”.
This will happen I believe because the script has a validator of the purchase always enabled for anything that is android. In this case, it’s an amazon device. It seems to not be able to detect that you are on amazon, even if I set it up on the dropbox as an amazon store, it will still fail. -
Disabling the receipt validator, I get the test to work on the device but the server will always say that my receipt is invalid (error 498). I get this receipt:
receipt:{“Store”:“AmazonApps”,“TransactionID”:“q1YqVbJSyjH28DGPKChw9c0o8nd3ySststQtzSkrzM8tCk43K6z0d_HOTcww
N8vxCrVV0lEqBmpJzs_VS03OyE_KBzJS8tPTMtMzSlJzMktS9YxMs4GKSpSsDHSUUoBKDU0sDSwtDM1NjAwMDJRqAQ”,“Payload”:“{"receiptId":"q1YqVbJSyjH28DGPKChw9c0o8nd3ySststQtzSkrzM8tCk43K6z0d_HOTcww
N8vxCrVV0lEqBmpJzs_VS03OyE_KBzJS8tPTMtMzSlJzMktS9YxMs4GKSpSsDHSUUoBKDU0sDSwtDM1NjAwMDJRqAQ","userId":"l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=","isSandbox":true}”}
I retrieve the payload, send it out to the server with the usual
__https://appstore-sdk.amazon.__com/version/2.0/verify/developer/" + devsecret + “/user/” + userId + “/purchaseToken/” + purchaseToken;
which in this case is
__https://appstore-sdk.amazon.__com/version/2.0/verify/developer/2:SECRET_HERE0zaCPqQ==/user/l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=/purchaseToken/q1YqVbJSyjH28DGPKChw9c0o8nd3ySststQtzSkrzM8tCk43K6z0d_HOTcwwN8vxCrVV0lEqBmpJzs_VS03OyE_KBzJS8tPTMtMzSlJzMktS9YxMs4GKSpSsDHSUUoBKDU0sDSwtDM1NjAwMDJRqAQ
Then error 498 is returned (invalid token). It doesn’t matter if I try this on sandbox on production. Always the same error.
So… what gives?
Things I can think of:
a) receipts need to be validated with a validator before “decrypting” them on amazon? (bug)
b) the token generated is not working or properly formatted (bug)
c) i’m missing something