iOS 自动续订订阅的应用内购买:我们如何计算续订时长?

iOS in-app purchase of auto-renewing subscriptions: how do we compute the renewal duration?

在我们的 iOS 应用中,通过应用内购买自动续订订阅可以访问某些附加功能。我们的服务器想检查每个帐户的应用内购买收据,以查看它是否已过期或已成功续订。这是为了决定继续允许访问这些附加功能(对该帐户用户)。

在服务器上,我们如何计算续订之间的持续时间?每个月可能有 28、29、30 或 31 天。因此,如果有人在 1 月 29 日订阅,应用商店是否会在 2 月 29 日进行续订,或者使用其他算法,例如,从月末算起的天数(如果在 "second half" 中),那么可能是 2 月 26 日或 27(取决于今年 2 月有 28 天还是 29 天)?我们找不到有关 Apple 用于计算这些持续时间的算法的信息。如果有人知道或知道在哪里可以找到它,您能告诉我们吗?谢谢!

月度订阅以日历月为基础,并将在初始订阅的每月周年纪念日续订。这意味着有时用户会以相同的价格获得 31 天,有时会获得 28 天。

如果月份的天数少于周年日,则在该月的最后一天更新;如果初始订阅是在 1 月 29 日进行的,则续订将在 2 月 28 日(如果是闰年,则为 29 日)进行。

收据包含当前订阅期的到期日期。假设这不是闰年,从 1 月 29 日开始的订阅将在 2 月 28 日到期。您可以使用此到期日期作为让您的服务器检查续订的基础;您可以在到期日期前约 24 小时开始检查续订。

来自In App Purchase Programming Guide

The subscription renewal process begins in the ten days before the expiration date. During those ten days, the App Store checks for any billing issues that might delay or prevent the subscription from being automatically renewed, for example:

  • the customer’s payment method is no longer active,
  • the product increased in price since the user bought the subscription,
  • the product is no longer available.

The App Store may notify users of any issue so that they can resolve it before the subscription expires and avoid an interruption in their subscription service.

During the 24-hour period before the subscription expires, the App Store starts trying to automatically renew it. The App Store makes several attempts to automatically renew the subscription over a period of time but eventually stops if there are too many failed attempts.