Options
All
  • Public
  • Public/Protected
  • All
Menu

Auto-renewable subscription.

What is a subscription? It's simply a series of subscription periods where each period has a start time (purchase date) and an end time (expire date) where the customer's access to that product is active.

When the first purchase is made along with all future renewals (including when the customer restores a subscription after a billing issue) all of these transactions, free trials, discounts, all come together as subscription periods into a subscription.

Subscriptions are identified by the list of transactions with the same originalTransactionId.

Note: This is auto-renewable only. Non auto-renewable subscriptions are up to you to handle how long they last and prompting your customers to purchase again.

Hierarchy

  • AutoRenewableSubscription

Index

Properties

allTransactions

All transactions for this subscription. Ordered by the expiration date of the transaction with the latest expire date first in the list. This sort order is recommended by Apple in this WWDC video: https://developer.apple.com/videos/play/wwdc2018/705/ as the method to determine the subscription period.

See latestExpireDateTransaction

Optional cancelledDate

cancelledDate: Date

Date that the customer cancelled their subscription, if they did.

currentEndDate

currentEndDate: Date

The current end date of this subscription. This is a date that is calculated for you by evaluating the expires date, if there was a cancellation stopping the subscription early, or if the subscription is in a grace period and you should extend access.

This is the date that you can use to determine how long your customer should have access to the subscription content.

Note: This date can increase and decrease at anytime. The subscription can be cancelled immediately (through refund or upgrade/crossgrade). Do not assume that it only increases.

currentProductId

currentProductId: string

The product_id of the subscription the customer is currently paying for or did pay for. This value may change if the customer changes to a different product.

expireDate

expireDate: Date

The date that the current subscription period will end if not renewed or later on restored. If the subscription is cancelled or goes into a grace period, this Date does not change. It only changes if the subscription gets renewed or restored.

See currentEndDate for a Date that puts into effect if a subscription is cancelled or is in a grace period.

Optional gracePeriodExpireDate

gracePeriodExpireDate: Date

The date that the grace period should end. If a user recovers their subscription billing before this date, the user's subscription will go uninterrupted. If they do not, they can still fix the issue after the date but the subscription will go through a recovery because the subscription will be restored.

Note: This field will not be populated if the customer is not in a grace period for this subscription.

isEligibleIntroductoryOffer

isEligibleIntroductoryOffer: boolean

Determine if the customer is eligible for an introductory offer. New customers are always eligible but existing customers who have not yet redeemed an offer are also eligible. This field determines if the customer has ever redeemed an offer for the subscription group this subscription belongs to.

Learn more about how to implement intro offers in your app

isInBillingRetry

isInBillingRetry: boolean

If the user is in billing retry state. This starts after a billing issue has occurred and lasts as long as Apple wishes (documentation currently says "up to 60 days").

This field can be true even after the gracePeriodExpireDate as lapsed. The grace period time is much shorter: 6-16 days depending on the subscription date.

isInFreeTrialPeriod

isInFreeTrialPeriod: boolean

Indicates if the customer is currently in the free trial period of their subscription.

issues

Various statuses about this subscription beyond if the customer should be given access to the paid content or not (see {@link subscriptionPaidStatus}). These values are meant to be helpful in notifying your customer, if you choose to do so, to reduce losing customers. Maybe the customer is having a billing issue and they need to update their credit card, maybe you have introduced a pricing increase and the customer has not yet accepted it yet. There are many scenarios and it's up to you to decide what to act upon.

See {@link actionableStatusesStrings} for a string version.

issuesStrings

Strings version of {@link actionableStatuses}. This strings version is convenient for storing in a database or sending to a client application for easy parsing. That way you can handle issues in the UI of your client apps and get the issues resolved.

latestExpireDateTransaction

latestExpireDateTransaction: AutoRenewableSubscriptionTransaction

For convenience, the first entry of allTransactions.

See allTransactions

originalTransactionId

originalTransactionId: string

Used to identify a subscription.

This same id will be used for all future renewals or restores. This may include a downgrade or crossgrade performed by a user. Upgrades and crossgrades with the same duration are cancelled and a new subscription is created.

Optional priceIncreaseAccepted

priceIncreaseAccepted: undefined | false | true

If the customer has been notified and then accepted a price increase.

This value is populated only if the customer has been notified of the increase. If it's undefined, the customer has not yet been notified or there is not a price increase happening.

status

Status of the subscription.

Note: This value does not determine if the customer will renew or not. It is more designed to determine their paid status at this moment. See {@link actionableStatuses} to get info about the future of the subscription.

subscriptionGroup

subscriptionGroup: string

The subscription group the subscription's product_id belongs to.

usedOfferCodes

usedOfferCodes: string[]

If the customer has redeemed an offer code, this field will be populated with the reference name that you set for the offer.

You determine in App Store Connect is an offer code is available for new, active, or expired users.

Note: This is a unique list based off the reference name. If the same offer is used multiple times, it's only listed here once.

usedPromotionalOffers

usedPromotionalOffers: string[]

If the customer has used any promotional offers for this subscription, all of them are listed here.

Note: This is a unique list based off the reference name. If the same offer is used multiple times, it's only listed here once.

willAutoRenew

willAutoRenew: boolean

If the customer is currently planning on automatically renewing their subscription.

A customer at anytime may decide to go into their Apple account and setup their subscription to cancel after their current subscription period expires.

Note: This value is also true if the customer is going to downgrade to another product at the end of the subscription period. Just because they will auto renew does not mean they will auto renew the current product. See willDowngradeToProductId.

Optional willDowngradeToProductId

willDowngradeToProductId: undefined | string

If the customer decides to downgrade their subscription, this is the product id that they will change to when the current subscription period is over.

Legend

  • Constructor
  • Property
  • Method
  • Static property
  • Static method
  • Property
  • Inherited property

Generated using TypeDoc