Skip to main content
Question

Error 'Couldn’t Find Package' When Using Purchases.purchaseDiscountedPackage in React Native

  • June 5, 2024
  • 1 reply
  • 161 views

Forum|alt.badge.img+4

I'm currently Promotional Offer using RevenueCat into my React Native app and encountering an issue with purchasing discounted packages. Specifically, I'm using the Purchases.purchaseDiscountedPackage(selectedPackage, paymentDiscount) method. During unit testing on a physical device, I'm consistently getting an error stating "couldn’t find package."

Has anyone experienced a similar issue or have insights on how to resolve this? What steps can I take to ensure that the selectedPackage and paymentDiscount are correctly identified and processed during unit testing on a physical device locally?

Additional Details:

  • The selectedPackage and paymentDiscount are being correctly fetched and displayed in the app.
  • Regular purchases without discounts work as expected.
  • The issue only arises when trying to purchase a discounted package.
  • Testing is being conducted on a physical device locally.

Code Snippet:

if(selectedPackage.product.discounts.length > 0) {
        const paymentDiscount = await Purchases.getPromotionalOffer(selectedPackage.product, selectedPackage.product.discounts[0]);
        console.log(paymentDiscount);
        if(paymentDiscount) {
          const purchaseMade = await Purchases.purchaseDiscountedPackage(selectedPackage, paymentDiscount);
          // console.log('-- purchase made ----', purchaseMade);
        }
      }
      else {
        const { customerInfo } = await Purchases.purchasePackage(selectedPackage);
        // console.log('-- purchase info ---',customerInfo);
      }

 

This post has been closed for comments

1 reply

Forum|alt.badge.img+3
  • RevenueCat Staff
  • 55 replies
  • June 5, 2024

Hi @jegoapp,

What version of the SDK are you using? We released 7.27.2 a couple weeks ago that should contain a fix for this issue.

Let us know if it still happens with a newer version!


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