简体   繁体   English

与 Apple 的用于自动更新订阅的 verifyReceipt JSON 混淆

[英]Confused with Apple's verifyReceipt JSON for Auto-renewable subscription

I got the JSON using this url: https://sandbox.itunes.apple.com/verifyReceipt , so it is about Sandbox, not production.我使用这个 url 得到了 JSON: https://sandbox.itunes.apple.com/verifyReceipt ,所以它是关于沙盒的,而不是生产。
I have some questions about this JSON because it is not very clear to me, and I think for lot of guys using IAP for the first time, too.我对这个 JSON 有一些疑问,因为它对我来说不是很清楚,而且我认为很多第一次使用 IAP 的人也是如此。

I wnat to remove some user's features if his Premium Account has ended(he cancelled subscription).如果他的高级帐户已结束(他取消订阅),我想删除一些用户的功能。 In my case subscription is 1 week free trial, then $0.99 monthly.就我而言,订阅是 1 周免费试用,然后每月 0.99 美元。

  1. Which objects from this JSON should I check?我应该检查这个 JSON 中的哪些对象?
  2. Why expire_date is the same as purchase_date (Only few minutes difference)?为什么expire_datepurchase_date (只有几分钟的差别)? Is it just up to Sandbox?是否仅由 Sandbox 决定?
  3. I subscribed with my test user, got 7 days free trial, then I went to settings and cancelled the subscription, then opened app again and saw the object is_trial_period is set to true ?我订阅了我的测试用户,获得了 7 天的免费试用,然后我去设置并取消订阅,然后再次打开应用程序并看到对象is_trial_period设置为true Is it correct?这是正确的吗? I then changed my phone's date and made it about 10 days after purchase_date(trial period should be false then I think?) but the object is still true然后我更改了手机的日期并在购买日期后约 10 天(试用期应该是false我认为?)但对象仍然是true
  4. Also, I tested purchases with this phone many times and seems like I got all those receipts in my json, should I check only the last one?另外,我用这款手机测试了很多次购买,似乎我的 json 中收到了所有这些收据,我应该只检查最后一个吗?
  5. Can anyone clear the last object in array called 'status'.任何人都可以清除名为“状态”的数组中的最后一个对象。 In my case it is 0 value.在我的情况下,它是0值。
  6. When I want to buy subscription, it is always the [environment:sandbox] version.当我想购买订阅时,总是[环境:沙盒]版本。 Is this going to change automatically when the app goes to production?当应用程序投入生产时,这会自动改变吗?

    I think I have read all Apple's documentation and SO's questions and answers about auto-renewable IAPs, please don't paste links ...我想我已经阅读了所有 Apple 的文档以及 SO 关于自动可再生 IAP 的问题和答案, please don't paste links ...

    I hope there is someone who understood this well to clear all these things about auto-renewable IAP.我希望有人能很好地理解这一点,以清除有关自动再生 IAP 的所有这些事情。

Part of JSON, for @Kishan: JSON 的一部分,对于 @Kishan:
 { "expires_date" = "2020-10-12 12:51:58 Etc/GMT"; "expires_date_ms" = 1602507118000; "expires_date_pst" = "2020-10-12 05:51:58 America/Los_Angeles"; "is_in_intro_offer_period" = false; "is_trial_period" = true; "original_purchase_date" = "2020-10-12 12:49:00 Etc/GMT"; "original_purchase_date_ms" = 1602506940000; "original_purchase_date_pst" = "2020-10-12 05:49:00 America/Los_Angeles"; "original_transaction_id" = 1000000725499801; "product_id" = "com.sleepfan.premium"; "purchase_date" = "2020-10-12 12:48:58 Etc/GMT"; "purchase_date_ms" = 1602506938000; "purchase_date_pst" = "2020-10-12 05:48:58 America/Los_Angeles"; quantity = 1; "subscription_group_identifier" = 20691399; "transaction_id" = 1000000728899049; "web_order_line_item_id" = 1000000056417123; }

I think you forgot to read this document我想你忘了阅读这份文件

  1. Which objects from this JSON should I check?我应该检查这个 JSON 中的哪些对象?

    You have to check latest_receipt_info from JSON which gives information about your latest transaction您必须从 JSON 检查latest_receipt_info ,它提供有关您最新交易的信息

  2. Why expire_date is the same as purchase_date (Only a few minutes difference)?为什么expire_datepurchase_date (只有几分钟的差别)? Is it just up to Sandbox?是否仅由 Sandbox 决定?

在此处输入图片说明

  1. I subscribed with my test user, got 7 days free trial, then I went to settings and canceled the subscription, then opened the app again and saw the object is_trial_period is set to true?我和我的测试用户订阅了,获得了 7 天的免费试用,然后我去设置取消订阅,然后再次打开应用程序,看到对象 is_trial_period 设置为 true? Is it correct?这是正确的吗?

    As far as I know, from my experience, test users can't access the settings page to manage their subscriptions on their iPhone.据我所知,根据我的经验,测试用户无法访问设置页面来管理他们在 iPhone 上的订阅。 Sandbox subscriptions will just cancel after 5 or 6 repetitions.沙盒订阅将在重复 5 或 6 次后取消。

  2. Can anyone clear the last object in array called 'status'.任何人都可以清除名为“状态”的数组中的最后一个对象。 In my case it is 0 value.在我的情况下,它是 0 值。

    Either 0 if the receipt is valid, or a status code if there is an error.如果收据有效,则为 0,如果有错误,则为状态代码。

  3. When I want to buy a subscription, it is always the [environment: sandbox] version.当我想购买订阅时,总是[环境:沙箱]版本。 Is this going to change automatically when the app goes to production?当应用程序投入生产时,这会自动改变吗?

    As far as I know, when you upload your product(which you want to sell as IAP) on iTunes connect, once your product approved, the message of the sandbox will be removed.据我所知,当您在 iTunes Connect 上上传您的产品(您想作为 IAP 出售)时,一旦您的产品获得批准,沙箱的消息将被删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM