play-billing-samples icon indicating copy to clipboard operation
play-billing-samples copied to clipboard

Switch Base Plan Error PG-GEMF-01

Open AlexMofer opened this issue 2 years ago • 2 comments

This is BillingFlowParams:


BillingFlowParams.newBuilder()
                    .setProductDetailsParamsList(productDetailsParamsList)
                    .setSubscriptionUpdateParams(
                            BillingFlowParams.SubscriptionUpdateParams.newBuilder()
                                    .setOldPurchaseToken(oldPurchaseToken)
                            .setSubscriptionReplacementMode(
                                    BillingFlowParams.SubscriptionUpdateParams.ReplacementMode.CHARGE_FULL_PRICE)
                            .build())
                    .build()

If subscribe again:

Screenshot_20240119-183701 Screenshot_20240119-183715

If subscribe other base plan in this Subscription:

Screenshot_20240119-183726

AlexMofer avatar Jan 19 '24 10:01 AlexMofer

com.android.billingclient:billing:6.1.0

AlexMofer avatar Jan 19 '24 12:01 AlexMofer

I am having exactly the same error. My console has a warning message "Debug Message: Account identifiers don't match the previous subscription." It hinted me that I may need to re-use the previous account identifier and hence the upgrade did succeed.

        val billingFlowParamsBuilder = BillingFlowParams.newBuilder()
            .setObfuscatedProfileId(profileId)
            .setObfuscatedAccountId(YOUR_OLD_ACCOUNT_ID) // <-- This one
            .setProductDetailsParamsList(productDetailsParamsList)

You can retrieve the previous accountID in the purchase object

        val purchasesResult = billingClient.queryPurchasesAsync(params)
        val code = purchasesResult.billingResult.responseCode
        if (code != BillingResponseCode.OK) {
            throw BillingException(purchasesResult.billingResult)
        }
        if (purchasesResult.purchasesList.isNotEmpty()) {
            for (purchase in purchasesResult.purchasesList) {
                val accountId = purchase.accountIdentifiers?.obfuscatedAccountId

jifang avatar Mar 14 '24 12:03 jifang