Example Project
An example project named InAppPurchases.mtd is located in your (My) Documents folder Altova\MobileTogetherDesigner9\MobileTogetherDesignerExamples\Tutorials\InAppPurchases. The project implements a simple in-app purchase workflow to demonstrate the MobileTogether mechanism for in-app purchases. For you to get a broad understanding of how to set up in-app purchases from your project, we recommend that you run a simulation of the project in MobileTogether Designer and then inspect the settings of various project components. The topics of this section describe the key components of the example project.
Since the simulation in MobileTogether Designer does not use a real account or connect to an app store, it uses data in the file InAppPurchase Samples.xml to simulate products and purchases. This data file is located in your Program Files folder Altova\MobileTogetherDesigner9.0\InAppPurchase. It has already been set as the default file to use for the simulation of in-app purchases, in the Simulation 2 tab of the Options dialog (Tools | Options).
Note: | Since the simulator uses the device selected in the Preview Device combo box, it will simulate purchases at the corresponding app store. To simulate purchases at a different app store, change the preview device suitably. |
The data in the file "InAppPurchases Samples.xml"
The broad structure of the data file is as follows:
Root
|---Android
| |---Products
| | |---Product
| | | |---Subscription
| |---Purchases
| | |---Purchase
|---iOS
| |---Products
| | |---Product
| |---Purchases
| | |---Purchase
|---Windows
| |---Products
| | |---Product
| |---Purchases
| | |---Purchase
Note one major difference between the data structure for Android devices on the one hand and those of iOS and Windows devices on the other. On Android, each subscription plan is considered to be a variant of a product and is identified by data in a corresponding Subscription element of the product. On iOS and Windows devices, however, each subscription plan is considered to be a separate product. The data structure on these latter devices therefore do not contain the Subscription element.
The data file contains four products and four purchases for each platform/store. Note that the data in the example file will be selected according to which device is selected for the simulation in the Preview Device combo box. For example, if an Android device has been selected as the Preview Device, then data inside the Android element will be used for the simulation.