# 3. Function Introduction

# 3.1 Platform Initialization

Initialization is required when you use any platform features.

Platform SDK Initialization

/// <summary>
        /// Initialized Platform SDK
        /// </summary>
        /// <param name="callback">Call Back</param>
        /// <param name="app_id">APPID</param>
        /// <param name="app_secret">App secret</param>
         public static void InitQiyuSDK(RequestCallback callback, string app_id, string app_secret)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

             QiyuXRPlatformPlugin.QVR_InitQiyuSDK(QiyuMessageManager.AddRequest(callback), app_id, app_secret);
        }

Parameter:

  • app_id, app_secret

    Please log in to the QIYU developer Platform (opens new window) and click "Manage - My Apps - New" to create your APP. The system will generate an unique app_id and app_secret for each application. Click「API」to view the APP information.

Fig3.1 Check APP ID and APP Secret
  • Return Code:

When the initialization finished, the SDK should be initial firstly to authenticate the valid developer, all the platform APIs can be called after the authentication successfully. the return codes of msg.code are shown below:

Return Code Reason
S0000 Success
S9000 System Error
S9001 The parameter is null
B3021 APP ID or APP Secret is wrong

Tips:

  1. InitQiyuSDK API must be called in the Start() function or later so that environment Initialization completed. Called in the Awake() may fail to initialize SDK or lead to crash or fail to initialze.

  2. After upgrading the SDK to v1.2.1 or above versions, the APP secret of initialization API need to be updated, which can be found at developer "Portal - manage - My APPs - API".

Demo:

//Initialize SDK Just Once
        QiyuXRPlatform.InitQiyuSDK(QiyuMessage.GetRequestResult<QiyuMessage.SDKInit>((msg) =>
       {
         if (msg.IsSuccess())
           {
                Debug.Log( $" InitQiyuSDK OK!");
            }
            else
            {
                Debug.Log( $" InitQiyuSDK Failed! code:{msg.code}");
            }
        }),
        "", //AppId can be gained on the QIYU Portal
        ""); //App secret key can be gained on the QIYU Portal

# 3.2 Account Linking

Get the account status and information of the QIYU user in the application.

  • Get the status of account login
public static bool IsQiyuAccountLogin()
        {
            if (!QiyuPlatform.IsAndroid)
                return false;

            return QiyuXRPlatformPlugin.QVR_IsAccountLogin() == 1;
        }
  • Get QIYU account information
 /// <summary>
        /// Get QIYU account information
        /// </summary>
        /// <param name="callback">Call back</param>
        public static void GetQiyuAccountInfo(RequestCallback callback)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            QiyuXRPlatformPlugin.QVR_GetQiyuAccountInfo(QiyuMessageManager.AddRequest(callback));
        }

Get QIYU account information Demo:

QiyuXRPlatform.GetQiyuAccountInfo(QiyuMessage.GetRequestResult<QiyuMessage.QiyuAccountInfo>((msg) =>
            {
                if (msg.IsSuccess())
                {
                    Debug.Log(string.Format( " GetQiyuAccountInfo uid is {0},name is {1}", msg.data.uid, msg.data.name));
                }
            }));

Note: The account information will only be obtained when logged in. So before accessing the QIYU account information, the developer should first check the login status.

The Demo of QIYU login page. (Using this demo when fail to get the account information if QIYU device does not login)

 public void GetQiyuAccountInfo()
    {
        if (QiyuXRPlatform.IsQiyuAccountLogin())
        {
            QiyuXRPlatform.GetQiyuAccountInfo(QiyuMessage.GetRequestResult<QiyuMessage.QiyuAccountInfo>((msg) =>
            {
                if (msg.IsSuccess())
                {
                    Debug.Log(string.Format(" GetQiyuAccountInfo uid is {0},name is {1}", msg.data.uid, msg.data.name));
                }
            }));
        }
        else
        {
            //Go to Home to login
            QiyuXRPlatform.LaunchHome("login", "");
        }
    }

QIYU Platform provides authentication APIs, please refer to 4.3 Server to Server Authentication (opens new window).

# 3.3 Deep Linking

When you have two separate applications, for example, a single-player game and a multi-player game. If these two APPs have deep linking, users can join the multiplayer APP from the single-player APP. Deep linking requires integration between the requesting application and the target application.The following sections describe the implementation required for both applications.

  • Open other application
