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; for example, current price, 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 might be more appropriate for your release of service app code.
|Example Code||Other Options|
|Offered Items List retrieval is initiated through a UI button.||
Initiate list retrieval:
|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.||
|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.