# 17.3 Code Setup for Subscriptions

{% hint style="info" %}
Make sure that you have completed all of the previous steps of 17, 17.1 & 17.2.
{% endhint %}

### 17.3.1 Get IAP Files

You will get an **iAP.zip** file from us in your email after contacting us with your purchase code. Unzip it and you will get a folder named **iAP**. Paste this folder into the **news\_app/lib** folder.

### 17.3.2 Configure Subscription IDs

Go to the **lib/iAP/iap\_config.dart** file and add your **Product IDs** here separated with commas as shown in the picture below.

<figure><img src="https://content.gitbook.com/content/LNfw7ZA0Eb8JL71w4H2T/blobs/RJdFOHxkt1a4hRFyhKS2/iap_configs.png" alt=""><figcaption></figcaption></figure>

### 17.3.3 Enable Subscriptions

After that set the iAPEnaled value to **true**.

<figure><img src="https://content.gitbook.com/content/LNfw7ZA0Eb8JL71w4H2T/blobs/g7OoCOxrpGrosWmz6zyJ/iap_config.png" alt=""><figcaption></figcaption></figure>

### 17.3.4 Enable the Disabled Code

1. Go to the **lib/screens/tabs/profile\_tab/subscription\_tile.dart** file and enable all the codes that were disabled.

{% hint style="info" %}
To enable all the code from a single file, Press **CMD + A** to select all the text, and then press **CMD + /**\
\
\&#xNAN;*Note: CMD is for Mac. For Windows Press CTLR. (CTLR + A and then CTLR + /)*
{% endhint %}

2. Go to the **lib/utils/next\_screen.dart** file and enabled the selected line shown in the picture below. Also, enable the package line at the top of this file in the same way.

{% hint style="info" %}
Remove the double slash (**//**) to enable a single line.
{% endhint %}

<figure><img src="https://503170080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLNfw7ZA0Eb8JL71w4H2T%2Fuploads%2F7PAN0f4B1YiRfrL9luof%2Fnext_screen_pic.png?alt=media&#x26;token=b6778ce4-b70f-4148-a3cc-e389aadcc86e" alt=""><figcaption></figcaption></figure>

3. Go to the **lib/screens/tabs/profile\_tab/profile\_tab.dart** file and enable the selected lines shown in the picture below.

<figure><img src="https://503170080-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLNfw7ZA0Eb8JL71w4H2T%2Fuploads%2FeiSUlR32ejq4IOZ31V55%2Fprofile_tab.png?alt=media&#x26;token=b43daae3-cb3a-4859-86a0-3b88e89b8245" alt=""><figcaption></figcaption></figure>

That's it. Your subscription setup is completed. Now, you can test the app and the products and publish your app in production by uploading a new version.

{% hint style="info" %}
To test the In-App Purchases feature, use a real Android or iOS phone. Emulators/Simulators won't support this.
{% endhint %}