/// <summary>
        /// Open other application
        /// </summary>
        /// <param name="app_id">app id</param>
        /// <param name="key">Deeplink Key (Note: The arguments of Key are small letters.)</param>
        /// <param name="value">Deeplink value</param>
        public static void LaunchOtherApp(string app_id, string key, string value)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            QiyuXRPlatformPlugin.QVR_LaunchOtherApp(app_id, key, value);
        }

Tips: After calling the API, if the target application is not purchased or installed, it will open the application page on QIYU store.

  • Get deep link info
/// <summary>
        /// Get deep link information
        /// </summary>
        /// <param name="callback">Call back</param>
        public static void GetDeepLink(RequestCallback callback)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            QiyuXRPlatformPlugin.QVR_GetDeepLink(QiyuMessageManager.AddRequest(callback));
        }

Demo:

  • Open B APP in A APP, call LaunchOtherApp with deep linking parameter.
QiyuXRPlatform.LaunchOtherApp("70519169", "show", "1"); 
  • After Initialization in B APP, call GetDeepLink to get deep linking parameter.
QiyuXRPlatform.GetDeepLink(QiyuMessage.GetRequestResult<QiyuMessage.DeepLinkParam>(msg =>
        {
            if (msg.IsSuccess() && msg.data != null)
            {
                Debug.Log(string.Format( " OnGetDeepLink key is {0},value is {1}", msg.data.key, msg.data.value));
            }
        }));
  • Launch to QIYU store information page (Check the introduction and updates of games)
QiyuXRPlatform.LaunchHome("store", app_id); 

# 3.4 Qiyu PlayerPrefs (A requirement to pass our QA Review)

If your APP has Playerprefs, please use QiyuPrefs. QiyuPrefs is a class that stores player preferences between game sessions - note that this is not related to Cloud Saving. QiyuPrefs also allows applications to retain existing Player preferences after version upgrades, uninstalls and reinstalls. Please remember to call the Save() function when exiting the game or when you need it.

  • Get Float Playerprefs
/// <param name="key">Key word</param>   
/// <param name="defValue">Default value</param>   
/// <returns>Return</returns>   
public static float GetFloat(string key, float defValue = 0)
    {
        if (QiyuPlatform.IsAndroid)
        {
            return QiyuXRPlatformPlugin.QVR_Prefs_GetFloat(key, defValue);
        }
        else
        {
            return PlayerPrefs.GetFloat(key, defValue);
        }
    }
  • Get Int Playerprefs
/// <param name="key">Key word</param>   
/// <param name="defValue">default value</param>   
/// <returns>Return</returns>     
public static int GetInt(string key, int defValue = 0)
    {
        if (QiyuPlatform.IsAndroid)
        {
            return QiyuXRPlatformPlugin.QVR_Prefs_GetInt(key, defValue);
        }
        else
        {
            return PlayerPrefs.GetInt(key, defValue);
        }
    }
  • Get String Playerprefs
/// <param name="key">Key word</param>   
/// <param name="defValue">default value</param>   
/// <returns>Return</returns>    
public static string GetString(string key, string defValue = "")
    {
        if (QiyuPlatform.IsAndroid)
        {
            return QiyuXRPlatformPlugin.QVR_Prefs_GetString(key, defValue);
        }
        else
        {
            return PlayerPrefs.GetString(key, defValue);
        }
    }
  • Set Float Playerprefs
/// <param name="key">Key word</param>   
/// <param name="defValue">default value</param>     
public static void SetFloat(string key, float value)   
{     
    if (QiyuPlatform.IsAndroid)     
    {       
        QiyuXRPlatformPlugin.QVR_Prefs_SetFloat(key, value);    
    }     
    else     
    {       
        PlayerPrefs.SetFloat(key, value);     
    }   
}
  • Set Int Playerprefs
/// <param name="key">Key word</param>   
/// <param name="defValue">default value</param>   
public static void SetInt(string key, int value)   
{     
    if (QiyuPlatform.IsAndroid)     
    {       
        QiyuXRPlatformPlugin.QVR_Prefs_SetInt(key, value);
    }     
    else     
    {       
        PlayerPrefs.SetInt(key, value);     
    }   
}
  • Set String Playerprefs
