Skip to main content
Solved

Any way to test trials before going live (React Native)?


Cameron Napoli
Forum|alt.badge.img+5

I’m adding iOS Introductory Offers, and I would like to test before going live. However, when following the guide in the docs, the `discounts` field on the product is an empty array. How do I test this introductory offer before going live?

 

Example of the code I’m using for reference:

const purchaseDiscountedIOSPackage = async (purchasePackage) => {
  const product = purchasePackage.product;
  const discount = product.discounts?.[0];
  // product.discounts is empty
  if (!discount) {
    throw new Error('No discount found on producct');
  }
  const paymentDiscount = await Purchases.getPromotionalOffer(product, discount);
  if (!paymentDiscount) {
    throw new Error('No payment discount');
  }

  try {
    const purchaseMade = await Purchases.purchaseDiscountedPackage(pkg, paymentDiscount);
    return purchaseMade.customerInfo;
  } catch (e) {
    if (!e.userCancelled) {
      throw e;
    } else {
      throw new Error('ignore');
    }
  }
};

const purchase = async () => {
  const offering = (await Purchases.getOfferings()).current;
  const package = offering.availablePackages[0];
  if (package) {
    await purchaseDiscountedIOSPackage(package);
  }
};

 

Best answer by kaitlin

Hi @Cameron!

The discounts field will actually not include Introductory offers - this will be returned in the IntroPrice field instead. Additionally, you’re correct that the code in the docs and that you’re using in your snippet is for Promotional Offers specifically. 

For Introductory Offers, as you said, you can trust that they will be automatically applied if the user is eligible for it. You can always check the offer in the IntroPrice field, and with iOS you can also use checkTrialOrIntroductoryPriceEligibility to check if a user is eligible. 

View original
Did this post help you find an answer to your question?

4 replies

Cameron Napoli
Forum|alt.badge.img+5

Follow up question: is the code in the docs (https://www.revenuecat.com/docs/ios-subscription-offers#promotional-offers) only valid for Promotional Offers and not Introductory offers? It would be great to get Intro Offers documentation added.

After testing, it seems like Intro Offers are automatically applied by RevenueCat using Purchases.purchasePackage


kaitlin
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 329 replies
  • Answer
  • June 12, 2023

Hi @Cameron!

The discounts field will actually not include Introductory offers - this will be returned in the IntroPrice field instead. Additionally, you’re correct that the code in the docs and that you’re using in your snippet is for Promotional Offers specifically. 

For Introductory Offers, as you said, you can trust that they will be automatically applied if the user is eligible for it. You can always check the offer in the IntroPrice field, and with iOS you can also use checkTrialOrIntroductoryPriceEligibility to check if a user is eligible. 


Cameron Napoli
Forum|alt.badge.img+5

Hi @kaitlin , amazing thank you for the information!!! 😄

Would I be able to use the IntroPrice value on Android as well to identify whether or not an Android subscription has an introductory price? If so, would I have to use any different code to select that intro offer for the user?


kaitlin
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 329 replies
  • June 26, 2023

Hi @Cameron Napoli,

Yes, introPrice is available for Android! You wouldn’t need to do anything to select the offer - the stores will handle verifying users who are eligible and showing them the offer. 


Reply


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