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 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
}
}
}
})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 4 days ago
