play-billing-samples
play-billing-samples copied to clipboard
Switch Base Plan Error PG-GEMF-01
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:
If subscribe other base plan in this Subscription:
com.android.billingclient:billing:6.1.0
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