/// <param name="key">Key word</param>   
/// <param name="defValue">default value</param>    
public static void SetString(string key, string value)   
{     
    if (QiyuPlatform.IsAndroid)     
    {       
        QiyuXRPlatformPlugin.QVR_Prefs_SetString(key, value);     
    }     
    else     
    {       
        PlayerPrefs.SetString(key, value);     
    }   
}
  • Delete all Playerprefs
public static void DeleteAll()   
{     
    if (QiyuPlatform.IsAndroid)     
    {       
        QiyuXRPlatformPlugin.QVR_Prefs_DeleteAll();     
    }     
    else     
    {       
        PlayerPrefs.DeleteAll();     
    }   
} 
  • Delete the specified Playerpref
/// <param name="key">Key word</param>   
public static void DeleteKey(string key)   
{     
    if (QiyuPlatform.IsAndroid)     
    {       
        QiyuXRPlatformPlugin.QVR_Prefs_DeleteKey(key);     
    }     
    else     
    {       
        PlayerPrefs.DeleteKey(key);     
    }   
}  
  • Check the key Playerprefs whether exist
/// <param name="key">Key word</param>   
public static bool HasKey(string key)   
{     
    if (QiyuPlatform.IsAndroid)     
    {       
        return QiyuXRPlatformPlugin.QVR_Prefs_HasKey(key);     
    }     
    else     
    {       
        return PlayerPrefs.HasKey(key);     
    }   
}
  • Save the PlayerPrefs
public static void Save()   
{     
    if (QiyuPlatform.IsAndroid)     
    {       
        QiyuXRPlatformPlugin.QVR_Prefs_Save();     
    }     
    else     
    {       
        PlayerPrefs.Save();     
    }   
}

Note:

QIYU devices support multiple accounts, so when using the PlayerPrefs solution, the Prefs data should be linked with the Qiyu Account's UserID to achieve the right Prefs data for each user.

Multi account PlayerPrefs Demo:

QiyuXRPlatform.GetQiyuAccountInfo(QiyuMessage.GetRequestResult<QiyuMessage.QiyuAccountInfo>((msg) =>
           {
               if (msg.IsSuccess())
               {
                    //Record uid
                    string uid = msg.data.uid;
                   
    		   		//Using the uid prefix to name the QiyuPrefs 
               		string name = QiyuPrefs.GetString(uid + "name");
                    QiyuPrefs.SetString(uid + "name", name);
                  	int level = QiyuPrefs.GetInt(uid + "level");
                   	QiyuPrefs.SetInt(uid + "level", level);
                  	QiyuPrefs.Save();
                }
           }));

# 3.5 In-APP Purchase

IAP only support 'application' but not 'game'.

In-APP purchases (IAP) allow users to purchase content including visual products, game currency, additional levels, blood strip and so on. Developer can define the item for Purchase on QIYU platform, and then integrate into the game via SDK APIs. In-APP purchases (IAP) allow users to purchase content including visual products, currencies and so on. Developer can define the item for Purchase on QIYU platform, and then integrate into the application via SDK APIs.

QIYU purchase is using SMS link to finish the payment with Wechat pay or Ali-pay, the main flow chart is shown below, you can refer to QIYU SDK Demo to finish the IAP integration.

Fig3.5 QIYU items Payment Flow Chart

# 3.5.1 Define Items for Purchase

In QIYU Platform - Application - Add-on, you can create, view and operate the items.

Fig3.5.1.1 Add-on
# 1. Create New Add-on
  • Defining item on Dashboard

Click "Create Add-on" button and filling the following information:

Name: The short descriptive name that the user will see.

SKU: Stock-Keeping Unit (SKU) is a unique string that you use to reference the IAP item in your APP. It is not allow to use same SKU in different items. Numbers and letters are allowed.

Price: the unit is RMB (CNY)

Items Type: The types of items are divided by consumable and durable. Consumable items can be purchased in many time, as coin in the game. Durable items can only purchase once, like weapons.

  • Defining Items in Bulk

Click "Batch Upload" button and follow the Template format to upload your file.

The information should be enter: 1. Name, 2. SKU, 3. Price, 4. Item type

Fig3.5.1.2 Defining Items in Bulk
# 2. View Items

Click the Add-on at the operation of application on dashboard, you will see the items list and information as the following figure shows:

Fig3.5.1.3 Items List
# 3. Items Configuration
  • status and operation of IAP

Pending:In the pending mode, you can edit and release your items.

Release:After click Release button, the Item will be released.

