Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purchases_updated does not return original data needed for receipt validation #27

Open
Colorfulmoose opened this issue Nov 4, 2021 · 4 comments

Comments

@Colorfulmoose
Copy link

purchases_updated uses your custom utils to convert the received purchases data into a dictionary (very useful, except in this case...)

For receipt validation (in my case through Playfab) I need to pass the original JSON from the purchase data in the exact format it was received - on their end, it looks like Google converts this to a hash using your private developer key and compares it to the signature, which should match. Changing the order or formatting of their data, or leaving out pieces of it, makes it so that won't work. Is there any way to change purchases_updated or create a new callback that returns the original purchase data?

My understanding of this may be somewhat naïve, so I hope I explained it well, and I'm open to other solutions!

@natetrost
Copy link
Contributor

I believe the need for the original json is specific to the Playfab receipt validation implementation. Adding it to the Purchase dictionary should be possible in a future release, if you wanted to make a local build with the feature I think all you would need to do is add the following line to the convertPurchaseToDictionary function in GooglePlayBillingUtils.java:

dictionary.put("original_json", purchase.getOriginalJson());

And then use the original_json key to retrieve the string to pass to Playfab.

@Colorfulmoose
Copy link
Author

Ah, ok! I will try that. Thanks!

@Colorfulmoose
Copy link
Author

Ok, I have results: On the most current version of this repo, I was unable to get the plugin to work in godot (with my changes or not) but when I rolled back to the stable release version, I was able to make this change and PlayFab is happy. Thanks for the suggestion @natetrost !

@natetrost
Copy link
Contributor

Glad to hear it, the current version of the repo hasn't rolled out into a release yet, it does have an API change, which isn't reflected in the tutorial docs since it isn't the current release yet. I suspect that might have been where you ran into problems before rolling back to 1.0.1.

natetrost added a commit to natetrost/godot-google-play-billing that referenced this issue Dec 3, 2021
Per [issue 27](godot-sdk-integrations#27)
added an `original_json` key to the Purchase dictionary containing
the contents of `Purchase.getOriginalJson()`.

Bumped version to 1.1.1 and updated readme to note that is now
building against API 30.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants