About Auto-Renewing Subscription Time

Hello, I am facing a confusing situation regarding auto-renewing subscriptions. I’ve read a lot of threads on the forum but couldn’t come to a definitive conclusion. Sorry if I forgot a title.

What do I want?

I want to give rewards every renewal period with weekly subscription. (ex: 100 Gold per subscription renewal)

What’s happening ?
for Android , Unity 2021.3.6f1 , Uniy IAP v4.4.1

- I upload the app to Internal Test and download it to my device
- I launch the app and successfully sign up as a tester (receiving my first reward) ( GPA.XXXX.XXXX )
- At the same time, I display information about the receipt in the logs. With .getSubscriptionInfo() I get information about the receipt. purchase date, expiry date, member etc.
The time that should be 5 minutes on the test account is not correct (I guess because Unity IAP calculates it by itself)
- At the end of 5 minutes, my order is renewed on the Google Play Console. (GPA.XXXX.XXXX…1)
- When I restart the game, the only thing that changes is the time remaining in the recipt.

Questions :
- What should happen after 5 test minutes?
* In some titles it says that ProcessPurchase works at every refresh, in some titles it says it is not expected to work. Which one is right?

- Assuming ProcessPurchase won’t be triggered, I guess I need to do a time based calculation for this.
* Do I need to keep the expiration date locally and compare it to the next expiration date? (I’m assuming you continue to subscribe)
* Or do I have to go somehow using the purchase date for this?
Or is it ok to use these methods?

- I get “orderId” in GooglePurchaseData but it doesn’t show as …1 or …2 like in store so I can’t compare here either. (You get this directly from google, you do not add or remove, I read it in another thread)

In short, I’m not clear on what’s going on during the weekly auto-refresh. I realize there are shop-based differences, but I’m really confused on how to proceed. I know it’s been long, I hope I was clear.

Kind regards.

By the way, it works fine for iOS. ProcesPurchase is triggered at application launch when membership is renew. i hope someone can tell that this is related to android test environment and it is triggered properly in real environment.

You will want to inspect the receipt each time the app launches. You should be able to view the properties and see if a renewal has occurred. You can also use SubscriptionManager https://docs.unity3d.com/Packages/com.unity.purchasing@4.4/api/UnityEngine.Purchasing.SubscriptionManager.html

Mentioned above, I only get the remaining date that Subscriber Manager changed locally. (Because google does not give expiration date)

there is an automatic renewal on the IOS platform in sandbox mode on the renew day.

My question is we can’t get the test time while testing on Android. 1 week is shown as the remaining time.

Will the receipt be renewed and the expiration date changed when this one week period expires? Or is there a way I can test this on the tester?

I’m trying to understand whether the problem is caused by me or the android test environment.

Testing a weekly subscription on Google takes 5 minutes, as you mentioned.
https://developer.android.com/google/play/billing/test#renewals We only have the information that is contained in the receipt. Unity IAP is a pass-through service for the store APIs. I am suggesting that you inspect the receipt yourself, it’s in clear text. On a device, you can use Debug.Log to print out the receipt, it will then show in the device logs for inspection. Also, ProcessPurchase is not expected to trigger on renewal.

@Goncolo Upon reflection, I do recall that we may have made a change a year or two ago where the ask from the customer was to map the 5 minutes to one week in the SubscriptionManager, or similar. Sorry for the confusion, if so. Directly inspecting your receipts and comparing them before and after a renewal should help.

actually yes, I have read many of your answers in the past years, I have benefited a lot. I read an article on this topic in a topic that you changed from test time to real renewal time. It was a problem caused by the information provided by google. anyway thanks for the solution. I guess testing the google side is a bit more painful.

I couldn’t get a change in the receipt during the renewal process, so I asked. the best is to exit test mode, buy with real money and wait 1 week and see. thanks for your answers.

Can you share a before and after receipt?