Blog

How to set up Unity IAP for Samsung IAP
Blog Oct 12, 2016
229

Introduction

This guide describes the process of establishing the digital records and relationships necessary for a Unity app to interact with Samsung In-App Purchase. The Unity IAP purchasing API is targeted. Therefore it is highly recommended that you use Unity Editor and Unity IAP before you read the guide.

In-app purchasing (IAP) is the process of transacting money for digital goods. A platform’s store allows the purchase of products, representing digital goods. These products have an identifier, typically of string datatype. Products have types to represent their durability: the most common are subscription (capable of being subscribed to), consumable (capable of being rebought), and non-consumable (capable of being bought once).

To see more details, click the link below.

Cross-store implementation of in-app purchases

Note that there are cross-store installation issues when using shared Android bundle identifiers to publish to multiple Android in-app purchase stores (such as Samsung and Google) simultaneously. See documentation on Cross-store installation issues with Android in-app purchasing for more information.
 

Getting started

  1. 1. Write an app implementing Unity IAP. See Unity IAP initialization and Integrating Unity IAP with your app.

  2. 2. Keep the app’s product identifiers on-hand for use with the Samsung Galaxy Apps Seller Office later.

  3. 3. To set the IAP target store in the Unity Editor, go to Window > Unity IAP > Android > Target Samsung Galaxy Apps.

  4. 4. Build a signed non-Development Build Android APK from your app. See documentation on Getting started with Android development to learn more.

    Tip

    Take special precautions to safely store your keystore file. The original keystore is always required to update a published application.




Register the application

Register the Android application with Samsung Galaxy Apps Seller Office.

  1. 1. Choose “Add New Application.

  2. 2. Choose the Android option and select a Default Language.

  3. 3. To enable In-App Purchase, first register a binary APK. Go to In App Purchase and click GO.

    Then, go to Binary and select Add binary.

    Populate the device characteristics in Resolution(s) and Google Mobile Service, upload your APK (the one you created above in the “Getting Started” section) in Binary upload, then click Save.

    Wait for the APK upload to complete, then click Save.




Add in-app items

In the Seller Office, add one or more items for the app.

  1. 1. Go to “In App Purchase” and choose “Add Item.”

  2. 2. Define the Item ID. The Item ID here is the same identifier used in the app source code, added to the Unity IAP ConfigurationBuilder instance via AddProduct() or AddProducts(). For debugging purposes, it’s best practice to use reverse-DNS for your Item ID. Click Check to ensure the Item ID is valid and unique, then populate Item Type and all other elements and click Save.

  3. 3. View the result in In App Purchase.




Testing an IAP implementation

Samsung Galaxy Apps supports testing via the Developer mode value in the app before making purchases. This special build of the app connects with Samsung’s billing servers and performs fake purchases. This does not incur real-world monetary costs related to the product, and allows you to test the app’s purchasing logic.

  1. 1. Modify the app’s Unity IAP integration, adding the following line after creating the ConfigurationBuilder instance:

    builder.Configure<ISamsungAppsConfiguration>().SetMode(SamsungAppsMode.AlwaysSucceed); // TESTING: auto-approves all transactions by Samsung

    You can also configure this to fail all transactions via the SamsungAppsMode.AlwaysFail enumeration, enabling you to test all your error code.

  2. 2. Build and run the app, testing its in-app purchasing logic. As long as developer mode is implemented, this does not incur real-world monetary costs.

  3. 3.

    Important

    When testing is complete, make sure you remove the SetMode line. This ensures users pay real-world money when the app is in use.


Revision history
REVISION HISTORY DATE
First update Oct 12, 2016