获取应用程序内购买自动续订订阅结束日期的最佳策略

时间:2023-01-12 21:34:23

I have been reading a lot about auto-renewable subscriptions but so far I could not get a satisfactory answer to my questions.

我一直在阅读很多关于汽车可再生订阅的内容,但到目前为止,我无法对我的问题得到满意的答复。

Imagine a user subscribed to my app for 1 month and the very first view of the app has some content that only visible with subscription. Now imagine it's the first day of second's month subscription (after auto-renewed). If I don't query the expiry date from apple server, user can't see subscription items, because the expiry date of first month already passed and we need to get the new expiry date.

想象一下,用户订阅我的应用程序1个月,该应用程序的第一个视图有一些只有订阅可见的内容。现在想象它是第二个月订阅的第一天(自动续订后)。如果我没有从苹果服务器查询到期日,则用户看不到订阅项,因为第一个月的到期日已经过去,我们需要获得新的到期日。

My questions are:

我的问题是:

1- Is there a way to get the end date of the subscription offline and without disturbing the user (with password prompt etc.)? How user will get subscription content if it is the first day of auto-renewed subscription (second month and so on) and if user don't have internet? Will he see locked content if he has no internet? If so this is sounds weird to me.

1-有没有办法让订阅的结束日期离线并且不会打扰用户(有密码提示等)?如果是自动续订订阅的第一天(第二个月等),并且用户没有互联网,用户将如何获得订阅内容?如果他没有互联网,他会看到锁定的内容吗?如果是这样,这对我来说听起来很怪异。

2- If it is not possible to get expiry date of auto-renewed subscription offline, what is the best approach to get expiry date of auto-renewed subscription without asking or prompting something to user? Because we want to show the very first page of the app with subscription content smoothly. What comes to my mind is to make user wait during launching and check expiry date from server.

2-如果无法离线自动续订订阅的到期日期,在不向用户询问或提示某些内容的情况下,获取自动续订订阅的到期日期的最佳方法是什么?因为我们希望能够顺利地显示应用程序的第一页以及订阅内容。我想到的是让用户在启动期间等待,并从服务器检查到期日期。

I am sure many developers are still concerned with those issues.

我相信很多开发人员仍然关注这些问题。

1 个解决方案

#1


1  

It's been a long time since the last time that I integrated an auto renewable subscription and it harder than I expected, but I can give you some general hints and some more specific for your question.
Starting from your question.

自上次我整合自动续订订阅以来,已经很长时间了,它比我预期的要难,但我可以给你一些一般的提示,一些更具体的问题。从你的问题开始。

  • Not exactly, you can get the last updated receipt by asking getting the receipt from the receiptURL, here is where I've found a really gray area. I never had a chance to understand exactly when a receipt is updated automatically, probably this happen right after Apple charged you (of course this update needs a connection). This doesn't seems to happen when you have restored a purchase on another device.
  • 不完全是,您可以通过询问从receiptURL获取收据来获取最后更新的收据,这里是我找到了一个非常灰色的区域。我从来没有机会准确理解收据何时自动更新,这可能发生在Apple收费后(当然此更新需要连接)。当您在其他设备上恢复购买时,似乎不会发生这种情况。
  • Yes there are, when you have a chance to validate the receipt you can store the expire date somewhere (maybe in a secure way) and only before one or two days after that day try to validate it again. If you want you can apply also a grace period after.

    Other tips:
  • 是的,当您有机会验证收据时,您可以将过期日期存储在某个地方(可能是以安全的方式),并且仅在那天之后的一两天内尝试再次验证。如果您愿意,您也可以申请一段宽限期。其他提示:
  • you MUST create a way to restore the purchase or your app will be rejected
  • 您必须创建一种恢复购买的方法,否则您的应用将被拒绝
  • on sandbox at the first launch the receipt will not exist, but in production an app will always have a receipt, maybe without subscription info, but there is. Thus if you want to simulate some use case in sandbox environment is better if you restore the purchase right after the launch of the application.
  • 在沙盒上第一次启动时收据将不存在,但在生产中,应用程序将始终有收据,可能没有订阅信息,但有。因此,如果要在沙盒环境中模拟某些用例,则在应用程序启动后立即恢复购买会更好。
  • restore purchase always requires username and pwd and refresh receipt seems too
  • 恢复购买总是需要用户名和密码,刷新收据似乎也是如此

Maybe some of this info are a little bit outdated, I made the integration with iOS7 and never had a chance to update it.

也许有些信息有点过时,我与iOS7进行了整合,从未有机会更新它。

#1


1  

It's been a long time since the last time that I integrated an auto renewable subscription and it harder than I expected, but I can give you some general hints and some more specific for your question.
Starting from your question.

自上次我整合自动续订订阅以来,已经很长时间了,它比我预期的要难,但我可以给你一些一般的提示,一些更具体的问题。从你的问题开始。

  • Not exactly, you can get the last updated receipt by asking getting the receipt from the receiptURL, here is where I've found a really gray area. I never had a chance to understand exactly when a receipt is updated automatically, probably this happen right after Apple charged you (of course this update needs a connection). This doesn't seems to happen when you have restored a purchase on another device.
  • 不完全是,您可以通过询问从receiptURL获取收据来获取最后更新的收据,这里是我找到了一个非常灰色的区域。我从来没有机会准确理解收据何时自动更新,这可能发生在Apple收费后(当然此更新需要连接)。当您在其他设备上恢复购买时,似乎不会发生这种情况。
  • Yes there are, when you have a chance to validate the receipt you can store the expire date somewhere (maybe in a secure way) and only before one or two days after that day try to validate it again. If you want you can apply also a grace period after.

    Other tips:
  • 是的,当您有机会验证收据时,您可以将过期日期存储在某个地方(可能是以安全的方式),并且仅在那天之后的一两天内尝试再次验证。如果您愿意,您也可以申请一段宽限期。其他提示:
  • you MUST create a way to restore the purchase or your app will be rejected
  • 您必须创建一种恢复购买的方法,否则您的应用将被拒绝
  • on sandbox at the first launch the receipt will not exist, but in production an app will always have a receipt, maybe without subscription info, but there is. Thus if you want to simulate some use case in sandbox environment is better if you restore the purchase right after the launch of the application.
  • 在沙盒上第一次启动时收据将不存在,但在生产中,应用程序将始终有收据,可能没有订阅信息,但有。因此,如果要在沙盒环境中模拟某些用例,则在应用程序启动后立即恢复购买会更好。
  • restore purchase always requires username and pwd and refresh receipt seems too
  • 恢复购买总是需要用户名和密码,刷新收据似乎也是如此

Maybe some of this info are a little bit outdated, I made the integration with iOS7 and never had a chance to update it.

也许有些信息有点过时,我与iOS7进行了整合,从未有机会更新它。