gpt4 book ai didi

iOS 应用内购买 : request latest cancellation date and number of cancellations

转载 作者:行者123 更新时间:2023-11-28 21:03:00 31 4
gpt4 key购买 nike

我正在使用 iOS 应用内购买。

我想请求最新的取消日期和取消总数,最好是 100% 正确的结果。

我正在使用 Apple 的 verifyreceipt 调用

(
https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1
->
https://sandbox.itunes.apple.com/verifyReceipt
/
https://buy.itunes.apple.com/verifyReceipt
JSON response field descriptions : https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW25
) .

JSON 响应具有以下格式:

(lldb) po jsonResponse
{
environment = Sandbox;
"latest_receipt" = "<some binary text>";
"latest_receipt_info" = (
{
"expires_date" = "2017-11-17 15:41:31 Etc/GMT";
"expires_date_ms" = 1510933291000;
"expires_date_pst" = "2017-11-17 07:41:31 America/Los_Angeles";
"is_trial_period" = true;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 14:41:31 Etc/GMT";
"purchase_date_ms" = 1510929691000;
"purchase_date_pst" = "2017-11-17 06:41:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353161868;
"web_order_line_item_id" = 1000000036932780;
},
{
"expires_date" = "2017-11-17 15:46:31 Etc/GMT";
"expires_date_ms" = 1510933591000;
"expires_date_pst" = "2017-11-17 07:46:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:41:31 Etc/GMT";
"purchase_date_ms" = 1510933291000;
"purchase_date_pst" = "2017-11-17 07:41:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353176570;
"web_order_line_item_id" = 1000000036932781;
},
{
"expires_date" = "2017-11-17 15:51:31 Etc/GMT";
"expires_date_ms" = 1510933891000;
"expires_date_pst" = "2017-11-17 07:51:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:46:31 Etc/GMT";
"purchase_date_ms" = 1510933591000;
"purchase_date_pst" = "2017-11-17 07:46:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353177515;
"web_order_line_item_id" = 1000000036933429;
},
{
"expires_date" = "2017-11-17 15:56:31 Etc/GMT";
"expires_date_ms" = 1510934191000;
"expires_date_pst" = "2017-11-17 07:56:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:51:31 Etc/GMT";
"purchase_date_ms" = 1510933891000;
"purchase_date_pst" = "2017-11-17 07:51:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353178539;
"web_order_line_item_id" = 1000000036933488;
},
{
"expires_date" = "2017-11-17 16:01:31 Etc/GMT";
"expires_date_ms" = 1510934491000;
"expires_date_pst" = "2017-11-17 08:01:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:56:31 Etc/GMT";
"purchase_date_ms" = 1510934191000;
"purchase_date_pst" = "2017-11-17 07:56:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353179673;
"web_order_line_item_id" = 1000000036933554;
},
{
"expires_date" = "2017-11-17 16:06:31 Etc/GMT";
"expires_date_ms" = 1510934791000;
"expires_date_pst" = "2017-11-17 08:06:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 16:01:31 Etc/GMT";
"purchase_date_ms" = 1510934491000;
"purchase_date_pst" = "2017-11-17 08:01:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353180672;
"web_order_line_item_id" = 1000000036933616;
},
{
"expires_date" = "2017-11-18 16:03:15 Etc/GMT";
"expires_date_ms" = 1511020995000;
"expires_date_pst" = "2017-11-18 08:03:15 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-18 15:58:15 Etc/GMT";
"purchase_date_ms" = 1511020695000;
"purchase_date_pst" = "2017-11-18 07:58:15 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353294875;
"web_order_line_item_id" = 1000000036933659;
}
);
"pending_renewal_info" = (
{
"auto_renew_product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"auto_renew_status" = 1;
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
}
);
receipt = {
"adam_id" = 0;
"app_item_id" = 0;
"application_version" = 759;
"bundle_id" = "com.myapp";
"download_id" = 0;
"in_app" = (
{
"expires_date" = "2017-11-17 15:46:31 Etc/GMT";
"expires_date_ms" = 1510933591000;
"expires_date_pst" = "2017-11-17 07:46:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:41:31 Etc/GMT";
"purchase_date_ms" = 1510933291000;
"purchase_date_pst" = "2017-11-17 07:41:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353176570;
"web_order_line_item_id" = 1000000036932781;
},
{
"expires_date" = "2017-11-17 15:51:31 Etc/GMT";
"expires_date_ms" = 1510933891000;
"expires_date_pst" = "2017-11-17 07:51:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:46:31 Etc/GMT";
"purchase_date_ms" = 1510933591000;
"purchase_date_pst" = "2017-11-17 07:46:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353177515;
"web_order_line_item_id" = 1000000036933429;
},
{
"expires_date" = "2017-11-17 15:56:31 Etc/GMT";
"expires_date_ms" = 1510934191000;
"expires_date_pst" = "2017-11-17 07:56:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:51:31 Etc/GMT";
"purchase_date_ms" = 1510933891000;
"purchase_date_pst" = "2017-11-17 07:51:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353178539;
"web_order_line_item_id" = 1000000036933488;
},
{
"expires_date" = "2017-11-17 16:01:31 Etc/GMT";
"expires_date_ms" = 1510934491000;
"expires_date_pst" = "2017-11-17 08:01:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 15:56:31 Etc/GMT";
"purchase_date_ms" = 1510934191000;
"purchase_date_pst" = "2017-11-17 07:56:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353179673;
"web_order_line_item_id" = 1000000036933554;
},
{
"expires_date" = "2017-11-17 16:06:31 Etc/GMT";
"expires_date_ms" = 1510934791000;
"expires_date_pst" = "2017-11-17 08:06:31 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 16:01:31 Etc/GMT";
"purchase_date_ms" = 1510934491000;
"purchase_date_pst" = "2017-11-17 08:01:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353180672;
"web_order_line_item_id" = 1000000036933616;
},
{
"expires_date" = "2017-11-18 16:03:15 Etc/GMT";
"expires_date_ms" = 1511020995000;
"expires_date_pst" = "2017-11-18 08:03:15 America/Los_Angeles";
"is_trial_period" = false;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-18 15:58:15 Etc/GMT";
"purchase_date_ms" = 1511020695000;
"purchase_date_pst" = "2017-11-18 07:58:15 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353294875;
"web_order_line_item_id" = 1000000036933659;
},
{
"expires_date" = "2017-11-17 15:41:31 Etc/GMT";
"expires_date_ms" = 1510933291000;
"expires_date_pst" = "2017-11-17 07:41:31 America/Los_Angeles";
"is_trial_period" = true;
"original_purchase_date" = "2017-11-17 14:41:34 Etc/GMT";
"original_purchase_date_ms" = 1510929694000;
"original_purchase_date_pst" = "2017-11-17 06:41:34 America/Los_Angeles";
"original_transaction_id" = 1000000353161868;
"product_id" = "com.myapp.iap.pro.renewing.monthly.trial";
"purchase_date" = "2017-11-17 14:41:31 Etc/GMT";
"purchase_date_ms" = 1510929691000;
"purchase_date_pst" = "2017-11-17 06:41:31 America/Los_Angeles";
quantity = 1;
"transaction_id" = 1000000353161868;
"web_order_line_item_id" = 1000000036932780;
}
);
"original_application_version" = "1.0";
"original_purchase_date" = "2013-08-01 07:00:00 Etc/GMT";
"original_purchase_date_ms" = 1375340400000;
"original_purchase_date_pst" = "2013-08-01 00:00:00 America/Los_Angeles";
"receipt_creation_date" = "2017-11-18 15:58:18 Etc/GMT";
"receipt_creation_date_ms" = 1511020698000;
"receipt_creation_date_pst" = "2017-11-18 07:58:18 America/Los_Angeles";
"receipt_type" = ProductionSandbox;
"request_date" = "2017-11-18 15:58:23 Etc/GMT";
"request_date_ms" = 1511020703927;
"request_date_pst" = "2017-11-18 07:58:23 America/Los_Angeles";
"version_external_identifier" = 0;
};
status = 0;
}

