Incorrect Documentation on iOS Subscription Offers

  • 18 March 2023
  • 1 reply

Badge +2

I just wanted to report an incorrect code snippet in the iOS subscription offers documentation. I spent several hours trying to debug why it wasn’t working for me in React Native, so it would be helpful if this could be fixed so it can benefit others in the future.


Here is the documentation page in question


The error is only present in the React Native code snippet provided:

This function is undefined because it does not exist in any version of react-native-purchases.


I uncovered this issue when I checked the other tabs of the code-snippet and searched inside the /src/purchases.ts file of the react-native-purchases package, and found that there is no method called “getPaymentDiscount”. This line is supposed to be:

const paymentDiscount = await Purchases.getPromotionalOffer(product, product.discounts[0]);

Note: getPaymentDiscount is replaced by getPromotionalOffer.


I have tested this code and after providing the product and discount from the package, I was successfully able to call:

Purchases.purchaseDiscountedPackage(package, paymentDiscount)

If someone from the RevenueCat team sees this, I would greatly appreciate if you could update the documentation for the React Native SDK in order to correct this error :)


Hope this saves someone else a headache!

1 reply

Userlevel 4
Badge +8

Hi Daniel,


Thanks for pointing this out, and sorry for all the time wasted!


We are currently building a system to automatically update and test all code snippets in our docs so that this kind of thing doesn’t happen again.