【问题标题】:Check if Users Subscription is still active with the RevenueCat API使用 RevenueCat API 检查用户订阅是否仍然有效
【发布时间】:2020-02-23 04:17:25
【问题描述】:

使用 RevenueCat API 检查用户订阅是否仍然有效的最佳方法是什么?

我可以获得用户的权利,但似乎在订阅到期后,权利仍在权利对象中。

"entitlements": {
      "premium_monthly": {
        "expires_date": "2019-10-27T17:27:59Z",
        "product_identifier": "app_premium_monthly",
        "purchase_date": "2019-10-27T17:21:24Z"
      }
    },

我看到的唯一方法是这样的:

                const exp = new Date(res.data.subscriber.entitlements.premium_monthly.expires_date)
                const now = new Date();
                if (exp.getTime() < now.getTime()) {
                    // Subscription is no longer valid
                }

这是执行此操作的预期方法还是有更好的方法?

【问题讨论】:

    标签: revenuecat


    【解决方案1】:

    是的,这是检查它的方法。将当前时间与 RevenueCat 的 API 提供的过期时间进行比较。

    【讨论】:

      猜你喜欢
      • 2017-09-10
      • 2019-07-21
      • 1970-01-01
      • 2016-05-01
      • 2020-07-25
      • 2012-08-26
      • 2012-10-29
      • 2016-04-18
      • 1970-01-01
      相关资源
      最近更新 更多