Registering Products in App Store
To take advantage of in-app purchasing functionality on iOS, register your application and all the available products in iTunes Connect. This guide provides a brief introduction on how to register an application and it's in-app products on App Store.
In-App purchasing can only be tested on the actual hardware for the iOS platform. For more information refer to the iOS documentation.
Register a Unique App ID
One of the requirements to support in-app purchases on iOS is to have a registered unique App ID. This means that it is not possible to use an App ID that contains a wildcard character. You can check the existing App IDs and create new ones from the Apple Developer Certificate, Identifiers, and Profiles manager.
In the App IDs tab of the Developer Certificate, Identifiers, and Profiles manager, click the + button to create a New App ID. This will open up the page to register a new iOS App ID.
Give your App a relevant ID description and prefix. Your App ID Suffix should be an Explicit App ID type. Enter a unique App ID in the Bundle ID field. It is recommended to use the com.mycompany.myappname convention for App ID. Where, the "com.mycompany" is the Internet domain name of the publisher.
In the App Services area make sure that the In-App Purchases is checked. Click continue your to complete the App ID registration.
Create a Provisioning Profile
To be able to use your new App ID, generate a new provision profile that includes the new ID to sign and run your app. Provisioning Profiles are also managed through the Apple Developer Certificate, Identifiers, and Profiles manager.
Navigate to the Provisioning Profiles tab of the manager and click the + button to create a new Provisioning Profile. Make sure that the iOS App Development is selected and click the Continue button.
You are now given an option to choose the App ID to use for this profile, which will be the unique App ID you created in the previous section. Once again make sure that the App ID does not contain any wildcard characters (“*”) as it is not be possible to use the In-App Purchasing service with such an App ID.
On the next page you will need to select the certificates that will be distributed with your Provisioning Profile. You would have needed to uploaded a certificate on your local development machine to the Apple Developer Certificate, Identifiers, and Profiles manger previously. Generally you will want to add any certificates of the members of your team who will need to build your App.
On the next page you will need to select the devices you will be developing and testing your app on. You must register your devices to the Apple Developer Certificate, Identifiers, and Profiles manger previously. The devices you select here are the only ones capable of running apps signed against this provisioning profile, so select all the devices you intend use during the development and testing phase.
Give your Provisioning Profile a descriptive display name, and click Generate to create the actual profile. When this process is completed you’ll be given a choice to download the Provisioning Profile.
Open the downloaded file in XCode to install. Now the next time you plug in one of the registered devices, your Provisioning Profile should be installed to it automatically.
Register Your Application
Before you can register new products available to the in-app purchasing service, you need to register your application in iTunes Connect. iTunes Connect is the place where you register an app when you want to submit it to the Apple iOS App Store.
Start by going to iTunes Connect and logging in. Once logged in open the Manage your Apps link. If you have already registered your app here, you can skip the registration step, otherwise click the Add New App button in the top left corner of the page.
Select iOS App and then proceed to fill out the required information on the next page. When you get to the Bundle ID section select the unique App ID we created in the previous steps.
It is likely at this point that you do not have all the necessary details to complete the information required to register your app. For now, just fill out the forms with stub data as everything except the SKU and Version fields are editable later.
Register the Products
Once your app is registered in iTunes Connect you will have additional options available to manage that App. In the Manage Your Apps page of iTunes Connect, click the icon representing your app to manage its details. Within this menu you can select the Manage In-App Purchases button on the right to register in-app products you wish to offer.
To register a new product, click the Create New button in the top left corner of the page. The first choice you will be given is the type of in-app purchase you would like to create. The Qt Purchasing API currently only supports Consumable and Non-Consumable types so limit your selection to these. See QInAppProduct for an explanation about the different product types.
On the next page, you must fill out the details about your product. The Reference Name field refers to how the product will be displayed in iTunes Connect and in sales reports, but not in the App Store itself. The Product ID field is very important as it is the unique ID that will be used to query for the product from your app itself. If possible make this the same ID as the corresponding products in the other platform’s stores, otherwise you will have to conditional logic in your app for each platform when specifying product identifiers.
Select the pricing and availability details for you product next. For the iOS App Store, pricing is set via a tier system. Each tier represents a price level in each iOS App Store region. Your end users will be given the actual price expected for a product in terms of what region their App Store is in.
In the next section In-App Purchase Details you specify the details for at least one language. When the app requests the product details like
description, they will be provided in the language of their locale if they are available. Create language details for the regions you expect to distribute app in.
Finally, you will need to attach a screenshot that will be used for review purposes. This again can be a stub for now, but your product will need to pass the review before it can go live to be sold in your published app. Click save to complete the product registration.
Create an iTunes Test User
Once your products are registered you will be able to purchase them from your app. When you are developing your app it is desirable to test buying your products without spending real currency. There are actually two separate stores that requests can be sent to when using the In-App Purchasing service on iOS. While your app is being developed, any iOS App Store requests will be sent to a sandbox store. This occurs when your app has been signed with a developer Provisioning Profile. The sandbox store will only accept requests from test users and will not charge for the purchases. However, when you submit your app to the iOS App Store and it is accepted, all in-app purchasing requests are sent to the production store, which requires real iTunes users accounts, and will charge for the purchases.
To create an iTunes test user, log into iTunes Connect.
Select the Manage Users link on the left and click the Test User button. Here you will see any existing iTunes test users associated with your account. To add a new iTunes test user, click the Add New User button on the top left corner of the page. Fill out the details to your preference, bearing in mind that the most important selection is the Select iTunes Store, which specifies the store region your users will be testing from.
Using the Sandbox App Store
Once you have created your iTunes test user, you will be able to log in to the sandbox app store when developing your app.
It is important that you first log out of the current iTunes user on your Apple device. To do this, open the Settings app from the homescreen and go to the iTunes & App Store entry. Click the first entry (which should be Apple ID) and select Sign Out.
Do not sign in with your iTunes test user from the Settings App as this connects to the production App Store and your purchase request will fail.
The first time your App makes a request to the sandbox App Store it will request that you login. This is where you should log in using your iTunes test user credentials.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.