Upgrade and Downgrade in Google
When upgrading or downgrading a subscription, you can set the proration mode, or how the change affects your subscribers. The following table lists available proration modes:
Proration mode | Description |
---|---|
IMMEDIATE_WITH_TIME_PRORATION | The subscription is upgraded or downgraded immediately. Any time remaining is adjusted based on the price difference, and credited toward the new subscription by pushing forward the next billing date. This is the default behavior. |
IMMEDIATE_AND_CHARGE_PRORATED_PRICE | The subscription is upgraded immediately, and the billing cycle remains the same. The price difference for the remaining period is then charged to the user. |
IMMEDIATE_WITHOUT_PRORATION | The subscription is upgraded or downgraded immediately, and the new price is charged when the subscription renews. The billing cycle remains the same. |
DEFERRED | The subscription is upgraded or downgraded only when the subscription renews. |
Upgrading, downgrading, or changing a subscription on Google Play Store requires calling updatePurchase() function.
See Google Play Documentation for more details.
Use Qonversion SDK for upgrading, downgrading, or changing Play Store subscription:
Qonversion.getSharedInstance().updatePurchase(this, "newProductId", "oldProductId", new QonversionEntitlementsCallback() {
@Override
public void onSuccess(@NonNull Map<String, QEntitlement> entitlements) {
final QEntitlement premiumEntitlement = entitlements.get("premium");
if (premiumEntitlement != null && premiumEntitlement.isActive()) {
// handle active entitlement here
}
}
@Override
public void onError(@NonNull QonversionError error) {
// handle error here
}
});
Qonversion.shared.updatePurchase(this, "newProductId", "oldProductId", callback = object: QonversionEntitlementsCallback {
override fun onSuccess(entitlements: Map<String, QEntitlement>) {
val premiumEntitlement = entitlements["premium"]
if (premiumEntitlement != null && premiumEntitlement.isActive) {
// handle active entitlement here
}
}
override fun onError(error: QonversionError) {
// handle error here
}
})
Updated 5 months ago