I’m creating a webbapp (web + ios + android) and I’m setting up a minimal subscription support, using Revenuecat as source of truth.
My implementation:
The bakend receives a webhook call both from RevenueCat or for the frontend (when subscription succeeded). It just tates revenuecat app_user_id field OR the user_id (if is a frontend call, which is the same as app_user_id), and checks against RevenueCat the user entitlements, updating the associated entitlement object in the backend database. We dont care about different fields for each event kind
Summary:
Each time something happens (event), my backend doesn’t even care about the payload of the call, it just update entielements expiration in the database. This allow me to be completely agnostic to the platforms: IF SOMETHING HAPPENS → UPDATE ENTITLEMENTS.
The problem comes to present a Manage Subscription button in the frontend. Because I don’t know or store the platform through the user has subscribed to my App.
That leaves me to the question itself: How can get the managementUrl of the active user subscription that granted an entitlement, having only user id, id of the entitlement granted, and project id?
Hi! Our Get Subscriber endpoint will include the management URL for a user, which you can call using the app user ID that you have.
Hello! Thanks for the response.
The question about that endpoint is: What happens if the user have entitlements in two platforms same time? Shouln’t be per-entitlement the managementUrl? Is that the last entitlement managementUrl? What if a user re-suscribe (entitlement gain) through other plaftorm, is this updated?
I understand my comments are kind of edge cases, but that’s all about and more when regarding to payments, not allowing them.
Thank you!
Hi! You’re welcome!
I am happy to answer any questions about edge cases.
Here is an excerpt from our documentation on the endpoint that should cover your questions regarding multiple subscriptions:
If the Customer has multiple active subscriptions for different platforms, this will take the value of the OS in the
X-Platform
header into consideration:
- If the request was made on an OS for which there are active subscriptions, this will return the URL for the store that matches the header.
- If the request was made on a different OS or the OS was not included in the X-Platform header, this will return the URL for the store of the subscription with the farthest future expiration date.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.