Integrating IAP to support selling commercial product items from your service app involves properly invoking the following IAP functionality:
- Instantiating IAP Helper and setting the IAP operating mode.
- Getting the list of items and item data (such as the current price) that are currently offered for sale in the service app.
- Getting the list of items and item data that the current user has purchased.
- Initiating the purchase and payment processing of a specific item. Samsung Account, Samsung Billing, and Samsung Seller Office automatically support these functions.
Your service app must support these functions (for example, by directing the user to select an item for purchase).
NOTE: IAP Helper provides client-to-server purchase verification to reduce malicious purchases, which does not require integration into your service app.
For increased transaction safety, you can employ server-to-server verification, which does require service app client and service app server integration. For details, see IAP Server-to-Server API Reference.
NOTE: The procedures in this section include example logic and code, object names, and explanations that can be used to integrate IAP into your service app. However, you may choose to alter your service app logic and code.
In addition to illustrating how to integrate IAP functionality into your service app, the example code in this section is designed to facilitate development and testing of your IAP integration. However, other options may be or definitely are more appropriate to your release service app code.
|Example Code||Other Options|
|Offered Items List retrieval is initiated via a UI button.||Initiate list retrieval during service app initialization (after item updates in Samsung Seller Office, periodically, after every startup), or in response to a user action (such as selecting a purchase item screen).|
|After retrieval, the offer item list is displayed in an alert dialog box without user selection/initiation of IAP purchase and payment of a listed item.|| |
Display the offered items list in a purchase screen provided by your service app.
Enable user selection/initiation of IAP purchase and payment of listed items.
|Purchase item IDs are hard-coded.||Obtain item IDs and other item parameter settings from a retrieved offered items list.|
|IAP operating mode changes among commercial and developer test modes, to meet the requirements of development and testing.||IAP operating mode is the commercial mode.|
|Specifications are hard-coded for requested offered item lists.||Specifications may be hard-coded for requested offered items lists.|
For code details about options other than those presented in this section, see the sample service app code in the IAP SDK.