Closed novabyte closed 3 years ago
In-App Purchases for iOS, Android (Google+Amazon) and Facebook are handled in this extension:
https://defold.com/extension-iap/
Basic API is:
iap.set_listener(fn)
iap.list(product_ids, fn)
iap.buy()
iap.finish(receipt)
What do you need specifically? Is this for receipt validation?
introduce the new session refresh APIs to the client object
Could you tell me more about this?
I can pick up this task later this week or beginning of next.
What do you need specifically? Is this for receipt validation?
Yep its for receipt validation. There's three new endpoints which are used directly for receipt validation with Apple, Google, and Huawei. In the .NET client they were added in this pull request. It's a method each to take a receipt from the purchase provider and pass it to the server which validates it and stores it to prevent replay attacks.
Could you tell me more about this?
Sure, we also recently added refresh tokens to the server which can be used to obtain a new session token. This reduces the need to reauthenticate players (though the same pattern as normal still applies if developers use social sign-in options like Apple Sign-in and Google Play). We added it to the .NET client in this pull request.
The overall code for session refresh added both a way to configure the client object to auto-refresh a session and also to add the API function to manually refresh a session with the server.
I think the code generator in the repo should do most of the manual work to build the request and inputs. 🤞
Thanks @britzl 🙏
FYI Starting work on this now.
Thanks @britzl 🙏
I ran the code generator with the latest API definitions and there was indeed a number of new IAP receipt functions.
I also noticed some changes to linking of Steam accounts.
And the generated code for the "/v2/friend" endpoint has some new arguments (I don't see how the functions could have worked before).
Finally there was also a new "/v2/session/logout" endpoint.
PR with the changes: https://github.com/heroiclabs/nakama-defold/pull/29
For the IAP purchase validation we need to add some documentation about which Defold extension to include when using In-App Purchase. I don't see any IAP related docs yet though (https://heroiclabs.com/docs/index.html).
Oh, here it is: https://heroiclabs.com/docs/iap-validation/
Commit to my nakama-docs branch with IAP validation for Defold:
https://github.com/britzl/nakama-docs/commit/1f212c47f973e308cf21dad0ebdf87556f0c1686
We need to investigate what the IAP support in Defold engine looks like as well as introduce the new session refresh APIs to the client object.