我看不出有什么方法可以从此响应中提取“取消次数”信息。有什么办法吗?例如,可能使用不同的请求?

正如我所见,我可以通过检查“pending_renewal_info”的值来获得“最新取消日期”:“auto_renew_status”== 0 并遍历收据数组并获取最新的到期日期(可能会添加安全检查它小于当前日期)。但是:正如我所见,这个解决方案并没有给出 100% 正确的结果,因为:如果用户已取消订阅并在不启动应用程序的情况下在应用程序外续订,我的应用程序将无法识别该取消。有什么方法可以请求此信息?

最佳答案

您应该能够通过遍历所有收据、调用验证并检查您关心的所有产品的 pending_renewal_info 来计算取消总数。

此方法在调用时为您提供正确的结果。 pending_renewal_info 实际上并不是收据固有的,而是 Apple 的服务器返回的最新信息。因此,如果用户取消,这将在此处反射(reflect)出来。事实上,当用户取消时,收据本身根本不会改变,您的应用程序也不会收到任何新交易,唯一知道的方法是点击 verifyReceipt 端点。

如果您想查看单个用户取消的次数,则无法通过 pending_renewal_info 获得此信息。您需要查看 latest_receipt_info 字段中的各个交易并比较 purchase_dateexpires_date 和产品的持续时间以查找用户订阅的差距。如果间隔超过几天,您应该可以将其视为取消期。

关于iOS 应用内购买 : request latest cancellation date and number of cancellations,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47368630/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com