Upgrade and Downgrade in Google

When upgrading or downgrading a subscription, you can set the update policy, or how the change affects your subscribers. The following table lists available update policies:

NameDescription
ChargeFullPriceThe new plan takes effect immediately, and the user is charged full price of new plan and is given a full billing cycle of subscription, plus remaining prorated time from the old plan.
ChargeProratedPriceThe new plan takes effect immediately, and the billing cycle remains the same.
WithTimeProrationThe new plan takes effect immediately, and the remaining time will be prorated and credited to the user.
DeferredThe new purchase takes effect immediately, the new plan will take effect when the old item expires.
WithoutProrationThe new plan takes effect immediately, and the new price will be charged on next recurrence time.

Upgrading, downgrading, or changing a subscription on Google Play Store requires calling the updatePurchase function.

See Google Play Documentation for more details.

Use Qonversion SDK for upgrading, downgrading, or changing Google Play Store subscription:

final QPurchaseOptions purchaseOptions = new QPurchaseOptions.Builder()
        .setOldProduct(oldProduct)
        .build();
Qonversion.getSharedInstance().purchase(this, product, purchaseOptions, new QonversionPurchaseCallback() {
    @Override
    public void onResult(@NonNull QPurchaseResult result) {
        if (result.isSuccessful()) {
            QEntitlement premium = result.getEntitlements().get("premium");
            if (premium != null && premium.isActive()) {
                // Grant user access to premium features
            }
        } else if (result.isCanceledByUser()) {
            // Handle canceled purchase
        } else if (result.isPending()) {
            // Handle pending purchase
        } else {
            // Handle errors
        }
    }
});
val purchaseOptions = QPurchaseOptions.Builder()
    .setOldProduct(oldProduct)
    .build()
Qonversion.shared.purchase(this, product, purchaseOptions, object : QonversionPurchaseCallback {
    override fun onResult(result: QPurchaseResult) {
        when {
            result.isSuccessful -> {
                val premium = result.entitlements["premium"]
                if (premium != null && premium.isActive) {
                    // Grant user access to premium features
                }
            }
            result.isCanceledByUser -> {
                // Handle canceled purchase
            }
            result.isPending -> {
                // Handle pending purchase
            }
            else -> {
                // Handle errors
            }
        }
    }
})
// Build purchase options with old product for upgrade/downgrade
final options = QPurchaseOptionsBuilder()
    .setOldProduct(oldProduct)  // Product to upgrade from
    .setUpdatePolicy(QProductUpdatePolicy.chargeFullPrice)  // Optional: update policy
    .build();

final QPurchaseResult result = await Qonversion.getSharedInstance().purchaseWithResult(
  newProduct,
  purchaseOptions: options,
);

if (result.isSuccess) {
  final premium = result.entitlements?['premium'];
  if (premium != null && premium.isActive) {
    // User successfully upgraded to new subscription
  }
} else if (result.isCanceled) {
  // Handle canceled upgrade
} else if (result.isPending) {
  // Handle pending upgrade
} else {
  // Handle errors
}
// Build purchase options with old product for upgrade/downgrade
const options = new PurchaseOptionsBuilder()
  .withOldProduct(oldProduct)  // Product to upgrade from
  .withUpdatePolicy(ProductUpdatePolicy.CHARGE_FULL_PRICE)  // Optional: update policy
  .build();

const result: PurchaseResult = await Qonversion.getSharedInstance().purchaseWithResult(
  newProduct,
  options,
);

if (result.isSuccess) {
  const premium = result.entitlements?.get('premium');
  if (premium && premium.isActive) {
    // User successfully upgraded to new subscription
  }
} else if (result.isCanceled) {
  // Handle canceled upgrade
} else if (result.isPending) {
  // Handle pending upgrade
} else {
  // Handle errors
}
// Build purchase options with old product for upgrade/downgrade
var options = new PurchaseOptionsBuilder()
    .SetOldProduct(oldProduct)  // Product to upgrade from
    .SetUpdatePolicy(PurchaseUpdatePolicy.ChargeFullPrice)  // Optional: update policy
    .Build();

Qonversion.GetSharedInstance().Purchase(newProduct, options, (result) =>
{
    if (result.IsSuccess)
    {
        if (result.Entitlements != null &&
            result.Entitlements.TryGetValue("premium", out var premium) &&
            premium.IsActive)
        {
            // User successfully upgraded to new subscription
        }
    }
    else if (result.IsCanceled)
    {
        // Handle canceled upgrade
    }
    else if (result.IsPending)
    {
        // Handle pending upgrade
    }
    else
    {
        // Handle errors
    }
});
// Build purchase options with old product for upgrade/downgrade
const options = new Qonversion.PurchaseOptionsBuilder()
  .withOldProduct(oldProduct)  // Product to upgrade from
  .withUpdatePolicy(ProductUpdatePolicy.CHARGE_FULL_PRICE)  // Optional: update policy
  .build();

const result = await Qonversion.getSharedInstance().purchase(
  newProduct,
  options,
);

if (result.isSuccess) {
  const premium = result.entitlements?.get('premium');
  if (premium && premium.isActive) {
    // User successfully upgraded to new subscription
  }
} else if (result.isCanceled) {
  // Handle canceled upgrade
} else if (result.isPending) {
  // Handle pending upgrade
} else {
  // Handle errors
}
// Build purchase options with old product for upgrade/downgrade
const options = new PurchaseOptionsBuilder()
  .withOldProduct(oldProduct)  // Product to upgrade from
  .withUpdatePolicy(ProductUpdatePolicy.CHARGE_FULL_PRICE)  // Optional: update policy
  .build();

const result = await Qonversion.getSharedInstance().purchase(
  newProduct,
  options,
);

if (result.isSuccess) {
  const premium = result.entitlements?.get('premium');
  if (premium && premium.isActive) {
    // User successfully upgraded to new subscription
  }
} else if (result.isCanceled) {
  // Handle canceled upgrade
} else if (result.isPending) {
  // Handle pending upgrade
} else {
  // Handle errors
}