# Setting Up In-App Purchases

To offer items for in-app purchase (IAP) through ONE store, integrate your app with the ONE store IAP SDK and register each IAP item in the ONE store Developer Center. For more information, see [Registering IAP Items](#registering-iap-items).

Once integration and item registration are complete, perform test purchases of each IAP item prior to submitting your app for review. For more information, see [Testing IAP Items](#testing-iap-items).

{% hint style="warning" %}
Offering IAP items in the US region requires ONE store IAP SDK version 21.02.00 or later.\
For more information, see [Integrating the ONE store IAP SDK](https://docs.digitalturbine.com/one-store/integrating-one-store-sdks/integrating-the-one-store-iap-sdk).
{% endhint %}

## Registering IAP Items

You can register the following types of IAP items:

* **Managed Products**: One-time purchases that permanently unlock app features for the user. For more information, see [Registering Managed Products](#registering-managed-products).
* **Subscriptions**: Recurring purchases that grant access to features for a set billing period. Access is revoked if the user cancels or automatic billing fails. For more information, see [Registering Subscriptions](#registering-subscriptions).

### Registering Managed Products

Managed Products are premium features or content you want to offer to your users for purchase. Once purchased, these features are permanently unlocked for the user.

To register a Managed Product for IAP:

1. In the [ONE store Developer Center](https://dev.onestore.net/), go to **APPS→Applications**.
2. Select your app and go to **In‑App→Managed product**.\
   A listing of your registered IAP items appears.
3. Click **+ Register product**.\
   The **In‑App Product Information** page appears.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/a2c3WYe4i05fEEBXGWIj/20234962348828" alt=""></div>

4. For the **ID** section, enter a unique identifier for your IAP item and click **Check duplication** to verify that the ID you entered is unique.

{% hint style="warning" %}
Once you save this item, you cannot modify the ID for this IAP item or reuse the ID for another IAP item.
{% endhint %}

5. For the **Title** section, enter the name of your IAP item in the default language of your app. For the US region, providing titles in English and Spanish is recommended.
6. To add a title in an additional language, click **+ Add a language**, select the language you want to add, and enter the item title in the selected language.
7. For the **Basic Price** section, enter the price of the IAP item and click **Exchange rate update**.\
   Prices in the **Local prices** section are calculated based on the current exchange rate and displayed. For more information, see the ONE store FAQ about [local pricing](https://onestore-dev.gitbook.io/dev/chi/help/faq/global#how-is-the-local-price-for-each-countries-regions-set-for-global-release).

{% hint style="warning" %}
To specify a different base currency, go to **Apps→Settings→Default Price Currency Settings**, select the desired base currency, and click **Save**.
{% endhint %}

8. Modify the calculated local prices as needed.
9. Click **Save**.\
   The item you entered now appears in **Draft** status in the list of registered IAP-managed products for your app.

### Registering Subscriptions

Subscriptions enable you to charge users for the app or service for a defined period, with payments automatically billed at a set frequency. Register each subscription option as an individual IAP item. For more information about each subscription setting, see [Registering Subscription Products](https://onestore-dev.gitbook.io/dev/eng/docs/apps/common-info/inapp#registering-subscription-products) in the ONE store Developer Center documentation.

To register a subscription for IAP:

1. In the [ONE store Developer Center](https://dev.onestore.net/), go to **APPS→Applications**.
2. Select your app and go to **In‑App products→Subscription**.
3. Click **+ Register Product**.\
   The **In‑App Product Information** page appears.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/3wcNQjlx0X9rpBobAlnH/21339817694364" alt=""></div>

4. For the **ID** section, enter a unique identifier for your subscription item and click **Check duplication** to verify that the ID you entered is unique.

{% hint style="warning" %}
Once you save this item, you cannot modify the ID for this IAP item or reuse the ID for another IAP item.
{% endhint %}

5. For the **Title** section, enter the name of your subscription item.
6. For the **In-App Price information** section, enter the **Basic Price** in KRW.
7. For the **Billing Period** drop-down list, select a billing frequency.
8. If you want to allow users to try your app for free before billing them, select **On** in the **Free Trial** section and enter the number of **Days** you wish to offer the app for free.
9. If you want to offer a lower price for first-time subscribers, select **On** in the **Introductory period** section and enter the number of **Billing Period** days for the promotion duration.

{% hint style="warning" %}
If a Free Trial period is also set, the Introductory price is applied after the Free Trial period ends. After the Introductory price billing period ends, billing at the Basic Price begins.
{% endhint %}

10. If you want to allow users a grace period for failed payment, select the number of days in the **Grace period** section.
11. Click **Save**.

    The item you entered now appears as **Draft** status in the list of registered IAP subscriptions for your app.

### Managing Subscription Settings

**Subscription settings** allow you to define global options for all subscription types within your app. You can control whether users can pause their subscriptions and how free trials are granted. These settings apply to all subscription products for your app but do not affect individual pricing or trial durations, which you configure separately for each subscription.

To manage subscription settings:

1. In the [ONE store Developer Center](https://dev.onestore.net/), go to **APPS→Applications**.
2. Select your app and go to **In‑App products→Subscription**.\
   A list of your registered subscription items appears.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/3EeCyYA2H7qdg9j7PY3r/21633575354652" alt=""></div>

3. Click **Manage Subscription Settings**.\
   The **Manage Subscription Settings** window appears.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/WCntbkHxVzeJpomJ4prm/21633566470684" alt="" width="375"></div>

5. To allow users to pause a subscription, select **Pause**. Allowing subscription pauses offers an alternative to canceling, and users can resume the subscription at a later time.
6. To allow free trials for each subscription type, select **Allow Free trial by subscription**. Otherwise, to limit users to only one free trial across all subscription types for the app, uncheck **Allow Free trial by subscription**.
7. Click **Confirm**.\
   The updated global subscription settings appear in the **Subscription** page.

## Testing IAP Items

The ONE store app approval process requires that you perform a virtual purchase of each IAP item in the Sandbox environment. Before performing test purchases of IAP items, complete the following tasks:

* If you have not already done so, upload the binary file for your app integrated with the IAP SDK version 21. For more information, see [Uploading a Binary File](https://docs.digitalturbine.com/one-store/adding-app-details#uploading-a-binary-file).
* On an Android test device or emulator, install the following apps:
  * [ONE store version 4.0.0](https://onestore-dev.gitbook.io/dev/eng/policy/download) for the US region.
  * Your app that uses the same signing key as the registered binary file.

To test IAP items:

* [Step 1: Register a ONE store test account.](#step-1-register-a-one-store-test-account)
* [Step 2: Purchase IAP items in the Sandbox.](#step-2-purchase-iap-items-in-the-sandbox)
* [Step 3: Verify Sandbox purchases.](#step-3-verify-sandbox-purchases)

### Step 1: Register a ONE store Test Account

To perform test transactions, set up a ONE store account specifically for testing purposes.

To set up a test account:

1. On the test device or emulator, open **ONE store** and create a user account.
2. In the [ONE store Developer Center](https://dev.onestore.net/), go to **APPS→Applications**.
3. Select your app and go to **In‑App→Billing Test**.\
   The **Test ID mgmt.** tab appears.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/1KTah4X7311888ZSDGGD/20234962352412" alt=""></div>

4. In the **TEST ID Search** field, enter the user account and click **Search**.\
   The user account for testing appears in the **Results** section.

<div data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/zKTDO4thKJn0ZkyYoot7/20234962354076" alt=""></div>

5. For **Test environment**, select **Sandbox**.
6. Click **Register**.\
   The ONE store user account is now a registered test account for the Sandbox environment and appears in the list of Test IDs.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/9PqdTx2feSHlKVktZQIi/20234962355868" alt=""></div>

### Step 2: Purchase IAP Items in the Sandbox

Once you have set up a test account for the Sandbox environment, purchase each IAP item using the registered ONE store test account from [Step 1](#step-1-register-a-one-store-test-account).

To purchase an IAP item in the Sandbox:

1. On your test device or emulator, launch your app and navigate to the IAP item purchase page.
2. Tap to purchase the item.\
   The ONE store app opens to complete the purchase using the registered Sandbox testing account.
3. Run the transaction type you want to test. To simulate a successful payment, tap **Success**. To simulate a failed payment, tap **Fail**.\
   ONE store assigns each Sandbox purchase with a Purchase ID.
4. Track the Purchase IDs so that you can verify the purchase in the ONE store Developer Center.
5. Repeat Steps 1‑4 for each IAP item you want to test.

### Step 3: Verify Sandbox Purchases

Once you have completed the test purchases in the Sandbox, verify that the IAP items were successfully purchased and now show as tested items.

To verify Sandbox purchases:

1. In the [ONE store Developer Center](https://dev.onestore.net/), go to **APPS→Applications**.
2. Select your app, go to **In‑App→Billing Test**, and select the **Sandbox** tab.\
   The **Sandbox** tab appears with a list of completed test transactions.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/a4cUztoxo5fR0rAicX1C/20236164009628" alt=""></div>

3. Verify the test purchases using the Purchase ID.
4. Go to **In‑App→Managed product**.
5. Verify that the IAP items you tested are marked **Y** in the **Tested** column.

<div align="left" data-with-frame="true"><img src="https://content.gitbook.com/content/D7ibIVUuuFfWipMib7Bw/blobs/l37haSKSX4LIsjEVVW6G/20235011044252" alt=""></div>

{% hint style="warning" %}
Tested items remain in **Draft** status until your app passes the publication review process
{% endhint %}
