Using the Samsung In-App Purchase SDK in your Unity Games
in this article, you will learn how to integrate the samsung in-app purchase (iap) sdk in your unity games. you can also follow along on youtube. unity plugin for samsung iap in order to use the samsung iap sdk in your unity game, follow these steps: download the unity plugin for samsung iap install the plugin. in unity, click assets -> import package -> custom package drag the script onto a game object. this can be any ui object, or as seen in the video, a character from your game. once you have included the script, review the documentation to see in detail how to call the sdk from your game code. here are the basics: operation mode in order for galaxy store to know if your game is in testing or production mode, you must use the setoperationmode method. samsungiap.instance.setoperationmode(operationmode.operation_mode_test); the possible values for the parameter are operationmode.operation_mode_test, operationmode.operation_mode_test_failure, and operationmode.operation_mode_production. request information about the items available for sale to find out what items can be offered from the game, you must invoke the getproductsdetails method. samsungiap.instance.getproductsdetails("com.mygame.product1, com.mygame.product2,com.mygame.product3", ongetproductsdetails); in this example, the information for products 1, 2, and 3 is being requested, since the identifiers of those products are being sent, separated by commas. samsungiap.instance.getproductsdetails("", ongetproductsdetails); in this example, the information of all available products is being requested, since no product identifier is being sent. start a payment in order to start the purchase of a product, the startpayment method must be invoked. samsungiap.instance.startpayment("com.mygame.product1", "pass_through_value", onpayment); this example is starting the transaction for "com.mygame.product1". you can specify the value of the second parameter and use it to verify the success of the purchase. and finally, the callback is specified, which is the method that will be invoked when the transaction is completed, regardless of whether it was successful or not. consumable items you can use the consumepurchaseditems method to replenish consumable products. for example,the player could buy energy in your game as many times as he wants. the first parameter is the identifier of the purchase of the item. samsungiap.instance.consumepurchaseditems(purchase_id, onconsume); and the second parameter is the onconsume method that fires when the process has finished, and this contains information about the consumed item and the processing of api calls. query previously purchased items to get the list of all the products that a player has bought, you can use the getownedlist method. samsungiap.instance.getownedlist(itemtype.all, ongetownedlist); the first parameter can be itemtype.all, itemtype.item, or itemtype.subscription. with itemtype.all the method returns all non-consumable items previously purchased, consumable items that have not been consumed, and subscription items with active subscriptions. with itemtype.item the method returns all non-consumable items purchased and consumable items that have not been consumed. and finally, with itemtype.subscription the method returns all subscription items purchased with active subscriptions. the second parameter is the method that will be triggered when the process has finished. list your app and items for sale in galaxy store the process for selling your game in galaxy store, when it includes payments and microtransactions through the samsung iap sdk, is as follows: 1. seller portal registration to create your account and publish in galaxy store, go to http://seller.samsungapps.com click on the top corner to create your account. if you already have a samsung account, sign in with it. 2. request commercial status once you have created your account on the seller portal, request commerical seller status by clicking the button indicated in the image. this is necessary to be able to sell different items from your application. 3. app registration to see all the details of how to register your application in the seller portal, watch this video. you will be prompted to enter your game information, such as the name, description, and promotional images. 4. register in-app items when your account has been approved as a commerical seller account, you will be able to access the “in-app purchase” section. here you can register the different items you are going to sell, such as unlimited lives, special powers, or customization options for the characters in your game. in the video, you can see a little more detail on how to register each of the items. learn more about creating games with samsung and reaching its global audience: https://developer.samsung.com/galaxy-games you can connect with diego, a sr. developer evangelist, on twitter. have questions? post them in our forums.