Skip to main content
Question

Help with Capacitor / vue 3 implementation please

  • October 29, 2024
  • 1 reply
  • 60 views

Forum|alt.badge.img

Hello,

I’m having some difficulties with implementing Capacitor and Vue 3 for Android.

Firstly, I want to figure out how to handle locked areas in my app upon boot. As I understand it, the app will send a request to the RevenueCat API to check the subscription status of each user IDs, which will return either a “subscribed” or “unsubscribed” response.

I think the best approach would be to save this status in persistent storage and then develop the necessary logic to lock or unlock functions in my app.

Could you please confirm if my understanding is correct?

Additionally, regarding the Vue.js part: should I include this logic in the App.vue file?

Thank you!

 

if (Platform.is.android) {
try {
const revenuecat = await import('@revenuecat/purchases-capacitor');
const Purchases = revenuecat.Purchases;
const LOG_LEVEL = revenuecat.LOG_LEVEL;

await Purchases.setLogLevel({ level: LOG_LEVEL.DEBUG });
await Purchases.configure({
      apiKey: process.env.REVENUECAT_API_KEY_ANDROID,
      appUserID: this.authStore.userId
    });
    console.log("RevenueCat SDK configured!");
  } catch (error) {
    console.error('Error configuring RevenueCat:', error);
  }
}


If yes, I cannot work how to show the offerings that I created inside my revenue cat account.

Could you please show me an example on this for vue 3?

Thanks!

This post has been closed for comments

1 reply

kaitlin
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 383 replies
  • October 31, 2024

Hi @BamBam,

You can use the REST API to get a usr’s subscriber status, or you can use the method `getCustomerInfo`.

With either of these options, it’s not quite a subscribed/unsubscribed, but you can check if a particular entitlement ID is active (if you only have one entitlement), or if the user has any active entitlements at all (if you have multiple entitlements). 

If you use the method through the SDK, it will update and cache the latest customerInfo at specific times - on app open, when a purchase is made, when a restore is made, and any time you call `getCustomerInfo`, which you can do as frequently as needed. 

If you do use the REST API, you may want to store the response to reduce your reliance on the network, but it would most likely be easier to use the SDK and rely on the cache. 

Here’s some more information in our documentation: https://www.revenuecat.com/docs/customers/customer-info#checking-if-a-user-is-subscribed

 


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