In App Purchase Implementation in Native iOS

Posted By : Ashish Tyagi | 23-Jul-2014

In App purchase is one of good feature of Apple and widely used to earn some extra money by selling a feature inside our applications. You can use in-app purchase for free app also by using StoreKit Framework.

 

There are four type of in-App purchase :

1. Consumable (user can buy more than once a feature)

2. Non-Consumable(user buy once a feature)

3. Auto-Renewable Subscriptions (Allow users to purchase dynamic content(like Magazine,NewsPaper etc) for limited time duration and auto-renewal subscription)

4. Free Subscriptions,Non-Renewing Subscriptions(This feature is same as auto-renewal but In That case developers have to managed Subscriptions time duration).

 

Important point :

In-App Purchase feature is used to sell content, app functionality, services and not used for Real-world goods and services and Unsuitable content ( like pornography ,hate speech, or defamation) according to apple guideline

 

Configuration on iTunes for in-App purchase Feature :

Step1.) Firstly login with your apple account on ITunes Connect and create a New App using “Add New App” button in Manage Your Apps section as shown in screenshot. Here you have to fill up some detail about your app, This configuration is required because without filling these detail you are unable to see “Manage in-App purchase” Button on iTunes.

 

Step 2.) If all you fill up all detail about your app then again go in “Manage Your Apps” and click on your App icon then App summary page is open. On that page you will find a “Manage in-App Purchase” button in right top corner of page.

 

Step 3.) When you click on “Manage in-App Purchase” button then a window is open ,where you can choose your Product type (in-App purchase type) as shown in screenshot.

 

Step 4.) You have fill up some detail about in-app purchase feature.

a.) Reference Name is used only on developer end and there name should be meaningful which is used you retrieve product detail from iTunes.

b.) Product ID should be unique (may be used Bundle ID like com.yourAppName.InAppPurchaseFeatureName)

c.) Check “Clear for Sale” Otherwise you unable to test in-app purchase feature.

d.) Select a Price Tier for your in-App purchase feature. You can also select free as a Tier.

Step 5.) Now, You have to add an language and upload a screenshot

a.) Display Name (This name will be shown in App Store and in-app purchase alert box.

b.) Screenshot for Review Take a screenshot of that screen where in-app purchase is shown

Step 6.) If you filled up all information about in-app purchase feature then Status will be showing “Ready to Submit”

 

 

Retrieving Product list from iTunes :

Step 1.) Expand “Link Binaries with Libraries”. Select the “+” button, and add StoreKit framework.

Step 2.) Just Import #import <storekit storekit.h> in your class where you want to implement in-app purchase and set <skproductsrequestdelegate, skpaymenttransactionobserver> delegate in .h file.

Step 3.) Add the following code in .m class as given bellow for fetching all product detail from iTunes and call it in viewDidLoad Method.

Step 4.) Then StoreKit delegate method called ,which gives the detail about transaction process as given bellow :

When you got “in-App purchase product is purchased successfully” message then you can remove restriction from the feature for that you have Implement in-app purchase.

 

Hope it is useful for you:)

Aashish Tyagi

[email protected]

 

 

About Author

Author Image
Ashish Tyagi

Ashish is a iPhone application developer with experience in Objective-C , Titanium and Phonegap frameworks. Ashish loves watching movies in his free time.

Request for Proposal

Name is required

Comment is required

Sending message..