17.3 Code Setup for Subscriptions
Make sure that you have completed all of the previous steps of 17, 17.1 & 17.2.
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.
17.3.3 Enable Subscriptions
After that set the iAPEnaled value to true.
17.3.4 Enable the Disabled Code
Go to the lib/screens/tabs/profile_tab/subscription_tile.dart file and enable all the codes that were disabled.
To enable all the code from a single file, Press CMD + A to select all the text, and then press CMD + / Note: CMD is for Mac. For Windows Press CTLR. (CTLR + A and then CTLR + /)
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.
Remove the double slash (//) to enable a single line.
Go to the lib/screens/tabs/profile_tab/profile_tab.dart file and enable the selected lines shown in the picture below.
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.
To test the In-App Purchases feature, use a real Android or iOS phone. Emulators/Simulators won't support this.
Last updated