Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by ryan-3 · May 22, 2020 at 06:08 PM · In-Game Economy

How do I update a user's subscription?

I'm making a mobile app in Unity. I have successfully set up a subscription in Google Play and PlayFab so that Android users can sign up for it through Unity IAP, and their receipt is validated so they get the membership in PlayFab. Great!

For testing purposes, Google's subscriptions renew every 5 minutes. At the end of the renewal period, Google "bills" me again. However, the subscription lapses in PlayFab! How do I get the billing info from Google, and give it to PlayFab so the subscription stays active?

Thanks,

Ryan

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · May 22, 2020 at 07:28 PM

If you check the instructions sent when you were added to the beta, this is the relevant section:

"Today, PlayFab does not manage the auto renewable of these subscriptions. The client must validate new receipts for renewals with PlayFab. Both Apple and Google support re-validating the same original receipt multiple times for updates to the subscriptions. Additionally, the client can check for new transactions on login, and if there any new ones, validate them with PlayFab. Subscriptions also cannot be transferred between players (except in the case of iOS refresh receipts). That is, the first player to validate a subscription will be the sole player who is allowed to update that subscription. However, PlayFab provides customer support 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 using the API."

So, to process renewal, you need to re-submit the receipt from the client.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by ryan-3 · May 25, 2020 at 06:03 AM

@Brendan Right. My confusion stems from this part: "The client must validate new receipts for renewals with PlayFab. Both Apple and Google support re-validating the same original receipt multiple times for updates to the subscriptions. Additionally, the client can check for new transactions on login, and if there any new ones, validate them with PlayFab."

Just to confirm, for guidance on getting updates for the original receipt, and checking for new transactions at login, I should be looking in the Google Play documentation?

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by ryan-3 · May 28, 2020 at 03:08 AM

Got it working now! Here's what I needed specifically, in case anyone else finds the process opaque:

1) I followed PlayFab's Getting Started w/ Unity Android Guide here:
https://docs.microsoft.com/en-us/gaming/playfab/features/commerce/economy/getting-started-with-unity-iap-android

You can use the same BuyProductID function for normal IAP one-time purchases as well as subscriptions. However, when using it for a subscription, you'll want to:

2) Edit the ProcessPurchase function so that it saves e.purchasedProduct. Since this is a Unity class, I made my own JSON wrapper with fields that match up to it. You can store this locally on the device, but I recommend using Player Data so auto renewal can occur from any device the account signs into.

3) In order to check whether a user has a membership, use GetPlayerProfile with ShowMemberships=true. Make sure you also give clients permission to view that; they don't have it by default. Make this call whenever is most reasonable for you (I chose on login and on purchase), and you can search the returned profile for a membership ID to see when it expires (and thus decide whether or not they get membership benefits at runtime).

4) Finally, if the membership has expired, you can "auto renew" by calling ValidateGooglePlayPurchase again, passing in the purchasedProduct you saved in step 2. This is what "re-validating the same original receipt multiple times" means in (in my opinion) clearer terms.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    1 Person is following this question.

    avatar image

    Related Questions

    Facebook Canvas Async Payment error states 2 Answers

    Facebook Purchase Items scrape as og:type="website" 2 Answers

    iOS Reciept Validation Failed - Request Timeout 16 Answers

    Store with random items 1 Answer

    Using PlayFab to purchase Steam items 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges