In App Purchase (iOS)

In App Purchase - iOS Setup

An in-app purchase (or IAP) allows developers to charge users for specific functionality or content while using an app. Implementing IAPs is particularly compelling for several reasons:

  • It’s an extra way to earn money, in addition to simply selling the app for a fee upfront. Some users are willing to spend a lot more on extra content or features.

  • An app can be offered for free, which makes it a no-brainer download for most people. Free apps will typically get many more downloads than paid apps. If users enjoy the app, then they can purchase more content or functionality later.

  • You can display advertisements to the user in a free app with an option to remove them by purchasing an IAP.

  • Following the initial release of an app, new paid content can be added to the same app instead of having to develop a brand new app to earn more money.

Checking Your Agreements

Before you can add IAPs to an app in iTunes Connect, you must do two things:

  • Make sure you have accepted the latest Apple Development Program License Agreement on developer.apple.com.

  • Make sure you have accepted the latest Paid Applications agreement in the Agreements, Tax, and Billing section in App Store Connect.

If you have not done this, usually iTunes Connect will give you a warning like the following:

If you see something like the above, follow the steps to accept the appropriate agreements.

It’s also good to double check the Agreements, Tax, and Banking section in iTunes Connect:

If you see a section entitled Request Contracts containing a row for Paid Applications, then click the Request button. Fill out all the necessary information and submit it. It may take some time for your request to be approved. Sit tight!

Otherwise, if you see Paid Applications listed under Contracts In Effect, then it looks like you’ve already done this step! Nice job!

Note: Apple can take days to approve these IAP-related agreements after you submit them. During this time, you won’t be able to display IAP products in your apps even if you implement everything correctly in code. This is a common source of frustration for folks implementing In-App Purchases for the first time. Hang in there!

Creating In-App Purchase Products

When offering IAPs you must first add an entry for each individual purchase within App Store Connect. If you’ve ever listed an app for sale in the store, it’s a similar process and includes things like choosing a pricing tier for the purchase. When the user makes a purchase, the App Store handles the complex process of charging the user and replies with data about such operations.

There are a whole bunch of different types of IAP you can add:

Consumable: These can be bought more than once and can be used up. These are a good fit for extra lives, in-game currency, temporary power-ups, and the like.

Non-Consumable: Something that you buy once, and expect to have permanently such as extra levels and unlockable content.

You can only offer In-App Purchases for digital items, and not for physical goods or services. For more information about all of this, check out Apple’s full documentation on Creating In-App Purchase Products.

Now, while viewing your app’s entry in App Store Connect, click on the In-App Purchases. To add a new IAP product, click the + to the right of In-App Purchases.

Select Consumable or non-consumable IAP depending on your requirement. Next, fill out the details for the IAP as follows:

Reference Name: A nickname identifying the IAP within iTunes Connect. This name does not appear anywhere in the app.

Product ID: This is a unique string identifying the IAP. Usually it’s best to start with the Bundle ID and then append a unique name specific to this purchasable item. E.g. for our bundle com.w2niapdemo.com we can create product as com.w2niapdemo.com.iapdemoproduct

In next screen scroll to price schedule section and select appropriate tier

Now scroll down to the Localizations section and note that there is a default entry for English (U.S.). Click Save.

Click on Save on top of screen. Great! You’ve created your first IAP product.

Note: App Store Connect may complain that you’re missing metadata for your IAP. Before you submit your app for review, you’re required to add a screenshot of the IAP at the bottom of this page. The screenshot is used only for Apple’s review and does not appear in your App Store listing.

Certainly! Here's a user guide for setting up and implementing in-app purchases (IAP) in an iOS app using JavaScript:

User Guide: Implementing In-App Purchases in Your iOS App

Introduction

In-app purchases (IAP) allow users to buy digital content or features within your iOS application. Whether it's unlocking premium features, purchasing virtual goods, or subscribing to content, implementing in-app purchases can enhance the monetization and user experience of your app.

This guide will walk you through the steps to set up in-app purchases in your iOS app and explain how to initiate purchases and verify transactions using JavaScript.

Setting Up In-App Purchases

  1. Apple Developer Account Setup:
    • If you haven't already, set up in-app purchases in your Apple Developer account. Follow the guidelines provided by Apple to configure your app's in-app purchase capabilities.

Initiating In-App Purchases

Plain JS Method

window.WTN.inAppPurchase({ 
    productId: 'Product Id of IAP', 
    callback: function(data) { 
        var receiptData = data.receiptData;
        if (data.isSuccess) {
            // Use this receipt data to verify the transaction from the App Store
            // Refer to: https://developer.apple.com/documentation/appstorereceipts/verifyreceipt
        }
    } 
});

ES6+ Method

import { inAppPurchase } from "webtonative/InAppPurchase"
 
inAppPurchase({ 
    productId: 'Product Id of IAP', 
    callback: function(data) { 
        var receiptData = data.receiptData;
        if (data.isSuccess) {
            // Use this receipt data to verify the transaction from the App Store
            // Refer to: https://developer.apple.com/documentation/appstorereceipts/verifyreceipt
        }
    } 
});

media-icon
media-icon
media-icon
media-icon

2024 Orufy Technologies All Rights Reserved.