Introductory Pricing for iOS: Getting Started

In this tutorial, you’ll learn how to add an introductory pricing option to an app that already offers an auto-renewable subscription. By Rony Rozen.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 2 of 3 of this article. Click here to view the first page.

Determining User Eligibility

Before displaying the discounted price to your users, you have to make sure that a specific, current user is eligible for the discounted price.

How will you know if the user is eligible? Great question!

Review the user’s past transactions to see if they’ve already used a discount from the same subscription group in the past. If so, the user isn’t eligible for a discounted price.

You can read more about receipt validation on Apple’s documentation. Also, check out our In-App Purchases: Receipt Validation Tutorial or the Receipts section of our great video course on In-App Purchases.

You’re not focused on receipt validation in this tutorial, but to implement the above explanation on your server, the fields you need in the JSON response from the App Store server are: latest_receipt_info, whose value is an array containing all in-app purchase transactions, and the is_trial_period and is_in_intro_offer_period fields in the receipt field for each relevant transaction.

Disclaimer: This tutorial’s sample app doesn’t perform receipt validation. Instead, it saves the product’s purchased state in NSUserDefaults. In a real-life app, you should perform some sort of receipt validation to make sure that a purchase took place and that money changed hands. Apple recommends you do this on your own server, but there are ways to do it locally.

To determine a user’s eligibility, check the values of the Subscription Trial Period and the Subscription Introductory Price Period for all IAP transactions. If the value for either of these fields is true for a given subscription, the user isn’t eligible for an introductory price for any of the products within the same subscription group.

New users are always eligible for the offered introductory price while lapsed subscribers — those who had a subscription in the past — are only eligible for the introductory price if they haven’t already used such an offer on this subscription or on other products from the same subscription group.

Offering Introductory Pricing to Eligible Users

OK, so now you’re going to add an introductory price to your IAP. Yay! :]

On App Store Connect, go to My Apps and select the app to which you want to add an introductory price. Then, go to Features ▸ In-App Purchases and select the correct auto-renewable subscription.

Set Auto-renewable Subscription for Introductory Pricing iOS

Then, press the + next to Subscription Prices and select Set Up Introductory Price.

Set Subscription Prices for Introductory Pricing iOS

Now, you’ll need to select the territories for which the new introductory price will apply. By default, all territories will be selected. For the purposes of this tutorial, and to allow you to test various success and failure states in the next section, deselect All Territories and select only United States, just like in the image below.

Set Territories for Introductory Pricing iOS

Press Next. Now you need to set the start and end dates for the new introductory price. Select today’s date as the Start Date and No End Date as the end date, and press Next.

Set Dates for Introductory Pricing iOS

Select Free trial and set the duration to 3 Days. This means that your users will get free access to your app’s content for three days before starting to pay the standard subscription price. Press Done and then press Save at the top-right.

Press Done and Save for Introductory Pricing iOS

That’s it! You’ve just set up an introductory price for your auto-renewable subscription. We’ll discuss the UX implications of introductory pricing in a minute, but technically speaking, you’re all done. Pat yourself on the back! Get ready to test this new feature.

Testing

Now that everything is set up, you should test it. Remember the sandbox user you created earlier? Now it’s time to use it! Note that while you can get the list of available IAPs on the simulator, to test actual purchases, you’ll need a physical device.

Run the app on your device, tap Purchase and you’ll see this alert:

Tap Purchase for Introductory Pricing iOS

Type in the details of a sandbox account that hasn’t already purchased this subscription, and tap Continue.

Note: Starting with iOS 12, you no longer need to sign out of your production account when signing in to a sandbox account! It’s now a separate item in the iTunes & App Store option of the Settings app. This is a huge improvement, especially when testing auto-renewable subscriptions.

You should now see this alert:

Purchase Complete for Introductory Pricing iOS

Once you tap OK, you’ll get random words of wisdom by Winnie the Pooh: “If you live to be a hundred, I want to live to be a hundred minus one day so I never have to live without you.” That’s one smart bear. :]

You should also check some flows that result in a failed transaction. For example, uninstall the app from the device, reinstall it, and try to purchase the same subscription with the same sandbox user. Because this user purchased the item in the past, you should get this alert, followed by a failure message:

Purchase Error for Introductory Pricing iOS

Now, uninstall and reinstall the app again and try restoring the IAP with the same sandbox user. In this case, you’ll get the same alert, but it’ll be followed by a successful restore.

In production apps, you should automatically attempt to restore the purchase as soon as you realize the user has purchased it in the past. At the very least, provide a good fallback display to the user so that the current status is clear. In this sample app, we kept things simple so that you can easily check for failed states.

You can see the sandbox user you’re currently signed in with in the Settings of your device by selecting iTunes & App Stores. There you’ll see your real account at the top and the current sandbox account at the bottom.

In addition, you should test for different scenarios. Consider a user who:

  • Attempts to buys a subscription in a country for which you don’t offer Introductory Pricing.
  • Has already used the introductory price and attempts to purchase the same product again.
  • Hasn’t used the introductory price for the specific product you’re testing but has used it for another product that belongs to the same subscription group.
  • Has used the introductory price for a product in a different subscription group and is still eligible for the introductory price on the subscription under test.