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:
Name | Description |
---|---|
ChargeFullPrice | The 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. |
ChargeProratedPrice | The new plan takes effect immediately, and the billing cycle remains the same. |
WithTimeProration | The new plan takes effect immediately, and the remaining time will be prorated and credited to the user. |
Deferred | The new purchase takes effect immediately, the new plan will take effect when the old item expires. |
WithoutProration | The 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 QPurchaseUpdateModel purchaseUpdateModel = newProduct.toPurchaseUpdateModel("oldProductId");
Qonversion.getSharedInstance().updatePurchase(this, purchaseUpdateModel, new QonversionEntitlementsCallback() {
@Override
public void onSuccess(@NotNull Map<String, QEntitlement> entitlements) {
QEntitlement premiumEntitlement = entitlements.get("premium");
if (premiumEntitlement != null && premiumEntitlement.isActive()) {
// Handle active entitlement here
}
}
@Override
public void onError(@NotNull QonversionError error) {
// Handle error here
}
});
val purchaseUpdateModel = product.toPurchaseUpdateModel("oldProductId")
Qonversion.shared.updatePurchase(this, purchaseUpdateModel, 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
}
})
try {
final QPurchaseUpdateModel purchaseUpdateModel = product.toPurchaseUpdateModel('oldProductId');
final Map<String, QEntitlement> entitlements = await Qonversion.getSharedInstance().updatePurchase(purchaseUpdateModel);
} catch (e) {
print(e);
}
try {
const purchaseUpdateModel: PurchaseUpdateModel = product.toPurchaseUpdateModel('oldProductId');
const entitlement: Map<string, Entitlement> = await Qonversion.getSharedInstance().updatePurchase(purchaseUpdateModel);
} catch (e) {
console.log(e);
}
PurchaseUpdateModel purchaseUpdateModel = product.ToPurchaseUpdateModel("oldProductId");
Qonversion.GetSharedInstance().UpdatePurchase(purchaseUpdateModel, (entitlements, error, isCancelled) =>
{
if (error == null)
{
if (permissions.TryGetValue("premium", out Entitlement premium) && premium.IsActive)
{
// Handle the active entitlement here
}
}
else
{
// Handle the error
Debug.Log("Error" + error.ToString());
}
});
try {
const purchaseUpdateModel = product.toPurchaseUpdateModel('oldProductId');
const entitlement = await Qonversion.getSharedInstance().updatePurchase(purchaseUpdateModel);
} catch (e) {
console.log(e);
}
try {
const purchaseUpdateModel: PurchaseUpdateModel = product.toPurchaseUpdateModel('oldProductId');
const entitlement: Map<string, Entitlement> = await Qonversion.getSharedInstance().updatePurchase(purchaseUpdateModel);
} catch (e) {
console.log(e);
}
Updated 2 months ago