Offline:After click offline button, the status will be changed to pending mode, and the Item can be edited and released again.

  • Instantly/Timing release or offline

In the release and offline windows, you can select immediate or scheduled. if you select active release or offline by time, the IAP will be updated on the time you set.

  • Edit

When an item has been created successfully, you can click the edit button to modify its price.

# 4. Notify URL

This URL is for the order notification. Click the notify URL button to enter the URL of order payment notification.

Fig3.5.1.4 Notify URL

# 3.5.2 SDK APIs

QIYU SDK provides the following client APIs for IAP:

  • Initialize QIYU Pay
/// <summary>
/// Initialize QIYU Pay
/// </summary>
public static void InitQiyuPay(RequestCallback callback)
	{
     if (!QiyuPlatform.IsAndroid)
     return;
    QiyuXRPlatformPlugin.QVR_InitQiyuPay(QiyuMessageManager.AddRequest(callback));
     }
Return Code Reason
S0000 Success
S9000 System error
S1000 Platform has not been initialized or the initialization is failed
  • Get item List
/// <param name="callback"></param>
/// <param name="skuList">Parameters format:"sku1,sku2,sku3", get the all items when skuList is empty</param>
public static void GetSkuList(RequestCallback callback, string skuList = "")
{
    if (!QiyuPlatform.IsAndroid)
    return;
    QiyuXRPlatformPlugin.QVR_GetSkuList(QiyuMessageManager.AddRequest(callback), skuList);
}
Return Code Reason
S0000 Success
B1001 The result is empty
S9000 System error
S9001 Parameter error
S1000 Platform has not been initialized or the initialization is failed
S1001 Payment has not been initialized or the initialization is failed
  • Pay the bill
/// <param name="callback"></param>
/// <param name="sku">the item SKU to be purchased</param>
public static void PlaceOrder(RequestCallback callback, string sku)
{  
    if (!QiyuPlatform.IsAndroid)    
    return;   
   QiyuXRPlatformPlugin.QVR_PlaceOrder(QiyuMessageManager.AddRequest(callback), sku);
}
Return Code Reason
S0000 Success
B3007 Device ID invalid
B4010 This SKU of item has already purchased
B4009 There is a unpaid order
B1003 authCookie invalid
B3019 The item is not exist
S9000 System error
S9001 Parameter error
S1000 Platform has not been initialized or the initialization is failed
S1001 Payment has not been initialized or the initialization is failed
  • Query the Order
/// <param name="callback"></param>
/// <param name="orderId">Order ID</param>
public static void QueryOrderResult(RequestCallback callback, string orderId)
{  
    if (!QiyuPlatform.IsAndroid)    
    return;
QiyuXRPlatformPlugin.QVR_QueryOrderResult(QiyuMessageManager.AddRequest(callback), orderId);
}
Return Code Reason
S0000 Success
B1003 authCookie invalid
B3019 The item is not exist
B1001 The result is empty
S9000 System error
S9001 Parameter error
S1000 Platform has not been initialized or the initialization is failed
S1001 Payment has not been initialized or the initialization is failed

When success to check the order, the order data will be returned at the same time. you can check the “orderStatus” to Judge success.

  • Check the history orders information
/// <param name="callback"></param>
/// <param name="sku">the SKU of order items</param>
/// <param name="curPage">page number,default is the first page</param>
/// <param name="pageSize">order amount in each page,default shows 10 orders each page</param>
public static void QueryHistoryOrders(RequestCallback callback, string sku, int curPage = 1, int pageSize = 10)
{   
    if (!QiyuPlatform.IsAndroid)    
    return; QiyuXRPlatformPlugin.QVR_QueryHistoryOrders(QiyuMessageManager.AddRequest(callback), sku, curPage, pageSize);
}
Return Code Reason
S0000 Success
B1003 authCookie invalid
B3019 The item is not exist
B1001 The result is empty
S9000 System error
S9001 Parameter error
S1000 Platform has not been initialized or the initialization is failed
S1001 Payment has not been initialized or the initialization is failed
  • Note
  1. platform API InitQiyuSDK and the payment initialization API InitQiyuPay is required before using payment APIs.
  2. There is 15 mins waiting time between the each PlaceOrder, if the previous order is not finished, an error code (B4009) notifies for the unpaid order when creating another bill. If the previous order has been paid, the new order will be created immediately.
  3. QIYU platform is using SMS link to do the payment, you can refer to the process of purchasing a game in Fig 3.5.1, there are waiting time between the placeorder and payment. So you cannot get the reason of payment by using PlaceOrder, the QueryOrderResult should be used to check the order status. You should make some guarantee logic (e.g. Check the result with polling) for the users' rights and interests during the player leaves the APP store. When the APP is interrupted or crashes, the right and interests can be resended by checking the History Orders API when restart the game.
  4. Please refer to 3.5.3 to protect the right of users if developers have their own server, and this is the recommended safe way . Singer player game should save the order by itself, and using the PlayerPrefs solution to avoid the PlayerPrefs lost after reinstall the game.
  5. If you want to refer to more details about IAP, please refer to QiyuPayTest.cs and QiyuPayTest scenes in QIYU SDK.

