Question

Implementing a Complex Subscription Model with Periodic Credit Grants Using RevenueCat

  • 13 April 2024
  • 2 replies
  • 13 views

Badge

Hello,

My iOS app features a rather intricate subscription model. Users have the option to subscribe monthly or annually, with each subscription period granting them a specific number of credits (e.g., 100 credits/month or 1200 credits/year). Ideally, customers should receive these credits immediately upon their initial subscription or each time their subscription renews automatically. However, the standard subscription options don't support this functionality with simple settings, necessitating a custom solution on my part as the developer.

Firstly, I'm wondering if RevenueCat offers a straightforward solution to implement this subscription model? I've searched online resources but haven't come across any suitable solutions.

Secondly, if there isn't a simple solution available, I'd like to outline my proposed approach for addressing this issue and inquire about how I can achieve it with RevenueCat's assistance. My plan involves crediting the users' accounts each time they subscribe or renew their subscription, and then storing this information on a server such as Firebase. Identifying when a user subscribes for the first time is straightforward if it's done within the app. However, I'm uncertain about how to capture the information when a subscription renews automatically. Additionally, relying solely on app activity may not suffice, as users may not interact with the app for extended periods. To address this, I'm considering maintaining a comprehensive record of all subscription periods that the customer has paid for, possibly including unique identifiers, allowing me to credit the appropriate amount of credits once I receive notification of each subscription period. However, I haven't been able to identify a corresponding property in any of the RevenueCat classes/structs that I've found online. Could you please provide guidance on this matter?

Thank you in advance.


This post has been closed for comments

2 replies

Userlevel 4
Badge +8

Hi, you can definitely use RevenueCat for this case. I would suggest making a subscription to unlock an entitlement that grants 100 credits/month or 1200 credits/year. Using entitlements this way you can easily make this auto-renewing for the user and these entitlements can be tracked. This would involve implementation on your side, but you could keep a running count of the coins that user has on their end and allow them to use those coins for whatever they want to unlock in your app – one place you could store these coins is in Firebase like you suggested. 

To keep track of events, I recommend implementing our webhooks where you can listen to INITIAL_PURCHASE and RENEWAL events for knowing when to grant and update the credits for your users.

Please see our documentation here for more information on entitlements, Firebase with RevenueCat, and Webhooks:
 https://www.revenuecat.com/docs/entitlements#entitlements

https://www.revenuecat.com/docs/integrations/third-party-integrations/firebase-integration

https://www.revenuecat.com/docs/integrations/webhooks

Badge

Hello Haley,

Thank you very much for your response and the detailed information provided. I've had a quick look at the documents you sent. Before delving deeper into Webhooks and Firebase integration, I'd like to clarify a few points that are on my mind.

I want to acknowledge that I'm quite new to this field and my knowledge of the tools and their capabilities is limited.

Firstly, my understanding is that to enable Webhooks, I would need a private server that runs continuously, which is something I currently lack and cannot accommodate for my project. In light of this, Webhooks may not be a suitable solution for me. Please correct me if I'm mistaken.

Secondly, concerning Firebase integration, it appears that it could potentially address my issue. However, there are specific points I need clarification on. I intend to grant credits only at the moment of renewing or purchasing a monthly subscription, which means the granting will occur at a fixed point in time. I cannot grant credits by merely checking for a subscription status at any arbitrary time. This is because a user might launch my app on another device using the same App Store ID or anonymously somehow. If I were to check the subscription status each time under such circumstances, the user would receive extra credits. Would this logic be feasible within the RevenueCat-Firebase integration?

Once again, thank you for your assistance.