订阅收据验证在还原时给出了错误的product_id和expires_date

时间:2019-01-20 18:59:51

标签: swift in-app-purchase subscription storekit receipt-validation

我正在为自动续订订阅进行收据验证。在恢复时遇到了一个大问题。恢复似乎是使用不同的product_id恢复旧的事务,因此将我的UI标记为过期。

购买正常。

这是我进行购买时的JSON响应:

LAST RECEIPT INFORMATION: 
 {
    "expires_date" = "2019-01-20 18:29:02 Etc/GMT";
    "expires_date_ms" = 1548008942000;
    "expires_date_pst" = "2019-01-20 10:29:02 America/Los_Angeles";
    "is_in_intro_offer_period" = false;
    "is_trial_period" = false;
    "original_purchase_date" = "2019-01-20 18:26:03 Etc/GMT";
    "original_purchase_date_ms" = 1548008763000;
    "original_purchase_date_pst" = "2019-01-20 10:26:03 America/Los_Angeles";
    "original_transaction_id" = 1000000484645981;
    "product_id" = "com.mywebsite.weekly"; // The CORRECT product_id of what I am purchasing in sandbox.
    "purchase_date" = "2019-01-20 18:26:02 Etc/GMT";
    "purchase_date_ms" = 1548008762000;
    "purchase_date_pst" = "2019-01-20 10:26:02 America/Los_Angeles";
    quantity = 1;
    "transaction_id" = 1000000495942050;
    "web_order_line_item_id" = 1000000042313304;
}

   - DATE BOUGHT SUBSCRIPTION = 2019-01-20 18:26:03 +0000


   - DATE SUBSCRIPTION EXPIRES = 2019-01-20 18:29:02 +0000

您可以看到"original_purchase_date" = "2019-01-20 18:26:03 Etc/GMT";"expires_date" = "2019-01-20 18:29:02 Etc/GMT";之间的差异为3分钟,因为它应该在沙箱中才能订阅一周。

现在是问题了。 还原后, OR 或当我重新购买同一产品时(提示我已经由StoreKit订阅了该产品),我得到的是完全不同的product_id和{{1} }:

expires_date

这是我的收据验证器中要购买/到期的部分:

LAST RECEIPT INFORMATION: 
 {
    "expires_date" = "2019-01-17 16:47:19 Etc/GMT";
    "expires_date_ms" = 1547743639000;
    "expires_date_pst" = "2019-01-17 08:47:19 America/Los_Angeles";
    "is_in_intro_offer_period" = false;
    "is_trial_period" = false;
    "original_purchase_date" = "2019-01-20 18:38:59 Etc/GMT";
    "original_purchase_date_ms" = 1548009539000;
    "original_purchase_date_pst" = "2019-01-20 10:38:59 America/Los_Angeles";
    "original_transaction_id" = 1000000495390111;
    "product_id" = "com.mywebsite.group2.weekly2"; // WRONG product_id
    "purchase_date" = "2019-01-17 16:44:19 Etc/GMT";
    "purchase_date_ms" = 1547743459000;
    "purchase_date_pst" = "2019-01-17 08:44:19 America/Los_Angeles";
    quantity = 1;
    "transaction_id" = 1000000495942766;
    "web_order_line_item_id" = 1000000042278610;
}

   - DATE BOUGHT SUBSCRIPTION = 2019-01-20 18:38:59 +0000 // This is the time that I "re-bought" the product and StoreKit told me I'm already subscribed.)


   - DATE SUBSCRIPTION EXPIRES = 2019-01-17 16:47:19 +0000 // This is the completely wrong date.

为什么还原/重新购买给我一个完全错误的product_id和有效日期,而初次购买却没问题?

如果需要,我可以发布更多代码来帮助调试这个奇怪的问题。请让我知道您想看什么。

0 个答案:

没有答案