# 3.5.3 Payment Result Notifications

Please refer to the 4.2 Payment Result Notifications (opens new window).

# 3.5.4 Test Accounts for IAP

Select the amount of account you want to apply and press the confirm (3 at most). At the same time, we will send you the passwords by email.

Fig. 3.5.4.1 Apply Test Account

The simulation of the success or failure of payment through the switch on the right side of the test account. Then log in the test account in the QIYU device to test the result of the application.

Note: please using the English input method to enter the Special symbols of password, it will be failed when you using Chinese characters.

Fig. 3.5.4.2 Test IAP result

If you need more than three test account, please send the requirement to vrsupport@qiyi.com,we will help you as soon as possible.

# 3.6 DLC

QIYU Platform provides a way to sell the DLCs.

The DLC can be created, configured and edited on QIYU Developer Portal (opens new window), and integrated into games via SDK APIs. After passing the content review, the DLC can be sold on QIYU store. Users can purchase virtual coins, new missions, maps or media sources in the QIYU store. After entering the game, the new mission will be unlocked and the new resource will be downloaded. you can refer to the following flow chart to finish the DLC integration.

In QIYU Platform - Application - Add-on, you can create, view and operate the items..

  1. Create New DLC

Click 「Create Add-on」 button and filling the following information:

Add-on type: Choose Downloadable Content(DLC)

Name: The short descriptive name that the user will see.

SKU: Stock-Keeping Unit (SKU) is a unique string that you use to reference the DLC item in your APP. It is not allow to use same SKU in different items. Numbers and letters are allowed.

Price: the unit is RMB (CNY)

Items Type: The types of items are divided by consumable and durable. Consumable items can be purchased in many time, as coin in the game. Durable items can only purchase once, like weapons, map

Short Description: Enter a brief introduction about the item, up to 500 characters.

Long Description: Enter a more detailed description of the item, up to 100 characters.

ICON: Upload the icon of the DLC, and the icon will be displayed to the user

  1. Edit DLC

If you have other assets to upload, or your downloadable content has files to upload, please click the "Edit" button in the list.

  • DLC Files

Here you can select the DLC file you uploaded through the QIYU Developer Upload Tool.

  • Description

You can modify the name, introduction and description you filled in on the description page.

  • Assets

You can add asset materials about the downloadable content on the asset page.

Please note: although only icon is required, other non required items will be recommended with the highest priority if you fill in and pass the review.

  • Pricing

You can modify the price here.

  1. View DLC

    Click the DLC at the operation of application on dashboard, you will see the DLC list and information as the following figure shows:

  1. Submit DLC

All downloadable content needs to be submitted to the QIYU platform for review. Only after the review is passed, the QIYU platform will launch the downloadable content. Click 「Submit」 in the operation bar.

  1. Add-on Sequence

    You can sort the published downloadable content, so as to control the display order of downloadable content on the product details page. Click「Add-on Sequence

The up and down buttons on the operation bar can control the sorting of Add-ons.

# 3.6.2 APIs

SDK provides the following data structure and clients APIs, and supports to verify and download the DLC:

  • DLC Detail
public class QiyuDlcAssetDetail
        {
            public const int ASSET_TYPE_PERSISTENT = 1;//Durable DLC
            public const int ASSET_TYPE_CONSUMED = 2;//Consumable DLC
            public const int PAY_TYPE_FREE = 0;//free
            public const int PAY_TYPE_PAID = 1;//Paid

            public string sku;
            public string name;
            public int type;
            public int payType;  //PAY_TYPE_FREE, PAY_TYPE_PAID
            public float originalPrice;
            public float salePrice;
            public string shortDescription;
            public string iconURL;
        }
  • DLC Status
public class QiyuDlcAssetStatus
        {
            public const int DOWNLOAD_STATUS_AVAILABLE = 0;//Downloadable
            public const int DOWNLOAD_STATUS_DOWNLOADING = 1;//Downloading
            public const int DOWNLOAD_STATUS_COMPLETE = 2;//Download Complete
            public const int DOWNLOAD_STATUS_PENDING = 3;//Pause the downloads

         	public string sku;
         	public bool purchased;  //true: has been purchased, false has not been purchased
         	public int downloadStatus;  //DOWNLOAD_STATUS
           	public string filePath;
        }
  • Download Status
public class QiyuDlcNotifications
        {
            public const string CODE_COMPLETE = "S0000";//Complete to download
            public const string CODE_ERROR = "C1000";  // Unknown error
            public const string CODE_MD5_FAILED = "C1001";  // Fail to verify MD5
            public const string CODE_LOW_STORAGE = "C1002";  //  Memory space is inadequate
            public const string CODE_INTERUPT = "C1003";  // the receiving data has been interupted
            public const string CODE_SERVER_DISCONNECT = "C1004";  // Disconnect with server
            public const string CODE_INVALID_VERSION = "C1005";  // Resource does not exist
            public const string CODE_DOWNLOADING = "C1006";  // Add-on is downloading

            public string sku;
            public double currentSize;//the size of downloaded files, Unit is MB
            public double totalSize; //The total size of package, Unit is MB
            public string code;  //Return Code
            public string filePath;//The Path of downloaded files
        }
  • Initialization(QiyuDLC.Init)
    /// <summary>
        /// Initial APIs
        /// </summary>
        /// <param name="callback"></param>
        public static void Init(RequestCallback callback)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            QiyuXRPlatformPlugin.QVR_InitDLC(QiyuMessageManager.AddRequest(callback));
        }
Return Code Reason
S0000 Success to initial
S1000 SDK has not been initialized
S9000 System Error
S9001 Parameter is wrong
  • Get DLC List(QiyuDLC.GetAssetsList)
 /// <summary>
        /// Get DLC list
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="curPage">Page number of paged query, The default page is 1</param>
        /// <param name="pageSize">Set amount of Add-ons per page, The default number of DLCs per page is 10 </param>
        public static void GetAssetsList(RequestCallback callback, int curPage = 1, int pageSize = 10)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            QiyuXRPlatformPlugin.QVR_GetAssetsList(QiyuMessageManager.AddRequest(callback), curPage, pageSize);
        }
Return Code Reason
S0000 Success
S1001 Not initialized
B1001 The result is null
S9000 System Error
S9001 Parameter is wrong
  • Get the status of DLC of current user (applies to Durable DLC), (QiyuDLC.GetAssetStatus)
 /// <summary>
        /// Get DLC Status
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="sku">the DLC of sku</param>
        public static void GetAssetStatus(RequestCallback callback, string sku)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            QiyuXRPlatformPlugin.QVR_GetAssetStatus(QiyuMessageManager.AddRequest(callback), sku);
        }
Return Code Reason
S0000 Success
S1001 Not initialized
B1001 The result is null
S9000 System Error
B4015 The entitlement check of Durable DLC is not supported
B1003 The user account is expire
B4000 Fail to verify the application

Note: Consumable DLC, please refer to 3.6.3.2 The payment result notification (opens new window).

  • Download DLC(QiyuDLC.DownloadAsset)
 /// <summary>
        /// Download specific Add-on
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="sku">DLC sku</param>
        public static void DownloadAsset(RequestCallback callback, string sku)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            QiyuXRPlatformPlugin.QVR_DownloadAsset(QiyuMessageManager.AddRequest(callback), sku);
        }
Return Code Reason
S0000 Success
S1001 Not initialized
C1002 Memory space is inadequate
C1005 Resource does not exist
B4015 Not support the entitlement check for consumable DLC
B1003 The user account is expire
B4000 Fail to verify the application
B4013 Fail to verify the DLC
B3033 DLC version is wrong

