Skip to main content
Solved

Unity Subscription Renew Log

  • 11 November 2021
  • 1 reply
  • 91 views

Forum|alt.badge.img+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!

Best answer by sharif

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.

View original
Did this post help you find an answer to your question?

1 reply

sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • Answer
  • November 12, 2021

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings