Solved

Unity Subscription Renew Log

  • 11 November 2021
  • 1 reply
  • 73 views

Badge +1

Hello, 

 

I want to send a log to our logger system when a purchase success.

 

I can get subscription started log from PurchaseProduct method’s callback. But I can’t find a way to send a log when subscription renewed. For example, Unity IAP system was sending a purchase log at the first opening after the player renewing their subscription. 

 

PurchaseProduct Method:


private MakePurchaseFunc MakePurchaseCallback { get; set; }

public void PurchaseProduct(string productIdentifier, MakePurchaseFunc callback,
string type = "subs", string oldSku = null, ProrationMode prorationMode = ProrationMode.UnknownSubscriptionUpgradeDowngradePolicy)
{
MakePurchaseCallback = callback;
_wrapper.PurchaseProduct(productIdentifier, type, oldSku, prorationMode);
}

 

I can see this logs from your Customer History

 

Thank you!

icon

Best answer by sharif 12 November 2021, 21:14

View original

1 reply

Userlevel 5
Badge +9

The logs you see in the customer history are actually generated server-side. RevenueCat uses a combination of refreshing the fetch token and listening to Apple’s/Google’s/Stripe’s server to server notifications to keep the user’s history up to date. There isn’t a good solution to do this on the device since there’s no guarantee the user will ever open your app when a renewal occurs so that you can log the renewal.

Instead, my recommendation is to listen to RevenueCat’s webhooks on a server (Firebase works very well for this) and store them in a database that your app can use to look up the user’s subscription history. You should also connect Google’s server to server notifications to RevenueCat to reduce the time it takes to detect renewals.

Reply