Are there any plans for an official Capacitor plugin?


Userlevel 1
Badge +1

I’m using Ionic with Capacitor.

The RevenueCat documentation recommends using a cordova plugin, but Ionic has been in the process of migrating away from Capacitor for the past few years, and this is now the only Cordova plugin in my app.

There’s already a capacitor plugin on github but I was wondering if there are any plans to release an official Capacitor plugin as well.


34 replies

Badge +3

I’ve got that working now. Thanks @toni-rico

Userlevel 2
Badge +3

Hi @IrishCoder88,

You need to pass the whole object returned by `getProducts` into the `purchaseStoreProduct`. So the code would look like:

const products = await Purchases.getProducts({ 
productIdentifiers: ['onetimeproduct'],
type: PRODUCT_CATEGORY.NON_SUBSCRIPTION
}).products;
// Remember to account for the product not being found!
const purchaseResult = await Purchase.purchaseStoreProduct({ product: products[0] });

Lmk if you still have any issues!

Badge +3

Ok, so I’ve managed to fetch the product now. But when I try to purchase it, I get to this line, which works with all my other products. It’s only the android one-time purchase where it doesn’t work.

await Purchases.purchaseStoreProduct({ product: 'androidpremium' });

But it then throws the error ‘missing product parameter’, and the purchase doesn’t go through.

Userlevel 2
Badge +3

Hi @IrishCoder88, you need to pass in the `type` parameter as part of the `GetProductOptions` when trying to fetch one-time purchases: https://github.com/RevenueCat/purchases-capacitor?tab=readme-ov-file#getproductoptions.

So instead of:

Purchases.getProducts({ productIdentifiers: ['onetimeproduct'] })

You will need to do:

Purchases.getProducts({ 
productIdentifiers: ['onetimeproduct'],
type: PRODUCT_CATEGORY.NON_SUBSCRIPTION
})

This is due to some limitations in how the system currently works in Android. This parameter is ignored in iOS as mentioned in the documentation.

Hope that helps! Please let us know if you have any other issues!

Badge +3

I’ve been using this the purchases-capacitor plugin for the past month or so. It’s working fine for my iOS and Android subscriptions, and for my one-time-purchases in iOS. In Android however, it can’t fetch my one-time purchases. They are set up correctly in RevenueCat and Google Play Console, they used to work fine with a different in-app-purchase library.

It’s the same code that works for iOS, so I’m not sure why it’s not working. Below is my code,  I was using the alerts to show the product data on the screen when testing with an actual device. It returns the info for both my subscriptions, but not for ‘androidpremium’ or ‘lifetimeandroid’. They just aren’t in the array at all, there are no error messages about it.

I’ve checked the debug logs and there is just no mention of any issues.
 

async mounted () {

const deviceInfo = await Device.getInfo();

this.isIOS = deviceInfo.platform === 'ios';

this.isAndroid = deviceInfo.platform === 'android'

await configurePurchases();

Purchases.getProducts({ productIdentifiers: ['premiumsubscribersm', 'premiumsubscribersy', 'Premium1988', 'androidpremium', 'lifetimeandroid'] })

.then((products) => {

alert('Fetched products successfully: ' + JSON.stringify(products));

this.$set(this, 'products', products.products); // Ensure reactivity

alert('Fetched products successfully: ' + JSON.stringify(products));

})

 

Userlevel 2
Badge +3

Hi @IrishCoder88, that’s correct. You need to create an android app inside the same project in the RC dashboard for each platform. You can check more info here: https://www.revenuecat.com/docs/projects#adding-an-app-to-a-project and https://www.revenuecat.com/docs/android-products

Badge +3

I have my Capacitor app built and working on IOS and Android. I’ve recently switched to using capacitor-purchases for my subscriptions. it’s the same codebase that I use for the both IOS and Android versions. I have my subscriptions woking in IOS, and I assumed in the RevenueCat dashboard it would be possible to just add in some extra details to get it working with Android aswell, but it seems like I have to set up a whole separate app, is this correct?

Hi @anuradha-a4da7c, we created this plugin using Capacitor 5 directly so we don’t have a version using Capacitor 4.x. What issues are you finding with Capacitor 4.x? Also, is it possible for you to update to Capacitor 5?

Hi @toni-rico - I could not install the npm package due to its peer dependency of Capacitor 5.x. However, I force installed to see how it works with Capacitor 4.x. Currently testing the implementation, so far seems to work well. If we run into issues, will keep you posted. 

Thanks for your response.

Userlevel 2
Badge +3

Hi @anuradha-a4da7c, we created this plugin using Capacitor 5 directly so we don’t have a version using Capacitor 4.x. What issues are you finding with Capacitor 4.x? Also, is it possible for you to update to Capacitor 5?

@toni-rico Does this capacitor plugin work with capacitor 4.x? Do you have a version that supports capacitor 4?

Badge +3

@toni-rico So awesome, thank you very much!

Userlevel 2
Badge +3

Hi @bebofit and all! The docs for the Capacitor plugin have been published: https://www.revenuecat.com/docs/ionic. Please take a look and let us know if you run into any issues!

@toni-rico thank you so much!! can you ping us when the public documentation is ready. thanks in advance 

Badge +3

@toni-rico Awesome news, thank you so much for all your efforts.

Userlevel 2
Badge +3

Hi everyone! We have released the first beta of the capacitor plugin! https://www.npmjs.com/package/@revenuecat/purchases-capacitor. Please check it out and let us know if you run into any issues or feedback. We will finish the public documentation soon, so it's easier to implement.

Badge +3

I’ve recently released an app on the Apple app store. I used Vue.js and Capacitor to make it. I’m about to add a paid subscription feature to it, and was looking into ways of doing it. I saw the capacitor-purchases plugin and was going to use it. Should I wait until the changeover is complete before I start developing? I’m not in any big rush.

Badge +3

@Andy Thank you very much, I really appreciate it.

Userlevel 5
Badge +8

We’re almost ready to ship! You can follow the progress over at https://github.com/RevenueCat/purchases-capacitor/pull/96

 

We’ll hopefully be able to ship it very soon

Badge +3

@Andy Any update yet? Sorry for being so ‘pushy’ but have to update RevenueCat to the latest version since a few weeks already and if this would be released very soon I would definitely wait for it to save time and having to change the code multiple times.

Thank you in advance! :-)

Badge

+1 For this! Looking forward to seeing the supported version. 

Badge +2

That’s amazing news! Great work. I have seen you already migrated the git repo to https://github.com/RevenueCat/purchases-capacitor will you change the NPM install path as well, or will it stay @capgo/capacitor-purchases ? 

Userlevel 5
Badge +8

Hey folks, we’re currently working on it! I don’t have any updates to share just yet, but will probably have something by end of week or next week. 

are there any updates regarding the new supported version for capacitor?

Userlevel 5
Badge +8

Yes! We do plan on updating to the latest version of our Android SDK soon, and well before the Nov 1st deadline. Stay tuned! 

Badge +6

This is great news that there is soon to be an official Capacitor plugin!!! I am currently using the Cordova plugin and rather not be 😀

It looks like the Capacitor plugin is still using v5 of RevenueCat’s Android SDK. I am assuming there are plans to upgrade it to v6 so we get support for Android’s BillingClient 5 before November 1 when Google is requiring all apps to be on BillingClient 5 or greater?

Reply