In-app Purchase Programming Guide----(vi)----working with subscriptions

Source: Internet
Author: User

Working with subscriptions

Apps that use subscriptions has some additional behaviors and considerations. Because subscriptions incorporate an element of time, your apps needs to has the appropriate logic to determine whether th E subscription is currently active and what time periods the subscription were active in the past. Your app also needs to react to new and renewed subscriptions, and properly handle expired, subscriptions. Figure 5-1 shows a example subscription timeline, including some of the complexities your app needs to handle.

Applications that use subscriptions (subscriptions) have some additional behavior and considerations (considerations). Because the subscription contains a time element, the application needs to have the appropriate logic to determine whether the subscription is currently active and the time period in which the subscription activity was in the past. The application also needs to respond to new and updated subscriptions, and it needs to handle expired subscriptions correctly. Figure 5-1 illustrates an example of a subscription schedule, including some of the complexities that some applications need to handle (complexities).

Figure 5-1 Example Subscription Timeline

Calculating a Subscription ' s Active Period

First, calculate the active period of a subscription

Your app needs to determine what content the user have access to based on the period of time the subscription was active. Consider, for example, a user with a subscription to a magazine that publishes a new issue on the first day of each month, Following the timeline shown in Table 5-1.

The application needs to determine what the user is accessing during the period during which the subscription is active. For example, a user subscribes to a magazine that publishes a new issue on the first day of each month, with a schedule of 5-1:

Table 5-1Timeline of a sample subscription table 5-1 Schedule for one example subscription

Date

Event

February 1

February issue is published. It is not made available because the user have not yet subscribed. (It is made Avaibalbe later, after the user subscribes.)

February issue. The user is not available because he has not subscribed (can be used after subscription).

February 20

User subscribes with a duration of one month. January issue is made available immediately.

The user subscribed to a one-month term magazine. The January issue can be used immediately.

March 1

March issue is published. It is made available immediately because the user have an active subscription.

March issue. The user can immediately use it because it already has an active subscription.

March 20

The user ' s subscription automatically renews for another month.

Users ' subscriptions are automatically renewed for one months.

April 1

April issue is published. It is made available immediately because the user have an active subscription.

April issue. the user can immediately use it because it already has an active subscription.

April 20

The user prevents the subscription from renewing, ending the subscription period.

The user ends the renewal.

May 1

May issue is published. It is not made available because the user's subscription has lapsed.

May issue. The user is not available because the subscription has expired.

June 1

June issue is published. It is not immediately made available because the user's subscription has lapsed. (It is made available later, after the user resubscribes.)

June issue. The user is not available because the subscription is invalidated (users can use it immediately if they re-subscribe).

June 17

User Resubscribes. June issue is made available immediately.

The user subscribes again. The June issue is available immediately.

July 1

July issue is published. It is made available immediately because the user have an active subscription.

July issue. the user can immediately use it because it already has an active subscription.

To implement the Your app, keep a record of the date, the piece of content are published. Read the Original Purchase date and Subscription expiration Date field from each receipt entry to determine the start and End dates of the subscription. (For information on the receipt, see Receipt Validation ProgrammingGuide.) The user has access to all content published between each start and end date, as well as the content is initially UN Locked when the subscription was purchased. If the subscription lapsed, there'll be is multiple periods of time during which the subscription was active, and there wil L be pieces of content unlocked at the beginning of a subscription period.

To implement this logic in your application, keep a date record of the publication of each published content. The start and end dates of a subscription are determined by reading the initial purchase date and the subscription expiration period from each receipt item. (For more information on receipts, see Receipt Validation ProgrammingGuide.) Users can access all content that is published between the start and end dates and what is unlocked when it is first purchased. If the subscription expires (lapsed), it will be unlocked by multiple time periods during the subscription activity, as well as by multiple publications at the beginning of a subscription period.

