Altova MobileTogether Designer

In-App-Purchase Page Source

Home Prev Top Next

Data about your products that are available for in-app purchases are stored in the respective app stores. Data about purchases made by an end user are also stored in the respective app stores.

 

When this data is needed on the client device for an in-app purchase, it is requested by the client from the app store and downloaded to a special page source in your MT design: $MT_IN_APP_PURCHASE (see screenshot below). During the design phase, this page source is added automatically to the design the first time you add any of the In-App Purchase actions.

MTDInAPPgSrcOview

The Root element of the page source contains two elements:

 

Purchases contains data about individual purchases, each of which is stored in a child Purchase element (see tree in screenshot below). The attributes of the Purchase element correspond to the data points of a purchase at the app stores. While the actual data points are different (in number and name) from store to store, they are all mapped to the attributes of the Purchase element. This enables the design to reference a common set of abstract data points that can be used across all platforms. Here is an example of how the Purchase element is used: The Query Purchases action gets data about one or more purchases and places the data of each purchase in a separate Purchase element (see screenshot below left).

Products contains data about products that are available for in-app purchases. Data pertaining to each product is stored in a separate child Product element. Just as with purchases, while the actual data items relating to a product are different from store to store, this data is stored in a single set of attributes of the Product element. Here is an example of how the Product element is used: The Query Available Products action returns data about the queried product/s and places the data of each product in a separate Product element (see screenshot below right).

Click to expand/collapse     Click to expand/collapse

Note the following points:

 

The nodes of the tree constitute a superset that is a union of the data points used by the different app stores. Not all nodes will be used by a single app store. For example, the Subscription element is used only by the Google Play Store (Android devices).

While SKU_ID is an attribute of the Product element, it is a child element of the Purchase element.

Purchase data from an app store is typically sent as a JSON string. MobileTogether retrieves key data points from this purchase data and saves them, for each purchase, in the attributes of a Purchase element. On Android and Windows systems, the original JSON string containing the data is stored in an @OriginalJSON attribute of the Purchase element, whereas on iOS systems the original JSON string is stored as an attribute of the Purchases element. This is because the Apple Store, when queried for the purchase data of an end user, returns data of all purchases rather than the data of each purchase separately (see the description of the Restore Purchases action). For a description of how to query purchases from the Google and Windows app stores, see the topic Query Purchases.

 

© 2018-2024 Altova GmbH