Tips

  1. Please call the GetAssetStatus firstly to verify the user purchased or obtaion your DLC legitimately before call the download API. When a purchased DLC is not downloaded or new version is available, the result of downloadStatus is DOWNLOAD_STATUS_AVAILABLE, then you should remind users to download or update the DLC.

  2. DLCs can be downloaded in the background when users turn off the home page (not exit the application). Downloading is interrupted when the application exits completely. After restarting the application, you may need to check status and decide whether to continue the download. if the download is not complete, please call the DownloadAsset to continue to download.

  • Get download progress (QiyuDLC.SetDownloadUpdateCallBack)
     /// <summary>
        /// Set download progress notification
        /// </summary>
        /// <param name="callback">Call back functions</param>
        public static void SetDownloadUpdateCallBack(Action<QiyuMessage.QiyuDlcNotifications> callback)
        {
            if (!QiyuPlatform.IsAndroid)
                return;

            callbackInner = callback;
            QiyuXRPlatformPlugin.QVR_DownloadUpdateNotifications(DownloadUpdateCallBack);
        }
Return Code Reason
S0000 Success
C1001 Fail to verify MD5
C1002 Fail to write, Memory space might be inadequate
C1003 Receiving data has been interrupted, the network could be disconnected
C1004 Fail to query connection with server
C1006 The DLC is downloading
C1007 Repeat downloading query
C1008 verifying MD5
C1000 System error
  • Launch the DLC's page in the QIYU Store
QiyuXRPlatform.LaunchHome("dlc", "123456");//the second parameter is sku Code

# 3.6.3 Server API

# 3.6.3.1 Order Check

Please refer the 4.1 Order Check (opens new window).

# 3.6.3.2 Payment Result Notification

Please refer to the 4.2 Payment Result Notification (opens new window).

# 3.6.4 Notes

  1. If you choose to submit your add-ons for store review, meaning it will display in the store on an APP detail page, it must meet the store content requirements. For store content guidelines and best practices, please refer to the "Application Review Guidelines (opens new window)". Once launched, it will be available to all users in QIYU Store.
  2. One resource file can be uploaded for each DLC. If a DLC includes multiple files, it needs to be compressed before uploading.
  3. To unzipped the package, such SharpZipLib and other third parts library are recommended.
  4. For the Durable DLC, the entitlement check can be performed via client APIs. For the Consumable DLC, Since users can make repeated purchases, your game background should receive the order payment notice from the QIYU background to deliver the rights and maintain the order status.

# 3.6.5 Testing

The QIYU platform provides you with test accounts. You can use the test account to log in to the QIYU VR device, and configure relevant options to test your additional content.

In the DLC test result column, click the 「Settings」 button to configure whether the test account purchases the downloadable content and whether the downloadable content is published.

Please note:

  1. Whether the configured downloadable content is published only affects the return of the interface, and does not affect the real online situation. All downloadable content needs to be submitted to QIYU platform for review. After the approval, the QIYU platform will communicate with you about the online time for official release.
  2. Whether the configured downloadable content is purchased only affects the return of the interface and does not need to be actually paid.
  3. If you need to test the DLC order payment result, you set the "Purchased or not" to "Already", and pressing the "Order Generated", and then you can check the result of DLC order by using API. Please note that the durable DLC will only generate one order, and consumable DLC will generate new order in every generation.
  4. If you want to test the payment result from server, please enter the URL into "Notify URL", and set the "Purchased or not" to "Already", and pressing the "Order Generated". The durable DLC will notify the same order in every notification, and the consumable DLC will notify the new order in every notification.

# 3.6.6 DLC Demo

We provide the DLC Demo in Developer tunnel of QIYU Store, displaying the effect and In-APP APIs usage of DLC in QIYU Demo store. Please refer to the following steps:

  1. Use the test user account to login QIYU devices.
  2. Open “AppStore”, go to the bottom of page and find “我的预览应用”, you can see the DLC Demo.
  1. Pressing the details page of DLC Demo, you can see two attached DLCs.
  1. Pressing the details page of DLC, you can view the title, description, pictures, videos, comments and other information.
  1. In the application detail page, “Free" to purchase the Demo APP. In DLC details page, Free to purchase add-ons.

  2. Pressing “Open application”, and start the Demo, you can:

    • Get the DLC list of this application by using GetAssetsList.

    • Granted specific DLC access and Get the download path of DLC which has add-on file by using GetAssetStatus.

    • Download the purchased DLC by using DownloadAsset.

    • Launch the specific DLC page by using LaunchHome.