About a year ago I wanted to learn how to use Apple’s In App Purchase. So I decided to make up an app where I could try it out. I started reading about what I needed to do and I quickly had to take a step back, because there are a whole bunch of administrative and configuration tasks one must setup first, in order to use In App Purchase.
These are the non-coding things I had to go through just to prepare to use In App Purchase.
1. Create your demo app. I called mine Tanuki. Set the Bundle Identifier to something unique (following the reverse FQDN format Apple recommends) and keep note of it. Also choose the appropriate Team.
2. XCode registers your App ID in the iOS provisioning portal. You can verify it by viewing your Xcode Preferences and looking at your account.
3. Select your Team that you will have previously set up in iTunes Connect and click View Details.
4. In the bottom pane, Provisioning Profiles, you can see your app’s provisioning profiles. If you don’t see them you can click Download All.
5. In your app’s Capabilities menu, enable the In App Purchase option.
6. That’s all you need to do in XCode. For the rest of the setup, you need to head over to iTunes Connect.
7. Select Agreements, Tax, and Banking.
8. You need to agree to some tax arrangements (different depending on your country, Australia, Canada & Japan have specific extra agreements). You also need to add your bank details and contact info. This stuff is rather dry but important.
9. Select Users and Roles.
10. In here is where you defined your Team for your App. If you click the Sandbox Testers subheading you can also add test users which is an important step. You need these test users for two reasons. Reason 1 is so that you aren’t speding real money from your real iTunes account. Reason 2 is because you can only test In App Purchase from you iOS device. Testing doesn’t work from the XCode simulator. So you need to install the app on your device, log out of your real iTunes account on your device, make a purchase and then use your test user credentials when the app prompts you to authenticate.
11. Select My Apps.
12. Create your App in XCode by clicking the plus and selecting New App.
13. Enter the App info but make sure the Bundle ID and the SKU match exactly what you entered in XCode.
14. Click on your App after it is added in iTunes Connect.
15. Select the Features subheading and there will be an option to enable In-App Purchase. You will only be able to do this when you bank details and tax agreements have been confirmed. Once it is, you can add some In-App Purchase products for your app by clicking the plus symbol.
16. Here you define your product and give it an identifier, which must be unique, similar the the Bundle ID of your app. This Product ID is important because it is the thing you will look for later in your code to make purchases and unlock neat things in your app.
17. Once you have created a Product (or 3 in my case), you can see them on the Features subheading of your app’s menu in iTunes Connect.
You will also be able to start coding! :)