9
votes

I'm using Play Billing Library v1.0 for In-app Billing support in Android app and would like to allow users to renew a subscription manually during its active period to extend it by the appropriate period.

It can be handy for different sales (Black Friday, New Year, etc.), when users can extend their subscriptions with discount.

According to the official documentation, this behavior really can be achieved. But I found no information how to implement it.

I'm using the following standard code to buy a subscription:

BillingFlowParams.Builder builder = BillingFlowParams.newBuilder()
        .setSku(skuId).setType(SkuType.SUBS);
int responseCode = mBillingClient.launchBillingFlow(activity, builder.build());

If I try to buy the same subscription again, the

"You're already subscribed to XXXXX [OK]"

error message appears.

I also tried to use .addOldSku() builder method and pass the same sku here, but it does not help either.

2

2 Answers

2
votes

With the In-app Billing API, users can renew a subscription during its active period even if the subscription is not set to automatically renew. If the user purchases a subscription while the subscription is active, it is extended by the appropriate period at the current rate.

For example, Achilles has a subscription to the Modern Hoplite app. His subscription is currently due to expire on August 1. On July 10, he purchases a 1-month subscription at the current rate. This one month is added to his existing subscription, so the subscription now expires on September 1.

It is up to the app to convey this with an appropriate UI. For example, if a user does not have an active subscription, the app might have a buy button, but if the user has a subscription the button might say renew.

Please check more details about In-App refer below link:

https://developer.android.com/google/play/billing/billing_subscriptions.html

1
votes

Please upgrade your Play Billing Library v1.0 Play Billing Library v5

In the latest version of In-app Billing,

  • A user can manually extend an existing subscription. The subscription is extended by the appropriate amount of time.

  • A user can upgrade or downgrade a subscription while it is active. The old subscription is canceled, and the unused portion is applied on a pro-rata basis to the new subscription.

Read the version note