Skip to main content
Question

Syncing Backend with User's IAP Subscription Status in Flutter Projec

  • 28 October 2023
  • 1 reply
  • 219 views

Forum|alt.badge.img+2

Hello Everyone,

I am currently utilizing the RevenueCat SDK in my Flutter project to manage in-app purchases, specifically, monitoring real-time changes in users' subscription statuses. The SDK has been instrumental in achieving this on the client-side, and now, I am looking to sync this data with my backend.

In my backend (which is developed using the Elixir/Phoenix framework), I have a database table where I would like to maintain a record of whether a user is subscribed or not. The main goal is to ensure that the subscription status in my backend is always in sync with the real-time status on the client-side.

Here are my thoughts so far:

  1. One way could be to send the subscription status from the client to the backend every time there is a change. However, I am concerned about the reliability and timeliness of this approach.
  2. Another approach could be to use webhooks, but I am not entirely sure how to set this up with RevenueCat and Flutter.

I am very interested to hear if anyone has encountered a similar scenario and how you tackled it. Are there any best practices or recommended approaches for syncing the backend with the user's IAP status in a RevenueCat-Flutter setup? Your insights and experiences would be invaluable as I work towards a robust solution.

Thank you in advance for your help and guidance!

1 reply

Ryan Glanz
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 364 replies
  • November 1, 2023

Hi, 

 

Happy to help here. I would recommend using webhooks for this: https://www.revenuecat.com/docs/webhooks#syncing-subscription-status

 

Essentially, whenever your server receives a webhook from us, you can call our GET /subscribers endpoint to get the customerInfo and use that to update your backend.


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