Jul 31, 2024 Replies: 18 RevenueCat is a platform that simplifies in-app subscriptions and purchases for mobile apps. It provides tools for managing subscription billing, analytics, and user retention across iOS, Android, and web, without needing to build a backend. Usage is free for apps with less than $2,500 in monthly tracked revenue (MTR). Build and Grow Your App Business | RevenueCat The world’s best apps use RevenueCat to power in-app purchases, manage customer data, and grow revenue across iOS, Android, and the web. www.revenuecat.com I use the library in CleanTasks and Lognote, I have only tested the whole thing in B4I. The RevenueCatPurchaseHelper class now makes it even easier to integrate revenuecat into your apps. Complete video guide for setting up and implementing: In App subscriptions with RevenueCat and AS_PremiumSummary [Videos] In this tutorial I will show you how to create subscriptions in the Apple Developer console, how to link them with revenuecat, how to integrate the B4X-RevenueCat SDK in the app and how to present the whole thing to the customer in the app with AS_Settings and AS_PremiumSubscription. The... www.b4x.com Setup Add this code to the "Main" module of your b4i project under Process_Globals B4X: Public HasPremium As Boolean = False Example B4X: Sub Class_Globals Private PurchaseHelper As RevenueCatPurchaseHelper End Sub B4X: PurchaseHelper.Initialize(Me,"PurchaseHelper","YourRevenueCatApiKey") 'Add your RevenueCat API key PurchaseHelper.ProductIndentififer = Array As String("all_access_1_month_lognote","all_access_1_year_lognote") 'The Product identifyer B4X: Wait For (PurchaseHelper.CheckPurchases) complete (Success As Boolean) 'Must be called at app start, as we check here whether the user has the Premium version Log("Do I have a premium version? " & Success) Wait For (PurchaseHelper.GetProductsInformation(PurchaseHelper.ProductIndentififer)) complete (lstPurchases As List) For Each ProductInfo As ProductInformation In lstPurchases 'Log(ProductInfo.Tag) 'Log(ProductInfo.Description) CustomListView1.AddTextItem(ProductInfo.Title & " - " & ProductInfo.LocalizedPrice,ProductInfo.ProductIdentifier) Next [CODE lang="b4x" title="Make payment"]Wait For (PurchaseHelper.RequestPayment(Value)) Complete (Success As Boolean)[/CODE] Message Boxes The texts in the message boxes are predefined, but in case you want to customize them, you can do so: B4X: PurchaseHelper.RestoreErrorTitle = "Restore failed" PurchaseHelper.RestoreErrorDescription = "No purchases found To restore." PurchaseHelper.RestoreSuccessTitle = "Recovery successful" PurchaseHelper.RestoreSuccessDescription = "Your purchases have been successfully restored" PurchaseHelper.ProVersionExpired = "The Pro version has been canceled Or Not renewed, you are now using the basic version." PurchaseHelper.ProVersionExpiredTitle = "Pro Version expired" PurchaseHelper.PurchaseErrorTitle = "Purchase Failed" PurchaseHelper.PurchaseErrorDescription = "Purchase was cancelled." PurchaseHelper.PurchaseSuccessTitle = "You are now ready to go" PurchaseHelper.PurchaseSuccessDescription = "Your purchase was successful." RevenueCat Author: Alexander Stolte Version: 1.01 RevenueCat Functions: CreatePurchase (ProductId As String, Product As Object) As ResumableSub Records a purchase for a Customer from iOS, Android, or Stripe and will create a Customer if they don't already exist. https://www.revenuecat.com/docs/api-v1#tag/transactions/operation/receipts Product - In B4I the ProductInformation Object in B4A the Receipt Token GetCustomer As ResumableSub Gets the latest Customer Info for the customer with the given App User ID, or creates a new customer if it doesn't exist. https://www.revenuecat.com/docs/api-v1#tag/customers/operation/subscribers Initialize (API_KEY As String, AppUserId As String, lst_ProductIdentifier As List) Initializes the object. You can add parameters to this method if needed. <code>RevCat.Initialize("RevenueCatAPIKey",RevCatUserId,Array As String("all_access_1_year","all_access_1_month"))</code> RevenueCatPurchaseHelper Functions: CheckPurchases As ResumableSub GetProductsInformation (ProductIndentififer As String) As ResumableSub Returns a list of ProductInformation GUID As String Initialize (Callback As Object, EventName As String, RevenueCatAPIKey As String) Initializes the object. You can add parameters to this method if needed. RequestPayment (ProductIdentifier As String) As ResumableSub RestorePurchases As ResumableSub Properties: isExpired As Boolean [read only] ProductIndentififer As String() ProVersionExpired As String ProVersionExpiredTitle As String PurchaseErrorDescription As String PurchaseErrorTitle As String PurchaseSuccessDescription As String PurchaseSuccessTitle As String RestoreErrorDescription As String RestoreErrorTitle As String RestoreSuccessDescription As String RestoreSuccessTitle As String Changelog 1.00 Release 1.01 Improvements Remove is_restore from CreatePurchase The parameter is Deprecated Add class RevenueCatPurchaseHelper - Takes care of almost everything Saving and restoring user tokens Checking Purchasing status Restore Messageboxes 1.02 BugFixes Have Fun If you have errors or questions, then please create a new thread Attachments RevenueCat Example.zip RevenueCat Example.zip 4.4 KB · Views: 22 RevenueCat.b4xlib RevenueCat.b4xlib 6.1 KB · Views: 16 Last edited: Mar 9, 2025 Click to expand...
RevenueCat is a platform that simplifies in-app subscriptions and purchases for mobile apps. It provides tools for managing subscription billing, analytics, and user retention across iOS, Android, and web, without needing to build a backend. Usage is free for apps with less than $2,500 in monthly tracked revenue (MTR). Build and Grow Your App Business | RevenueCat The world’s best apps use RevenueCat to power in-app purchases, manage customer data, and grow revenue across iOS, Android, and the web. www.revenuecat.com I use the library in CleanTasks and Lognote, I have only tested the whole thing in B4I. The RevenueCatPurchaseHelper class now makes it even easier to integrate revenuecat into your apps. Complete video guide for setting up and implementing: In App subscriptions with RevenueCat and AS_PremiumSummary [Videos] In this tutorial I will show you how to create subscriptions in the Apple Developer console, how to link them with revenuecat, how to integrate the B4X-RevenueCat SDK in the app and how to present the whole thing to the customer in the app with AS_Settings and AS_PremiumSubscription. The... www.b4x.com Setup Add this code to the "Main" module of your b4i project under Process_Globals B4X: Public HasPremium As Boolean = False Example B4X: Sub Class_Globals Private PurchaseHelper As RevenueCatPurchaseHelper End Sub B4X: PurchaseHelper.Initialize(Me,"PurchaseHelper","YourRevenueCatApiKey") 'Add your RevenueCat API key PurchaseHelper.ProductIndentififer = Array As String("all_access_1_month_lognote","all_access_1_year_lognote") 'The Product identifyer B4X: Wait For (PurchaseHelper.CheckPurchases) complete (Success As Boolean) 'Must be called at app start, as we check here whether the user has the Premium version Log("Do I have a premium version? " & Success) Wait For (PurchaseHelper.GetProductsInformation(PurchaseHelper.ProductIndentififer)) complete (lstPurchases As List) For Each ProductInfo As ProductInformation In lstPurchases 'Log(ProductInfo.Tag) 'Log(ProductInfo.Description) CustomListView1.AddTextItem(ProductInfo.Title & " - " & ProductInfo.LocalizedPrice,ProductInfo.ProductIdentifier) Next [CODE lang="b4x" title="Make payment"]Wait For (PurchaseHelper.RequestPayment(Value)) Complete (Success As Boolean)[/CODE] Message Boxes The texts in the message boxes are predefined, but in case you want to customize them, you can do so: B4X: PurchaseHelper.RestoreErrorTitle = "Restore failed" PurchaseHelper.RestoreErrorDescription = "No purchases found To restore." PurchaseHelper.RestoreSuccessTitle = "Recovery successful" PurchaseHelper.RestoreSuccessDescription = "Your purchases have been successfully restored" PurchaseHelper.ProVersionExpired = "The Pro version has been canceled Or Not renewed, you are now using the basic version." PurchaseHelper.ProVersionExpiredTitle = "Pro Version expired" PurchaseHelper.PurchaseErrorTitle = "Purchase Failed" PurchaseHelper.PurchaseErrorDescription = "Purchase was cancelled." PurchaseHelper.PurchaseSuccessTitle = "You are now ready to go" PurchaseHelper.PurchaseSuccessDescription = "Your purchase was successful." RevenueCat Author: Alexander Stolte Version: 1.01 RevenueCat Functions: CreatePurchase (ProductId As String, Product As Object) As ResumableSub Records a purchase for a Customer from iOS, Android, or Stripe and will create a Customer if they don't already exist. https://www.revenuecat.com/docs/api-v1#tag/transactions/operation/receipts Product - In B4I the ProductInformation Object in B4A the Receipt Token GetCustomer As ResumableSub Gets the latest Customer Info for the customer with the given App User ID, or creates a new customer if it doesn't exist. https://www.revenuecat.com/docs/api-v1#tag/customers/operation/subscribers Initialize (API_KEY As String, AppUserId As String, lst_ProductIdentifier As List) Initializes the object. You can add parameters to this method if needed. <code>RevCat.Initialize("RevenueCatAPIKey",RevCatUserId,Array As String("all_access_1_year","all_access_1_month"))</code> RevenueCatPurchaseHelper Functions: CheckPurchases As ResumableSub GetProductsInformation (ProductIndentififer As String) As ResumableSub Returns a list of ProductInformation GUID As String Initialize (Callback As Object, EventName As String, RevenueCatAPIKey As String) Initializes the object. You can add parameters to this method if needed. RequestPayment (ProductIdentifier As String) As ResumableSub RestorePurchases As ResumableSub Properties: isExpired As Boolean [read only] ProductIndentififer As String() ProVersionExpired As String ProVersionExpiredTitle As String PurchaseErrorDescription As String PurchaseErrorTitle As String PurchaseSuccessDescription As String PurchaseSuccessTitle As String RestoreErrorDescription As String RestoreErrorTitle As String RestoreSuccessDescription As String RestoreSuccessTitle As String Changelog 1.00 Release 1.01 Improvements Remove is_restore from CreatePurchase The parameter is Deprecated Add class RevenueCatPurchaseHelper - Takes care of almost everything Saving and restoring user tokens Checking Purchasing status Restore Messageboxes 1.02 BugFixes Have Fun If you have errors or questions, then please create a new thread
C Cristian Achim Member Licensed User Longtime User Aug 1, 2024 #2 Hi! I replaced B4X: RevCat.Initialize("RevenueCatAPIKey",RevCatUserId,Array As String("all_access_1_year","all_access_1_month")) with B4X: RevCat.Initialize("appl_BwXDhxxxxxxxxxxxxxxx", RevCatUserId, Array As String("rto_silver", "rto_gold", "rto_platinum")) and I received this error: B4X: ResponseError: request completed with error, status code: 404 {"code":7117,"message":"Page not found."} 01/01/1970 02:00:00 Has Premium? false Also I see that B4X: Dim RevCatUserId As String = KeyValue.GetDefault("RevCatUserId",RevCat.GUID) Log(RevCatUserId) (empty string) Is there anything else to change? Last edited: Aug 1, 2024
Hi! I replaced B4X: RevCat.Initialize("RevenueCatAPIKey",RevCatUserId,Array As String("all_access_1_year","all_access_1_month")) with B4X: RevCat.Initialize("appl_BwXDhxxxxxxxxxxxxxxx", RevCatUserId, Array As String("rto_silver", "rto_gold", "rto_platinum")) and I received this error: B4X: ResponseError: request completed with error, status code: 404 {"code":7117,"message":"Page not found."} 01/01/1970 02:00:00 Has Premium? false Also I see that B4X: Dim RevCatUserId As String = KeyValue.GetDefault("RevCatUserId",RevCat.GUID) Log(RevCatUserId) (empty string) Is there anything else to change?
Alexander Stolte Expert Licensed User Longtime User Aug 1, 2024 #3 Cristian Achim said: and I received this error: Click to expand... Make sure you have followed all the steps in the documentation: iStore - In App Purchases The iStore library allows you to use the store In-App Purchases features inside your app. You can let the user purchase digital products from inside your app. (Unsurprisingly) the configuration required is a bit tedious. In order to test this feature (and later release it) you need to create... www.b4x.com Setting up RevenueCat | In-App Subscriptions Made Easy – RevenueCat Register for a free account www.revenuecat.com only when you see all products from the apple dev console in revenuecat can you start testing.
Cristian Achim said: and I received this error: Click to expand... Make sure you have followed all the steps in the documentation: iStore - In App Purchases The iStore library allows you to use the store In-App Purchases features inside your app. You can let the user purchase digital products from inside your app. (Unsurprisingly) the configuration required is a bit tedious. In order to test this feature (and later release it) you need to create... www.b4x.com Setting up RevenueCat | In-App Subscriptions Made Easy – RevenueCat Register for a free account www.revenuecat.com only when you see all products from the apple dev console in revenuecat can you start testing.
C Cristian Achim Member Licensed User Longtime User Aug 1, 2024 #4 I already made all steps. The products in RevenueCat, I imported them from App Store, I didn't create them manually. That means that App Store communicate with RevenueCat. Thank you!
I already made all steps. The products in RevenueCat, I imported them from App Store, I didn't create them manually. That means that App Store communicate with RevenueCat. Thank you!
Alexander Stolte Expert Licensed User Longtime User Aug 1, 2024 #5 I have updated the example project, the user id is now saved. It is best to execute the following again after initializing: B4X: KeyValue.Remove("RevCatUserId")
I have updated the example project, the user id is now saved. It is best to execute the following again after initializing: B4X: KeyValue.Remove("RevCatUserId")
Alexander Stolte Expert Licensed User Longtime User Aug 1, 2024 #6 Alexander Stolte said: It is best to execute the following again after initializing: B4X: KeyValue.Remove("RevCatUserId") Click to expand... So that your empty string is removed and assigned a correct value. You can then delete the line again.
Alexander Stolte said: It is best to execute the following again after initializing: B4X: KeyValue.Remove("RevCatUserId") Click to expand... So that your empty string is removed and assigned a correct value. You can then delete the line again.
C Cristian Achim Member Licensed User Longtime User Aug 1, 2024 #7 Still not working I think RevCat.GUID doesn't generate anything. Is mandatory to create an integration like Webhook or else in RevenueCat?
Still not working I think RevCat.GUID doesn't generate anything. Is mandatory to create an integration like Webhook or else in RevenueCat?
Alexander Stolte Expert Licensed User Longtime User Aug 1, 2024 #8 Cristian Achim said: I think RevCat.GUID doesn't generate anything. Click to expand... Yes, because an empty string has already been saved! Delete the key and execute the code again. Cristian Achim said: Is mandatory to create an integration like Webhook or else in RevenueCat? Click to expand... I dont think so.
Cristian Achim said: I think RevCat.GUID doesn't generate anything. Click to expand... Yes, because an empty string has already been saved! Delete the key and execute the code again. Cristian Achim said: Is mandatory to create an integration like Webhook or else in RevenueCat? Click to expand... I dont think so.
Alexander Stolte Expert Licensed User Longtime User Aug 1, 2024 #12 I'm using this exact code: [B4X] GUID Sub GUID As String Dim sb As StringBuilder sb.Initialize For Each stp As Int In Array(8, 4, 4, 4, 12) If sb.Length > 0 Then sb.Append("-") For n = 1 To stp Dim c As Int = Rnd(0, 16) If c < 10 Then c = c + 48 Else c = c + 55... www.b4x.com
I'm using this exact code: [B4X] GUID Sub GUID As String Dim sb As StringBuilder sb.Initialize For Each stp As Int In Array(8, 4, 4, 4, 12) If sb.Length > 0 Then sb.Append("-") For n = 1 To stp Dim c As Int = Rnd(0, 16) If c < 10 Then c = c + 48 Else c = c + 55... www.b4x.com
C Cristian Achim Member Licensed User Longtime User Aug 1, 2024 #13 Alexander Stolte said: I'm using this exact code: [B4X] GUID Sub GUID As String Dim sb As StringBuilder sb.Initialize For Each stp As Int In Array(8, 4, 4, 4, 12) If sb.Length > 0 Then sb.Append("-") For n = 1 To stp Dim c As Int = Rnd(0, 16) If c < 10 Then c = c + 48 Else c = c + 55... www.b4x.com Click to expand... That's how it works. Thank you very much for your patience.
Alexander Stolte said: I'm using this exact code: [B4X] GUID Sub GUID As String Dim sb As StringBuilder sb.Initialize For Each stp As Int In Array(8, 4, 4, 4, 12) If sb.Length > 0 Then sb.Append("-") For n = 1 To stp Dim c As Int = Rnd(0, 16) If c < 10 Then c = c + 48 Else c = c + 55... www.b4x.com Click to expand... That's how it works. Thank you very much for your patience.
Alexander Stolte Expert Licensed User Longtime User Aug 1, 2024 #14 Cristian Achim said: hat's how it works. Thank you very much for your patience. Click to expand... yes, but the code has to work, regardless of whether it is in my class or separated code. Its working now with the code in the link?
Cristian Achim said: hat's how it works. Thank you very much for your patience. Click to expand... yes, but the code has to work, regardless of whether it is in my class or separated code. Its working now with the code in the link?
C Cristian Achim Member Licensed User Longtime User Aug 1, 2024 #15 Alexander Stolte said: yes, but the code has to work, regardless of whether it is in my class or separated code. Its working now with the code in the link? Click to expand... Now I have problem on purchase
Alexander Stolte said: yes, but the code has to work, regardless of whether it is in my class or separated code. Its working now with the code in the link? Click to expand... Now I have problem on purchase
Alexander Stolte Expert Licensed User Longtime User Aug 1, 2024 #16 Cristian Achim said: Now I have problem on purchase Click to expand... Please make a new thread for further questions, thanks
Cristian Achim said: Now I have problem on purchase Click to expand... Please make a new thread for further questions, thanks
Robert Valentino Well-Known Member Licensed User Longtime User Aug 5, 2024 #17 Be nice to see example for B4a Maybe help some of us take Google out of the loop PS: Looks nice and promising Last edited: Aug 7, 2024
Be nice to see example for B4a Maybe help some of us take Google out of the loop PS: Looks nice and promising
Alexander Stolte Expert Licensed User Longtime User Dec 5, 2024 #18 Update 1.01 Improvements Remove is_restore from CreatePurchase The parameter is Deprecated Add class RevenueCatPurchaseHelper - Takes care of almost everything Saving and restoring user tokens Checking Purchasing status Restore Messageboxes The RevenueCatPurchaseHelper class now makes it even easier to integrate revenuecat into your apps. Example project updated Github repo: GitHub - StolteX/B4X-RevenueCat Contribute to StolteX/B4X-RevenueCat development by creating an account on GitHub. github.com
Update 1.01 Improvements Remove is_restore from CreatePurchase The parameter is Deprecated Add class RevenueCatPurchaseHelper - Takes care of almost everything Saving and restoring user tokens Checking Purchasing status Restore Messageboxes The RevenueCatPurchaseHelper class now makes it even easier to integrate revenuecat into your apps. Example project updated Github repo: GitHub - StolteX/B4X-RevenueCat Contribute to StolteX/B4X-RevenueCat development by creating an account on GitHub. github.com
Alexander Stolte Expert Licensed User Longtime User Mar 9, 2025 #19 Update 1.02 BugFixes Very important update! For example, if a user upgraded from monthly to yearly, there were problems finding the active subscription. This is now fixed.
Update 1.02 BugFixes Very important update! For example, if a user upgraded from monthly to yearly, there were problems finding the active subscription. This is now fixed.