question

Francois Boucher-Genesse avatar image
Francois Boucher-Genesse asked

Validating purchases in the server API

Hello,

We're currently handling subscription on Google Play with the private preview membership feature. The system works fine to ensure that all clients are legitimately subscribed. When the client logs in, it checks if a local receipt exists. If none is found, it checks in the player data if there are receipts from other devices. Then the client uses ValidateGooglePlayPurchase to validate the receipt. This system allows us to give memberships across different platforms. Ideally, all of that logic would be done atomically in cloudscripts / azure functions, but that requires Validate[Platform]Purchase to be available in the server API.

The current status of subscriptions is updated when players open their client, but if they unsubscribe through the OS and never go back to the app (a scenario we imagine will be quite frequent), PlayFab will never know that this subscription is now invalid. Same thing if a user just doesn't log to the client for a few months - we won't know whether or not that subscription is still valid.

The ideal scenario would be to be notified the moment a user unsubscribes, has an invalid payment, etc. Google Play and Apple both have server to server notification systems, which call an endpoint to notify that some change occurred to the subscription status. We could set a webhook in Azure, but for both platforms we still then need to validate the receipt with platform holders to get the actual status of the subscription. Ideally we would leverage PlayFab's existing code to do this, using a method like ValidateGooglePlayPurchase, which handles the communication with the platform and updates the membership status. Again, Validate[Platform]Purchase methods would need to be available in the server API. We can't use client API methods in cloudscripts or azure functions, since we could get rate limited due to these calls coming from the same IP address.

We could implement communications with platform holders directly from cloudscripts or azure functions, but at that point we're duplicating a lot of logic that playfab already implemented.

So my question is: are you planning on making the Validate[Platform]Purchase methods available from the server API? If not, am I missing some other way to get notified when the subscription status changes?

Thanks for your help!

apis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

Since Subscription, along with Membership feature, is still in private preview, you may need to send a ticket to us for dedicated assistance on this issue.

However, according to my experience, if the scenario is to manually modify the Membership status in some circumstances, PlayFab does provide such API for an explicit override to the expiration time on memberships, so that players in bad states can be manually adjusted. This override can be set via game manager, or the API.

We may dig into it and provide more information if you can create a support ticket. Thanks for the understanding.

Moreover, it will be appreciated if you can send a thread on Feature Requests forum on https://community.playfab.com/spaces/24/index.html

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Francois Boucher-Genesse avatar image Francois Boucher-Genesse commented ·

Hi @SethDu, Understood, will do. I'm trying to have a fully automated solution, so manually modifying the Membership status isn't ideal. As you point out, we can also modify it with the API, but that's only a small part of what we need. I'm also trying to prevent calls to platform holders such as Google's purchases.products/get. PlayFab already does this for us on the client. Thanks!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.