RevenueCat

Build With RevenueCat

Build a customized mobile subscription business with RevenueCat. We do the heavy lifting of normalizing subscribers from any source and maintain a single source of truth for subscription status, so you can get back to building your app.

RevenueCat is a powerful, secure, reliable, and free to use in-app purchase server with global support. All you need to get started is an API key.

Ask A Question

Questions

1

Could it be that Purchases.identify does not work sometimes?

Hey, we are using react-native-purchases for an iOS app. We call the setup method when the app starts, and as soon as the user hits the buy-button, we identify the user and perform the purchase. We need the identify with OUR user-id to make sense of the incoming webhooks. This works 95% of the time, but sometimes the identify-call does not seem to have worked, since OUR user-id is not in the aliases of the related webhooks. We have lots of precautions in place. - We check that OUR user-id is there and well-formed before we call identify. - we check if the user has wifi or cellular connection before calling identify.. - ..and also before making the purchase Here is an excerpt from our code:(javascript) ``` // ...this is inside an async function const connectionInfo = await NetInfo.getConnectionInfo(); if (connectionInfo.type == 'wifi' || connectionInfo.type == 'cellular') { // perform purchase, we have a connection // sometimes this does not work... await Purchases.identify(userId); const entitlements = await Purchases.getEntitlements(); if (websiteEvent.name === 'purchase12Plan') { this.performPurchase('12months', userId, entitlements); } } // .... performPurchase = async (durationString, userId, entitlements) => { try { const purchaseMade = await Purchases.makePurchase( entitlements.premium[durationString].identifier ); if ( purchaseMade.purchaserInfo.activeEntitlements !== 'undefined' && purchaseMade.purchaserInfo.activeEntitlements.includes('premium') ) { // Unlock that great "pro" content this.props.navigation.navigate('Loading'); } } catch (e) { if (!e.userCancelled) { console.log(e); } } ``` Do you have any hint why identify sometimes fails to set the new user id? We are running out of ideas what the cause could be.

Posted by Thomas Ranker 2 months ago

5

Get Trial info when calling getEntitlements (react native)

Hi, Where do I get the details about the trial period of a product? In the debug logs I see the details: sub_base_year_7dt_0dis_4499 - SkuDetails: {"skuDetailsToken":"AEuhp4KzyAa_7DAhCzFKHEQ8IF-QpG78EOeeLPk0svSArQOHVWcIETZINK77vgg0vu_x","productId":"sub_base_year_7dt_0dis_4499","type":"subs","price":"₪149.90","price_amount_micros":149900000,"price_currency_code":"ILS","subscriptionPeriod":"P1Y","freeTrialPeriod":"P1W","title":"1 Year Premium Membership (STG - Dynamo Parents)","description":"Give your kid 1 year of fun education"} When calling getEntitlements, I am getting the following response (in Android): ... "annual_with_trial": { "currency_code": "ILS", "intro_price_string": "", "intro_price_cycles": "", "intro_price_period_number_of_units": "", "price_string": "₪149.90", "intro_price_period": "", "intro_price": "", "price": 149.9, "title": "1 Year Premium Membership (STG - Dynamo Parents)", "intro_price_period_unit": "", "description": "Give your kid 1 year of fun education", "identifier": "sub_base_year_7dt_0dis_4499" }, What am I missing? btw, in iOS (I know its a different product as its from the app store, and still, response in React native) I am getting more info: “annual_with_trial”: { “description”: “Give your kid 1 year of fun education”, “price_string”: “₪159.90”, “intro_price_period_unit”: “WEEK”, “currency_code”: “ILS”, “title”: “1 Year Premium Membership”, “price”: 159.89999389648438, “intro_price”: 0, “identifier”: “sub_base_year_7dt_0dis_4499”, “intro_price_period_number_of_units”: 1, “intro_price_period”: “P1Y”, “intro_price_string”: “₪0.00", “intro_price_cycles”: 1 }, Thx

Posted by orr kowarsky 2 months ago