Solved

ReactNative SDK - purchaseSubscriptionOption not applying proration and oldProductIdentifier

  • 31 October 2023
  • 4 replies
  • 94 views

Badge

Sorry if this has been answered elsewhere but we couldn’t find any information - hopefully someone can point us in the right direction.

We have 2 subscriptions set up in our Google Play Console, each with their own set of offers, and different pricing. Let’s call them SubscriptionA and SubscriptionB - the latter being a “higher tier” subscription (which gives access to more app features etc...).

Our users can purchase either of these subscriptions directly, however if they purchase SubscriptionA, first, we allow them to upgrade to SubscriptionB at any point. We have so far done it using  the purchasePackage method, like so:

Purchases.purchasePackage(package, undefined, {
oldProductIdentifier,
prorationMode: PRORATION_MODE.IMMEDIATE_AND_CHARGE_PRORATED_PRICE,
});

This would result in the user being charged the relevant pro-rated price, and the existing SubscriptionA switching to SubscriptionB. This works correctly, as expected.

However we are now facing an issue as we have an upcoming promotion, which means SubscriptionB now has 2 offers (i.e, different subscriptionOptions) between which we may need to choose. Hence, we are now trying to replace the above with the following:

Purchases.purchaseSubscriptionOption(subscription, {
oldProductIdentifier,
prorationMode: PRORATION_MODE.IMMEDIATE_AND_CHARGE_PRORATED_PRICE,
});

(subscription here refers to the relevant offer retrieved using the SDK method Purchases.getOfferings)

We would expect the above snippets to behave in the exact same way, however, the latter does not apply any pro-rata nor does it update the existing subscription for the user. Instead, it creates a new subscription, resulting in the user having 2 active subscriptions.

I hope all of this is clear, massive thanks in advance for any help you may provide!

icon

Best answer by Mark Zepeda 1 November 2023, 22:26

View original

4 replies

Badge +5

@antoine-bugni-56dcb5 I ran into the same issue. After looking through the source I found that the implementation of purchaseSubscriptionOption doesn’t use oldProductIdentifier as described in the type. Instead it’s using oldSKU. Using oldSKU fixed the behavior for me on 7.2.0

 

Here’s the ticket in Github https://github.com/RevenueCat/react-native-purchases/issues/763

Userlevel 2
Badge +3

As @Mark Zepeda mentioned, this is an issue in our translation layer in the react-native-purchases SDK. We will ship a fix for this soon. Thanks for reporting it!

Badge

Sorry for not replying sooner - thank you both for your attention to this issue, we really appreciate it!

Userlevel 2
Badge +3

We released a fix for this in RNP 7.3.0: https://github.com/RevenueCat/react-native-purchases/releases/tag/7.3.0. Now we will accept oldProductIdentifier in addition to oldSKU.

Please check it out and let us know if you still run into issues!

Reply