In-App Purchasing in Xamarin.iOS
iOS applications can sell digital products or services using StoreKit – a set of APIs provided by iOS that communicate with Apple’s servers to conduct financial transactions with the user via their Apple ID. The StoreKit APIs are primarily concerned with retrieving product information and conducting transactions – there is no user-interface component. Applications that implement in-app purchasing must build their own user interface and track purchased items with custom code to provide the required products or services to the user.
Providing in-app purchase functionality requires a number of steps:
- Configuring your app –The application’s provisioning profile must be setup correctly.
- Creating products – Product descriptions and prices must be created in the iTunes Connect portal.
- Implementing StoreKit – The StoreKit API must be implemented according to the types of products being sold.
- Building the user interface and the products themselves – The products must be implemented, including mechanisms to track each purchase and backup/restore them if appropriate.
- Monitoring sales and receiving funds – Use information provided by iTunes Connect to monitor sales trends and track your income.
This document explains how to complete all these steps to provide in-app purchases using Xamarin.iOS.
To support In-App Purchasing you must use Xamarin.iOS 5.0 or newer with Xcode 7 and above.
This article has introduced the concept of in-app purchasing, outlined how to configure your application to take advantage of it and presented examples using Xamarin.iOS. It has covered:
- iOS Provisioning Portal – Guidelines for enabling in-app purchase functionality.
- iTunes Connect – Configuring products to sell in your app.
- Store Kit – Explanation of the classes used to build in-app purchase features.
- Coding your app for purchasing – Examples of how to build in-app purchase into a Xamarin.iOS app.
- Reporting – Overview of the statistics available via iTunes Connect.