react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

[Android] prorationModeAndroid not working for subscription upgrade/downgrade - not applied immediately

Open Aayush-pansari opened this issue 8 months ago • 2 comments

Description:

I'm trying to implement subscription upgrade/downgrade with proration using react-native-iap. Subscriptions are upgrading/downgrading, but the change is not applied immediately, despite using ProrationModesAndroid.IMMEDIATE_WITH_TIME_PRORATION.

Expected Behavior: The subscription should switch immediately to the new plan, and the billing should adjust based on the remaining time/value of the current subscription (as per the selected proration mode).

Current Behavior: The new subscription is not applied immediately — instead, it seems to be scheduled for the next billing cycle, as if DEFERRED proration mode is used.

Code Snippet:

try {
  let requestParams: RequestSubscription = {
    sku: productId,
  };

  if (Platform.OS === 'android') {
    if (offerToken) {
      requestParams.subscriptionOffers = [{ sku: productId, offerToken }];
    }

    requestParams.prorationModeAndroid = ProrationModesAndroid.IMMEDIATE_WITH_TIME_PRORATION;
  }

  await requestSubscription(requestParams);
} catch (errorResponse) {
  console.warn('Subscription error:', errorResponse);
}

Setup Details:

  • react-native-iap: 12.0.0
  • Google Play Billing Library: 6.0.1
  • react-native: 0.65.3
  • Platform: Android
  • Test Account: Yes, I'm using a licensed test user with an active subscription.

Additional Info:

  • Both products are in the same subscription group.
  • The offerToken is fetched dynamically using getSubscriptions().
  • The Play Console setup includes base plans and offers for each subscription.
  • The requestSubscription() call succeeds with no error, and subscription does update — just not immediately.

Repro Steps:

  1. Purchase Subscription A
  2. Call requestSubscription() for Subscription B with IMMEDIATE_WITH_TIME_PRORATION
  3. Observe that subscription doesn't switch immediately

Questions / Clarifications:

  • Does [email protected] fully support prorationModeAndroid for Google Billing v6.0.1?
  • Is there a specific requirement or flag in the subscription offers/base plans that affects immediate proration?
  • Are there any known issues around this behavior?

Aayush-pansari avatar Apr 14 '25 07:04 Aayush-pansari

I encountered the same issue after upgrading the package. Have you resolved this issue?

arjunAbcd avatar May 14 '25 11:05 arjunAbcd

ProrationMode has migrated to ReplacementMode (12.15.2

You need to change the prorationMode to replacementMode

requestSubscription.replacementModeAndroid = ReplacementModesAndroid.WITH_TIME_PRORATION;

sebastian-godja avatar Jun 02 '25 08:06 sebastian-godja

Issue with RNIap.ReplacementModesAndroid.DEFERRED in Version 12.16.2

I’ve noticed that in RNIap version 12.16.2, the ReplacementModesAndroid.DEFERRED mode is not working as expected. When attempting to switch plans, it immediately cancels the existing subscription and activates the new plan right away.

However, in version 12.10.7 , the same mode worked correctly — the new plan would only activate after the current plan’s billing period ended, which is the intended behavior for the deferred replacement mode.

ganesht10 avatar Jul 07 '25 04:07 ganesht10