我对In App Purchase的收据格式有疑问。
主要收据对象具有一个名为Subscription Expiration Date
的字段。
但是,如果应用程序具有多种续订类型,该字段会反映什么?
答案 0 :(得分:0)
它在documentation中被称为Subscription Expiration Date
,但是如果您在下面读到json键的实际名称是expires_date
,则只是想在搜索之前指出这一点寻找在您的应用中找不到它。
要回答您的问题,您会在文档中看到特定的密钥Subscription Expiration Date
列在名为In-App Purchase Receipt Fields
的标题下。这意味着我可以根据自己的经验来确认,此密钥存在于每次应用内购买订阅的过程中以及每次续订时。这意味着可以进行多次购买,每笔购买都作为他们自己的收据json条目,每笔购买都有expires_date
。
如果要使用该密钥进行验证,则收据上将有一个来自Apple服务器的请求日期。使用该日期查看这些订阅之一是否仍在运行。
希望这会有所帮助。
编辑:这是一个实际的已解析收据定向示例。 请注意,出于安全考虑,我删除了一些ID。在这里,您可以看到一张收据,在顶部可以看到特定的收据信息,然后进行一次购买,然后每年续约4次。
["original_purchase_date_pst": Optional(2013-08-01 00:00:00
America/Los_Angeles),
"bundle_id": Optional(yourAppBundleId),
"receipt_creation_date_pst": Optional(2018-12-20 02:20:38 America/Los_Angeles),
"receipt_type": Optional(ProductionSandbox),
"app_item_id": Optional(0), "application_version": Optional(2),
"request_date_pst": Optional(2018-12-20 02:20:41 America/Los_Angeles),
"original_purchase_date_ms": Optional(1375340400000),
"receipt_creation_date_ms": Optional(1545301238000),
"in_app": Optional(<__NSArrayI 0x283b736b0>(
{
"is_trial_period" = false;
"original_purchase_date" = "2018-12-07 12:00:43 Etc/GMT";
"original_purchase_date_ms" = 1544184043000;
"original_purchase_date_pst" = "2018-12-07 04:00:43 America/Los_Angeles";
"original_transaction_id" = XXXXXXXXXXXXX;
"product_id" = "someSinglePurchase";
"purchase_date" = "2018-12-07 12:00:43 Etc/GMT";
"purchase_date_ms" = 1544184043000;
"purchase_date_pst" = "2018-12-07 04:00:43 America/Los_Angeles";
quantity = 1;
"transaction_id" = 10000XXXXXXXXX;
},
{
"expires_date" = "2018-12-07 13:01:21 Etc/GMT";
"expires_date_ms" = 1544187681000;
"expires_date_pst" = "2018-12-07 05:01:21 America/Los_Angeles";
"is_in_intro_offer_period" = false;
"is_trial_period" = false;
"original_purchase_date" = "2018-12-07 12:01:22 Etc/GMT";
"original_purchase_date_ms" = 1544184082000;
"original_purchase_date_pst" = "2018-12-07 04:01:22 America/Los_Angeles";
"original_transaction_id" = 10000XXXXXXXXX;
"product_id" = "yearlySubscription";
"purchase_date" = "2018-12-07 12:01:21 Etc/GMT";
"purchase_date_ms" = 1544184081000;
"purchase_date_pst" = "2018-12-07 04:01:21 America/Los_Angeles";
quantity = 1;
"transaction_id" = 10000XXXXXXXXX;
"web_order_line_item_id" = 10000XXXXXXXXX;
},
{
"expires_date" = "2018-12-07 14:01:35 Etc/GMT";
"expires_date_ms" = 1544191295000;
"expires_date_pst" = "2018-12-07 06:01:35 America/Los_Angeles";
"is_in_intro_offer_period" = false;
"is_trial_period" = false;
"original_purchase_date" = "2018-12-07 12:01:22 Etc/GMT";
"original_purchase_date_ms" = 1544184082000;
"original_purchase_date_pst" = "2018-12-07 04:01:22 America/Los_Angeles";
"original_transaction_id" = 10000XXXXXXXXX;
"product_id" = "yearlySubscription";
"purchase_date" = "2018-12-07 13:01:35 Etc/GMT";
"purchase_date_ms" = 1544187695000;
"purchase_date_pst" = "2018-12-07 05:01:35 America/Los_Angeles";
quantity = 1;
"transaction_id" = 10000XXXXXXXXX;
"web_order_line_item_id" = 10000XXXXXXXXX;
},
{
"expires_date" = "2018-12-07 15:01:35 Etc/GMT";
"expires_date_ms" = 1544194895000;
"expires_date_pst" = "2018-12-07 07:01:35 America/Los_Angeles";
"is_in_intro_offer_period" = false;
"is_trial_period" = false;
"original_purchase_date" = "2018-12-07 12:01:22 Etc/GMT";
"original_purchase_date_ms" = 1544184082000;
"original_purchase_date_pst" = "2018-12-07 04:01:22 America/Los_Angeles";
"original_transaction_id" = 10000XXXXXXXXX;
"product_id" = "yearlySubscription";
"purchase_date" = "2018-12-07 14:01:35 Etc/GMT";
"purchase_date_ms" = 1544191295000;
"purchase_date_pst" = "2018-12-07 06:01:35 America/Los_Angeles";
quantity = 1;
"transaction_id" = 10000XXXXXXXXX;
"web_order_line_item_id" = 10000XXXXXXXXX;
}