Introduction :- In Apple development In-app purchase is a great way to earn money from your iPhone, iPad, iPod touch or Mac app. We can detect if some app offers In-app purchase by going to the app page, and see if it has “Offers IAP” or “IAP” near the Price, Buy, or Get button. In-app purchases mostly used to unlock some extra content in our app that we want to monetize from. Like it or not, Apple charges 30% of each successful transaction that your app will make payment.
Motivation:- A normal version of our app with additional paid and premium features.
A game that offers new environments (levels) to explore.
An online game allows players to purchase virtual property (money).
But there are some more reasons for developers with implement IAP:-
Money :- We can earn more money than just one time the price of our app! Some users are willing to spend a lot of extra content (freemium strategy).
Market Share / New Business Models: We can release our app for free, which is a no-brainer download for most people → more downloads / users reached. If users enjoy our app, they can purchase more in-app functionality.
Easy Maintenance: We can keep adding additional content in future for the same app, rather than having to make a new app to earn money with IAP.
Types of In-App Purchase
1 – Consumable :- The user needs to buy any items every time he wants them. Examples of consumable purchases are buying game coins etc.
2 – Non-Consumable :- If user buy any item, he will have it forever. This is a one time purchase, and user can also transfer it between devices connected with the same Apple ID. For Examples: upgrading an app with latest version.
3 – Non-renewing subscriptions :- Using the app content for a fixed period of time, and user can buy it again. For example, a education season.
4 – Auto-renewing subscriptions :- We can subscribe to the content or the services that the app is offering for a specific period time. It will automatically renew when the period has passed away. For Examples, player subscriptions, Netflix, games, etc.
Connection Project and App Store :-
Product Configuration On iTunes :-
On the next screen, you can set up all the info about your product on iTunes:
Reference Name: This name will be used on iTunes and in Sales and Trends reports. It won’t be displayed on the App Store and you can type any name that you want, but it can’t be longer than 64 characters.
Product ID: A unique identifier that will be get by the app in order to recognize our product. Usually developers use a web-reverse syntax for productID. In this example we chose com.Demo.coins. After on we’ll paste this id as a string into our code to get product info.
Price: Choose a price from the dropdown menu on product info page. Remember that in order to sell our in-app purchase product on the App Store, you must have applied for a Paid application agreement in the greements, Tax & Banking section.
Localizations: We’ve chosen only English, but you can add more languages by clicking on the plus button on product info page. Then type a display name of a product and a description. Both of them will be visible on the App Store.
Screenshot: Upload a screenshot for review by apple. It will not be displayed in the App Store and it must have a valid size given for your app platform, if your app is Universal, you may upload an iPad screenshot.
Review Notes: Any additional information about your IAP which may be helpful for the reviewer.
Product Configuration Price & Duration :-
Store Kit Configuration
- Enable In-App Purchase in our project from capabilities section.
- Add Store kit framework in our project.
About Store Kit :-
We will handle how to get product information into our app with product id.
– Process of purchasing with store kit
– We‘re gonna a short look into restoring completed transactions and heading
– Very short: How to get receipts.
Flow Chart Payment Process :-
Store Kit Classes:-
Implementing IAP we requires the following classes of StoreKit framework:-
SKProductsRequest – A request to StoreKit for approved products to sell (App Store). Can be configured with a number of product with array.
SKProductsRequestDelegate – Declares delegate methods to handle product requests and responses with product info.
SKProductsResponse – Sent back to the delegate from StoreKit (App Store). Contains the SKProducts object with containing all the product info, that match the product Ids sent with the request.
SKProduct – A product retrieved from StoreKit with delegate method (that you are configured in iTunes Connect). Its Contains all information about the product, such as Product ID, Title, Description, name and Price.
SKPayment – Created with a Product ID and added to the payment queue to perform a purchase and handling transection.
SKPaymentQueue – A queued payment requests to be sent to Apple. Notifications are triggered as a result of each payment being processed.
SKPaymentTransaction – Represents a completed transaction (a purchase request that has been processed by the App Store and sent back to your application via StoreKit) delegate. The transaction could be Purchased or Restored.
SKPaymentTransactionObserver – Custom subclass that responds to events generated by the StoreKit payment queue and mange payment queue.
StoreKit operations – After a SKProductRequest is started or a SKPayment is added to the queue, the our SKProductsRequestDelegate or SKPaymentTransactionObserver subclass when it receives receipt from Apple’s servers.
By – Pradeep Singh