Note: Don ' t calculate the subscription period by adding a subscription duration to the purchase date. This approach fails-take-into account the free trial period, the marketing opt-in period, and the content made AVAILABL E immediately after the user purchased the subscription.

Note: Do not calculate the subscription period by adding a subscription duration to the purchase date. This method does not take into account the application trial period, the market choice period, and lets the user buy the subscription immediately after unlocking the content.

Continuing the example from Table 5-1, the receipt would show the following start and end dates:

To continue the example starting with table 5-1, the receipt will display the following start and end dates:

    • February 20–march 20

    • March 20–april 20

    • (The lapse from April 20–june are not recorded explicitly in the receipt.)

    • June 17–july 17

The user has access to the February and June issues because they were initially unlocked when the subscription is Purchas Ed or restarted.

Users can access the February and June journals because they are unlocked when the subscription is purchased or re-subscribed.

The user has access to the March, April, June, and July issues because the subscription times.

Users can access the March, April, June, and July journals because subscriptions are active at these times.

Expiration and renewal

Ii. Expiry and renewal

The renewal process begins with a "preflight" check, starting ten days before the expiration date. During Those ten days, the App Store checks for any issues that might delay or prevent the subscription from being Automat Ically Renewed-for example, if the customer no longer have an active payment method, if the product's price increased since The user bought the subscription, or if the product is no longer available. The APP Store notifies users of any issue so this they can resolve it before the subscription needs to renew, ensuring the IR subscription isn ' t interrupted.

The renewal process begins 10 days prior to the expiration date of the pre-check. During those 10 days, the store checks for any scenarios that could cause automatic renewal delays or non-renewal---for example, if the user does not have an available payment method, if the user buys a subscription, the product price rises, or if the product does not already exist. The store notifies users of any problems so that they can resolve these issues before renewing them to ensure that their renewals are not terminated.

Note: Increasing the price of a subscription doesn ' t disable automatic renewal for all customers, and only for those customers whose Subscription expires in the next ten days. If This was a mistake, changing it back to the original price means no additional users were affected. If This was intentional, keeping the new higher price causes automatic renewal to being disabled for the rest of your U Sers in turn as they enter the Ten-day renewal window.

Note: Increasing the subscription price does not terminate automatic renewal for all users as long as those users expire within the next 10 days. If the price change is an error, changing the price back to the original price will not affect any user. If the price is intentionally submitted, keeping the new price will cause other users to enter the 10-day renewal window in turn to be unable to renew automatically.

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 is too many failed attempts.

The store starts trying to renew automatically during the first 24 hours of the subscription's expiration. Although the store tries to auto-renew multiple times during auto-renewal, it terminates automatic renewal if too many failures occur.

The APP Store renews the subscription slightly before it expires, to prevent all lapse in the subscription. However, lapses is still possible. For example, if the user's payment information is no longer valid, the first renewal attempt would fail. If the user doesn ' t update this information until after the subscription expires, there would is a short lapse in the subs Cription between the expiration date and the date that a subsequent automatic renewal succeeds. The user can also disable automatic renewal and intentionally let the subscription expire, then renew it at a later date, Creating a longer lapse in the subscription. Make sure your app ' s subscription logic can handle lapses of various durations correctly.

Although the store automatically renews before it expires, it prevents any subscriptions from being lost. However, it is still possible to lose. For example, if a user's payment information has expired, the first renewal will fail. If the user has not updated the payment information until the subscription expires, the time will be lost for a short period of time before the expiration and the next automatic renewal is successful. Users can also turn off auto-renewal and intentionally expire subscriptions, and then subscribe to it for a long-term loss of subscription. Make sure that your application's subscription logic handles the loss of different times correctly.

After a subscription was successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same is as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer are not called; Your app finds out about the renewal the next time it ' s launched.

After a successful renewal, the store kit adds the renewal transaction to the trading queue. The application checks the transaction queue at startup and processes it as it does with any other transaction. Note If the application is already running at the time of renewal, the trading observer will not be called; the application finds the renewal record at the next startup.

