【问题标题】:Google Play In-app messaging not displaying payment declined messageGoogle Play 应用内消息不显示付款拒绝消息
【发布时间】:2023-02-11 07:55:58
【问题描述】:

如果订阅的付款被拒绝,我正在尝试实施应用内消息传递以显示小吃店。

跟随documentation here 并添加billingClient.showInAppMessages 似乎不起作用。我使用 Test card, always approves 订阅并将其更改为 Test card, always declines 并等待付款进入宽限期,但即使在重新启动应用程序后,文档中的小吃店也没有出现。

付款被拒绝并重新启动应用程序后的预期结果:

应用程序内消息传递的工作原理是我可以通过 firebase 发送消息,但我不确定我是否遗漏了一些明显的东西?

执行: (这在应用程序启动时调用)

// onCreate
billingClient = createBillingClient()
setupInAppMessaging(activity)
if (!billingClient.isReady) {
    logD { "BillingClient: Start connection..." }
    billingClient.startConnection(this)
}

fun createBillingClient() = BillingClient.newBuilder(context)
    .setListener(this)
    .enablePendingPurchases()
    .build()

fun setupInAppMessaging(activity: Activity) {
    val inAppMessageParams = InAppMessageParams.newBuilder()
        .addInAppMessageCategoryToShow(InAppMessageParams.InAppMessageCategoryId.TRANSACTIONAL)
        .build()

    billingClient.showInAppMessages(activity, inAppMessageParams) { inAppMessageResult ->
        if (inAppMessageResult.responseCode == InAppMessageResult.InAppMessageResponseCode.NO_ACTION_NEEDED) {
            // The flow has finished and there is no action needed from developers.
            logD { "SUBTEST: NO_ACTION_NEEDED"}
        } else if (inAppMessageResult.responseCode == InAppMessageResult.InAppMessageResponseCode.SUBSCRIPTION_STATUS_UPDATED) {
            logD { "SUBTEST: SUBSCRIPTION_STATUS_UPDATED"}
            // The subscription status changed. For example, a subscription
            // has been recovered from a suspend state. Developers should
            // expect the purchase token to be returned with this response
            // code and use the purchase token with the Google Play
            // Developer API.
        }
    }
}

【问题讨论】:

    标签: android kotlin google-play


    【解决方案1】:

    它到底有没有用?我相信这些消息每天只显示一次,所以如果您已经看过一次,如果您的付款方式仍然失败,您将不得不再等 24 小时才能再次看到。

    【讨论】:

      猜你喜欢
      • 2015-05-24
      • 2012-08-17
      • 1970-01-01
      • 1970-01-01
      • 2012-11-08
      • 2022-01-09
      • 1970-01-01
      • 2013-06-09
      • 2013-10-16
      相关资源
      最近更新 更多