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
andpaymentDiscount
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);
}