Cancellation

Third, cancellation

A subscription is paid-in-full when it's purchased and can be refunded only by contacting Apple customer service. For example, if the user accidentally buys the wrong product, customer support can cancel the subscription and issue a ref und. It ' s not possible-customers to change their mind in the middle of a subscription period and decide they don ' t want to Pay for the rest of the subscription.

A full payment will be made after a subscription has been purchased and can only be refunded by contacting Apple Customer service. For example, if a user accidentally buys the wrong product, the customer service center can cancel the transaction and refund it. Users cannot change in the middle of a subscription cycle and pay no attention to the remaining subscriptions.

To check whether a purchase have been canceled, look for the cancellation Date field in the receipt. If The field has a date in it, regardless of the subscription ' s expiration date, the purchase have been canceled-treat a CA nceled receipt the same as if no purchase had ever been made.

To confirm that a transaction has been canceled, look for the cancellation date (cancellation date) field in the receipt (receipt). If the field has a date, regardless of the expiration date of the subscription, the transaction has been canceled---the cancellation of the transaction is the same as the one that has not been purchased.

Depending on the type of product, your May is able to check only the currently active subscription, or your may need to CHEC K all past subscriptions. For example, a magazine app would need to check all past subscriptions to determine which issues the user had access to.

Depending on the product type, you may only be able to check the current active transaction, or you may need to check all past transactions. For example, a magazine application needs to check all past transactions to determine the user's access to those journals.

Cross-platform Considerations

Iv. Cross-platform considerations

Product identifiers is associated with a single app. Apps which has both an IOS and OS X version has separate products W ITH separate product identifiers on each platform. You could let users has a subscription in an IOS app access the content from a OS X app (or vice versa), but Impleme Nting that functionality is your responsibility. Would need some system for identifying users and keeping track of what content they ' ve subscribed to, similar to what You would implement for a app that uses non-renewable subscriptions.

The product identification code can only be bound to one application. Applications that have iOS and OS X versions are different applications and have different product identifiers, respectively. You can have users who purchased subscriptions in an iOS app access the content they purchased from OS X apps (or other platforms), but this feature should be implemented on your own. You will need some systems to identify users and keep track of what they have subscribed to, similar to what you will do to a no-renewable subscriptions (non-renewable subscription) application.

Letting Users Manage Subscriptions

V. Let users manage subscriptions

Rather than needing to code your own subscription management UI, your app can open the following URL:

Without your own coding to implement your own subscription management UI, your application can open the following URLs:

Https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions

Opening This URL is launches itunes or itunes Store, and then displays the Manage Subscription page.

Open the URL to start the itunes or itunes Store, and then display the Manage Subscriptions page.

The Test Environment

6. Test environment

For the sake of testing, there is some differences in behavior between auto-renewable subscriptions in the production env Ironment and in the test environment.

For testing, the automatic regeneration subscription behaves differently in the product environment (production environment) and in the test environment.

Renewal happens at the accelerated rate, and auto-renewable subscriptions renew a maximum of six times per day. This lets your test how your app handles a subscription renewal, a subscription lapse, and a subscription history that incl Udes gaps.

Updates occur at acceleration, and Automatic Updates subscriptions are updated up to 6 times per day. This allows you to test how your application handles a subscription update, a subscription failure, and a subscription history that includes a gap.

Because of the accelerated expiration and renewal, the subscription can expire before the system starts trying to ren EW the subscription, leaving a small lapse in the subscription period. Such lapses is also possible in production for a variety of reasons-make sure your app handles them correctly.

Because of accelerated expiration and update speed, subscriptions can expire before the system starts trying to update the subscription, leaving a small error during the subscription. For various reasons, such errors may also exist in the product---Make sure that your application can handle them correctly.

Next Page Previous page
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.