Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to upgrade, downgrade, or change their subscription #55

Open
karta012719 opened this issue Sep 2, 2021 · 1 comment
Open

How to upgrade, downgrade, or change their subscription #55

karta012719 opened this issue Sep 2, 2021 · 1 comment

Comments

@karta012719
Copy link

How to upgrade, downgrade, or change their subscription

@dhirajved
Copy link

Note : read first 5 proration mode for upgrade, downgrade for subscription .

for more you can refer this doc
https://developer.android.com/google/play/billing/subscriptions#upgrade-downgrade

use this code for upgrade, downgrade for subscription

BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
    .setProductDetailsParamsList(
        ImmuableList.of(
            ProductDetailsParams.newBuilder()
                // fetched via queryProductDetailsAsync
                .setProductDetails(productDetails)
                // offerToken can be found in
                // ProductDetails=>SubscriptionOfferDetails
                .setOfferToken(offerToken)
                .build()))
    .setSubscriptionUpdateParams(
        SubscriptionUpdateParams.newBuilder()
            // purchaseToken can be found in Purchase#getPurchaseToken
            .setOldSkuPurchaseToken("old_purchase_token")
            .setReplaceSkusProrationMode(ProrationMode.DEFERRED)
            .build())
    .build();

BillingResult billingResult = billingClient.launchBillingFlow(activity, billingFlowParams);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants