Cannot upgrade android in-app subscription. Error: "Something went wrong on our end. Please try again."

Cannot upgrade android in-app subscription. Error: "Something went wrong on our end. Please try again."

问题:

描述:

BillingFlowParams purchaseParams = BillingFlowParams.newBuilder()
                    .setSkuDetails(skuDetails)
                    .setOldSku(oldSKU, oldPurchaseToken)
                    .setReplaceSkusProrationMode(IMMEDIATE_WITH_TIME_PRORATION)
                    .build();
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
        .setSubscriptionUpdateParams(SubscriptionUpdateParams.newBuilder()
            .setOldSkuPurchaseToken(oldPurchaseToken)
            .setOldSkuPurchaseId(oldSKU) // This method is not available in lib[4.0.0] but mentioned in docs
            .setReplaceSkusProrationMode(IMMEDIATE_WITH_TIME_PRORATION))
        .setSkuDetails(skuDetails)
        .build();

下面附上错误截图

我设法摆脱了错误“我们这边出了点问题。请重试。”我清除了 Play Market 缓存并重新启动了设备。

更新: 我找到了解决办法。跳过此参数即可,不要指定它。它适用于我的应用程序中的订阅。

.setOldSkuPurchaseId(previousSku)

我不得不在 Google 的示例代码中添加一个额外的 .build()

        // Retrieve a value for "skuDetails" by calling querySkuDetailsAsync()
        val flowParams = BillingFlowParams.newBuilder()
                .setSubscriptionUpdateParams(SubscriptionUpdateParams.newBuilder()
                    .setOldSkuPurchaseToken(purchaseTokenOfOriginalSubscription)
                    .setReplaceSkusProrationMode(desiredProrationMode)
                    .build() // <-- MISSING BUILD
                    )
                .setSkuDetails(upgradeOrDowngradeSkuDetails)
                .build();
        val responseCode = billingClient.launchBillingFlow(activity, flowParams)

由于新的Reserve Bank of India eMandate notification,您的一些订阅体验可能会改变。

更多详情checkout this