Play Store receipt JSON changed after upgrading Unity version from 2020.3 to 2021.3

Hey

I’ve updated our project from Editor version 2020.3 to 2021.3 and for some reason the play store receipt is changed, which cause a crush on our server side when trying to parse it for validation.

when I tested a build version from the day before that upgrade we are getting the old receipt JSON which is a single object, but now we are getting an array of object, I read about this change on play store documentation but I cant find anywhere what’s the cause for our new version to get different object from the play store.

The IAP package was not updated (although later on I did try to update it to see how it effect).
Another change I made at the same time is adding support for Android OS 12+13. I tried to switch back the build target to highest from android 13 but it still the same.

So at the moment I have 2 builds of the same app that receive 2 different response from the IAP receipt from play store and I’m trying to understand what’s causing it (mainly to know how to handle backward compatibility on the server verification process)

Please advise
Thanks

Hi @Cfirzi ,

Can you please send us the receipts so we can see the difference, or if not a callstack of your crash?

Also to be clear, the crash is on your server? This means you are using the Google Play server API that you have developed yourself?

Hey

There was no actual crush, just parsing error because of the new JSON structure, the change was only on skuDetails param with was an object before skuDetails{…}, and now is an array of objects skuDetails[{,},{,},{,}}

I didnt had a chance to test it for confirmation but I’m pretty sure the change was caused by upgrading the “Target API Level” from 11 to 13, but I would love a conformation for it

Please send us the receipts that you are using for testing. We are not aware of any effect of changing target API levels, that should not change the receipt that you receive from Google.

This is the “new” purchase validation response we receive on the server side when validating with the play store api:

{
"generatedKey": "0485d68d-f34b-437e-b2d2-1e88ce648b2d",
"proofOfPurchase": "{\"Payload\":\"{\\\"json\\\":\\\"{\\\\\\\"orderId\\\\\\\":\\\\\\\"GPA.3320-2313-0233-15969\\\\\\\",\\\\\\\"packageName\\\\\\\":\\\\\\\"com.diwip.socialslots\\\\\\\",\\\\\\\"productId\\\\\\\":\\\\\\\"package_6\\\\\\\",\\\\\\\"purchaseTime\\\\\\\":1662911382553,\\\\\\\"purchaseState\\\\\\\":0,\\\\\\\"purchaseToken\\\\\\\":\\\\\\\"aneiboeaikjlpnjbiopmbljm.AO-J1Oyf-nXNBRpdtPW1iIA8WeR0f5AdPdi8fLS01bcYMeB87tlj3_swM9Kc0eioKUJ06uVXOLGp5GFTfjRYOWTfx8B95gRvaJW_svyQl-u6Tx1-go4AGRI\\\\\\\",\\\\\\\"quantity\\\\\\\":1,\\\\\\\"acknowledged\\\\\\\":false}\\\",\\\"signature\\\":\\\"flErayp2l9L8XTdeNI0yTvB92P3GSrL+RWREq9iy4zNE5IYstOX35Lsk8fVGoZga1eSU3lERj9qHODOy7+nNyl9tG+nqpu7iW2L21vwSh0R+3usfn9YceITqrfGBAgVKpP7tH0SgFelj/c3wMBRF2DhhqG7I0l9aRc/dTUMYyve77ACBv2CJq5rT5eFhVG/++AfPXxSWekew5Rts3LMrG1v5HrPdeQCpdzSeYra2+p0h9pq5nBfha+WQf/mfjntgvkLEN6kw+KI/dNZ2IwMAQQc1I8UOlahBfENcbDTi+siLLTJyCpT8irWZhtUbFDb3uqqjxlqVzupwV0Ma8GOGwA==\\\",\\\"skuDetails\\\":[\\\"{\\\\\\\"productId\\\\\\\":\\\\\\\"package_6\\\\\\\",\\\\\\\"type\\\\\\\":\\\\\\\"inapp\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"5.99 Package (Best Casino Legends Slots 777)\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"5.99 Package\\\\\\\",\\\\\\\"description\\\\\\\":\\\\\\\"5.99 Package\\\\\\\",\\\\\\\"price\\\\\\\":\\\\\\\"\\\\u20aa24.90\\\\\\\",\\\\\\\"price_amount_micros\\\\\\\":24900000,\\\\\\\"price_currency_code\\\\\\\":\\\\\\\"ILS\\\\\\\",\\\\\\\"skuDetailsToken\\\\\\\":\\\\\\\"AEuhp4LCGhF_rRyBb1A187OGIpLkUyvxTn8hUI38HhHzimdMewv3aMsB6LKWDJ9dqksX\\\\\\\"}\\\"]}\",\"Store\":\"GooglePlay\",\"TransactionID\":\"aneiboeaikjlpnjbiopmbljm.AO-J1Oyf-nXNBRpdtPW1iIA8WeR0f5AdPdi8fLS01bcYMeB87tlj3_swM9Kc0eioKUJ06uVXOLGp5GFTfjRYOWTfx8B95gRvaJW_svyQl-u6Tx1-go4AGRI\"}",
"transactionIdentifier": "aneiboeaikjlpnjbiopmbljm.AO-J1Oyf-nXNBRpdtPW1iIA8WeR0f5AdPdi8fLS01bcYMeB87tlj3_swM9Kc0eioKUJ06uVXOLGp5GFTfjRYOWTfx8B95gRvaJW_svyQl-u6Tx1-go4AGRI",
"pid": "package_6",
"platform": "ANDROID"
}

as you can see - skuDetails is array, which was an object before that

We confirm that this has changed.
In 4.5.1, we updated the changelog to mention this:

  • The “skuDetails” in the receipt json is now an array of the old structure, not just one object. It will only have one element in most cases, so if this is being parsed in your app, treat it like an array and get the first element by default.
1 Like

This thread is now closed. Feel free to reach out via a new thread if you encounter further issue.
Thanks!

1 Like