Get Started With Apple In-App Purchase Tutorial To Grow App Revenue

Get Started With Apple In-App Purchase Tutorial To Grow App Revenue
3.5 (70%) 2 votes


One of the great things about owning a mobile app is the variety of available methods to earn money from app, namely paid, free with ads, and in-app purchases. And Apple In-app purchase tutorial is our main focus today.
Nowadays, many mobile applications provide an option to get extra content by purchasing them through the app. For example, Mobile Game – Subway Surfers – provides gems from in-app purchases to get more lives. This Apple In-app purchase technique has become quite a fashion these days.

With that being said, it’s an undeniable fact that most of the developers’ revenue last longer in Apple in-app purchase than other options. And if you think about it, this is nice option for users as well. They can download your app for free and use it, and if they like it they will do the in-app purchases.

By knowing these, developers can attract more users for their app and as more users use their app, their app revenue ultimately grows. In this Apple in-app purchase tutorial, we’ve planned to demonstrate how to integrate Apple in-app purchase feature. And you’ll see that it’s not tough as it seems and this strategy can surely grow your income from your app.

Let’s Get Started

First we’ll create an App ID. This will link our app to Xcode, iTunes connect and in-app purchase product. (it should be Explicit App ID)

Now create certificate and provisioning profile to install app in your device for testing.

Once App ID created, then log into and create an app with same Explicit ID.

Now, go to Features -> In-App Purchases section


Click on ‘+’ button. this will open a popup where we can select type of in app purchase we have to integrate.


Once we select any one of them and click on “Create” it will open a page where we can add

  • Reference Name
  • Produce ID
  • Price
  • Localization (Display Name, Description)
  • Review Information (Screenshot, Review Notes)


Once all data filled up then click on “Save” button.

inapp6inapp7Now move to XCODE.

Create a new project under file menu and select ‘Single View Application’


In next tab, modify your app details and click on finish.


Set app’s bundle identifier same we have used for create app in iTunesconnect.


Import StoreKit for In-App-Purchase and set delegate of SKPayment.

class ViewController: UIViewController, SKProductsRequestDelegate, SKPaymentTransactionObserver

Now set outlet of UITableView and set Datasource and delegate and define variable.

@IBOutlet weak var tblInAppList: UITableView!

let arrInAppProduct = NSMutableArray()

let arrProductIDs = NSMutableArray()

Add product ID into your Array and get product info

override func viewDidLoad() {











func getProductInfo() {

if SKPaymentQueue.canMakePayments() {

let productIdentifiers = NSSet(array: arrProductIDs as [AnyObject])

let productRequest = SKProductsRequest(productIdentifiers: productIdentifiers as! Set<String>)


productRequest.delegate = self



else {

print("Cannot perform In App Purchases.")



Implement delegate method of SKPayment to get Product information.

// MARK: SKProductsRequestDelegate method implementation


func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) {

if response.products.count != 0 {

for product in response.products {

arrInAppProduct.addObject(product )




else {

print("There are no products.")



if response.invalidProductIdentifiers.count != 0 {




Once all information of Product ID received, then load it into UITableView.

//MARK: UITableViewDataSource


func numberOfSectionsInTableView(tableView: UITableView) -> Int {

return 1



func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

return arrInAppProduct.count



func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)

configureCell(cell, forRowAtIndexPath: indexPath)

return cell



func configureCell(cell: UITableViewCell, forRowAtIndexPath: NSIndexPath) {

let product = arrInAppProduct[forRowAtIndexPath.row]


let lblTitle = cell.contentView.viewWithTag(1) as! UILabel

lblTitle.text = product.localizedTitle


let lblSubTitle = cell.contentView.viewWithTag(2) as! UILabel

lblSubTitle.text = product.localizedDescription




Now you can see product in table.

When you click on product it will ask you for apple id and go for purchase.

//MARK: UITableViewDelegate


func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {


//Get SKProduce and add it for payment

let payment = SKPayment(product: self.arrInAppProduct[indexPath.row] as! SKProduct)




You will get completion of payment by SKPaymentTransactionObserver Method.

// MARK: SKPaymentTransactionObserver method implementation


func paymentQueue(queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {

for transaction in transactions {

switch transaction.transactionState {

case SKPaymentTransactionState.Purchased:

print("Transaction completed successfully.")



case SKPaymentTransactionState.Failed:

print("Transaction Failed");








And done!

With these, our one more iOS app tutorial comes to its end. Now always keep in mind that Apple in-app purchase consist of a great way to grow app income. You might have noticed as well that it’s not difficult to integrate it. Still, if you require help from a technical person, you can hire Swift developer from us. Because knowing these facts about Apple in-app purchase technique, you can boost your app sales to the maximum point and at the same time, you can keep your app users happy as well.

Grab a free copy of in-app purchase integration demo from Github.


Want to Develop Money Making App? Contact Us Now