Version: 5.6
Configuring for Tizen Store
Codeless IAP

Configuring for CloudMoolah MOO Store

Introduction

This guide describes the process of establishing the digital records and relationships necessary for a Unity game to interact with an in-app purchase store.

In-app purchase (IAP) is the process of transacting money for digital goods inside an application. A platform’s store allows users to purchase products, which are digital goods. These products have an identifier, which is typically a string data type.

Products have types to represent their durability:

  • Subscription: The player can buy the product again after the subscription term expires.
  • Consumable: The player can buy the same product multiple times.
  • Non-consumable: The player can only buy the product once.

CloudMoolah MOO Store

Like the Apple App Store and the Google Play Store, the CloudMoolah MOO Store is a commercial online service that enables people to buy and sell mobile apps, and buy items in the application.

The MOO Store serves Asian markets. Users maintain a digital wallet, which they can top up using a variety of payment providers, such as banks and convenience store pre-paid cards.

The CloudMoolah Developer Portal website is at dev.cloudmoolah.com.

Getting started

  1. Make a game that implements Unity In-App Purchasing (see Unity In-App Purchasing Initialization and Integrating Unity In-App Purchasing with your game for more information).

  2. Keep the game’s product identifiers on hand for use in the MOO Store later (this document discusses appKey and hashKey later).

    This example configures and starts initialization of Unity In-App Purchasing:

    using UnityEngine.Purchasing;
    public class MyStore : IStoreListener {
 
        public void InitializeStore() {
            var module = StandardPurchasingModule.Instance();
            var builder = ConfigurationBuilder.Instance(module);
 
            builder.Configure<IMoolahConfiguration>().appKey = "d93f4564c41d463ed3d3cd207594ee1b";
            builder.Configure<IMoolahConfiguration>().hashKey = "cc";
            builder.Configure<IMoolahConfiguration>().SetMode(CloudMoolahMode.Production);
            builder.AddProduct("100.gold.coins", ProductType.Consumable);
 
            UnityPurchasing.Initialize(this, builder);
        }
    }
  1. In the Unity Editor, configure the Android target to CloudMoolah to ensure that store is accessed when a purchase is attempted:
    Install the Unity In-App Purchasing package, then find the Unity In-App Purchasing menu in Unity’s Window menu: Window > Unity IAP > Android > Target CloudMoolah. This ensures that, when the app is run on the Android operating system, it uses the CloudMoolah API to fulfill in-app purchase requests.

    Alternatively, call the Unity Editor API: UnityPurchasingEditor.TargetAndroidStore(AndroidStore.CloudMoolah);

  2. When the game successfully completes initialization of Unity In-App Purchasing, bind to the user’s Cloud Moolah digital wallet with the IMoolahExtension.FastRegister and IMoolahExtension.Login API. In the game’s implementation of IStoreListener.OnInitialized, use the IMoolahExtension.FastRegister API to register a new digital wallet for the user, and the IMoolahExtension.Login API to access a user’s existing wallet.

    IMoolahExtension.FastRegister requires a user identifying string cmPassword. This string is also required by the Login API to unlock that user’s digital wallet, and their collection of owned IAP products. Ensure the string identifies this user uniquely for your application. Collect FastRegister’s cmUserName result, and use that in subsequent calls to IMoolahExtension.Login. Save this cmUserName on your backend server, if available, or in PlayerPrefs.

    See the scripting documentation in the CloudMoolah Store for further discussion of registration and login.

  3. Build a signed non-Development Build Android APK from your game. See documentation on getting started with Android development to learn more about this.

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

Register the app

Register the app at the CloudMoolah Developer Portal website (dev.cloudmoolah.com).

  1. Choose Add New App.

  2. Input game server information if you are defining a game that is connected to the internet.

    Input server information
    Input server information
    Input server information as shown in the table below
    Input server information as shown in the table below
    Свойство: Функция:
    DataFeedURL_Stage URL for redemption - test environment.
    DataFeedURL_Prod URL for redemption - production environment.
    Testing Account Account name for test environment.
    Testing Password Password for test environment.
  3. Copy the appKey and hashKey into your app

    ![](../uploads/Main/Configuring%20for%20CloudMoolah%20Moo%20Store_image_5.png)
    

Add in-app purchases (IAP)

At the CloudMoolah Developer Portal (dev.cloudmoolah.com), select Add New Item to add in-app purchases for this app.

Test IAP

The CloudMoolah Game Store supports testing. Enable developer mode in the app before making purchases (do this via IMoolahConfiguration.SetMode API - see below). This special build of the game provides a fake offline store which performs 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.

To modify the game’s MOO Store test mode, create the ConfigurationBuilder instance and add the following line, then build and run the app to test its in-app purchasing logic:

builder.Configure<IMoolahConfiguration>().SetMode(CloudMoolahMode.AlwaysSucceed); // TESTING: auto-approves all transactions

To test error handling, configure this to fail all transactions. To do this, use tthe CloudMoolahMode.AlwaysFailed enumeration. For example:

builder.Configure<IMoolahConfiguration>().SetMode(CloudMoolahMode.AlwaysFailed); // TESTING: always fails all transactions

Note: When you have finished testing, make sure you remove the SetMode line that disables Developer mode, and use the CloudMoolahMode.Production enumeration. This ensures users pay real-world money when the app is in use.



Configuring for Tizen Store
Codeless IAP
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961