Solved

What would be the best approach to know the transactions in case of any purchase/renewal or similar events?

  • 3 September 2021
  • 3 replies
  • 68 views

Badge +5

We want to apply additional business logic based on customers’ billing related transactions like subscription/renewal etc. on the server side.

For eg : Whenever there is a paid subscription by a user, provide some incentives or something similar.

What would be the best approach in order to get the transactions information?

  1. Is there an API which we can poll for transactions from the server at regular intervals? 
  2. Will Webhooks solve this problem? Where can I find some examples of Webhooks?

We are currently using Free plan. 

icon

Best answer by Björn Wagner 3 September 2021, 12:56

View original

3 replies

Badge +3

Hi, 
I am currently experimenting with Webhooks and I guess that would be the perfect fit for you, as they support specific event types. Once the event was triggered, you can run custom code to grant the benefits you described.

A list with supported types can be found here: https://docs.revenuecat.com/v1.2/docs/webhooks#event-types

There is also a RestAPI that can be used to pull information about a subscriber: https://docs.revenuecat.com/reference#subscribers

Hope this helps :)

Badge +5

Hi @Björn Wagner 

Thank you for the reply.

Will try the Webhooks feature for sure. The API to pull the subscribers information looks costlier as this has to be done per customer.

Any examples if you can point out for the Webhooks feature.

Thanks

Userlevel 5
Badge +9

+1 to the suggestion to use webhooks provided by @Björn Wagner. For a backend example you can take a look at our Firebase sample code which catches webhooks. You can also take a look at this guide which implements automated cancellation surveys using Zapier and RevenueCat webhooks. While neither probably fits your use case exactly, they can show you real-world examples of how webhooks can be used to achieve something like you want to do.

Reply