Question

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

  • 5 June 2024
  • 1 reply
  • 35 views

Badge

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

Userlevel 2
Badge +3

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!