Languages

Menu
Sites
Language
Unity&IAP

Hello,

I'm testing the Unity Tizen IAP plugin, but I'm encountring a problem, after doing any request (GetAvailableItems, GetCountries... )  the app hangs on "Waiting for Plugin Callback" and the callBackHandler never called!

To reproduce the issue, create a new project using the latest Unity version, import the Tizen IAP plugin from Asset Store, open the TizenSampleAppScene in the examples folder , build it and run it in your Tizen device.

There is someone that can help me to make Unity Tizen IAP working?

Thanks

The source code of the scene:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
using Tizen.IAP;

public class SampleClass
{
    public int Value { get; set;}

	public SampleClass(int x)
	{
		Value = x;
	}
}

public class TizenSampleApp : MonoBehaviour {

	string userMCC = null;
	string userMNC = null;
	string userGrpId = null;
	string userItemTypeCd = null;
	string userBuyItemName = null;
	public SampleClass userData = null;
	
	//IAP object initialization
	
	StoreProvider storeObj = StoreProvider.Instance;
	IAP_AppRequest appReq = new IAP_AppRequest ();


	void Start () {
		//valid data
		appReq.Mode  = "1";
		appReq.StartNumber = 1;
		appReq.EndNumber = 200;
		appReq.StartDate = "2014-01-01";
		appReq.EndDate = "2020-12-31";
		appReq.ItemId = "000000581522";
		appReq.ItemName = "item1";
		appReq.ItemGroupId = "100000070614";
		appReq.LanguageCd = "ENG";
		appReq.ItemTypeCd = "10";
		appReq.Mcc = "404";
		appReq.Mnc = "01";
		
		//calbackHandler
		appReq.RequestCallbackHandler = callBackHandler;
		userData = new SampleClass (12);
		appReq.RequestCallbackUserData = userData;
	}
	void Update (){
	}

	//for debug
	public void printAllDetails(string a, string b , string c,string d)
	{
		//for Logs only
		Debug.Log ("[UnityAppLOG]" + a);
		Debug.Log ("[UnityAppLOG]" + b);
		Debug.Log ("[UnityAppLOG]" + c);
		Debug.Log ("[UnityAppLOG]" + d);

	}

	//for debug
	void LogCheck(string log){
		Debug.Log(log);
	}

	//CallBackHandler Definition
	public void callBackHandler(IAP_AppResponse response)
	{
		Debug.Log ("[ENTER CALLBACK ...........  UNITY APP");
		if(response.ErrorCode == ErrorType.ERROR_ALL_SUCCESS)
		{
			if (response.RequestCode == RequestType.FUNC_GET_COUNTRY_LIST) {
				List<IAP_Country> countries = response.Countries;
				int i;
				for (i=0; i<countries.Count; i++) {
					Debug.LogError ("[UnityAppLOG]" + countries [i].Name);
					Debug.LogError ("[UnityAppLOG]" + countries [i].Mcc);
				}
			}
	
			if (response.RequestCode == RequestType.FUNC_GET_ITEM_LIST) {	

				List<IAP_Item> AvailableItems = response.AvailableItems;
				int i;
				for(i = 0; i < AvailableItems.Count ; i++){
					Debug.LogError("[UnityAppLOG]" + AvailableItems [i].ItemName);
				}
		}
			if (response.RequestCode == RequestType.FUNC_GET_PURCHASED_ITEM_LIST) {
				List<IAP_Item> PurchasedItems = response.PurchasedItems;
				int i;
				for (i = 0; i < PurchasedItems.Count ; i++){
					Debug.LogError("[UnityAppLOG]" + PurchasedItems [i].ItemName);
				}
			}

			if (response.RequestCode == RequestType.FUNC_PURCHASE) {

				IAP_Purchase PurchaseOrder = response.PurchaseOrder;
				Debug.LogError("[UnityAppLOG]" + "Purchased Item is "+PurchaseOrder.ItemName);
			}

			if (response.RequestCode == RequestType.FUNC_NONE) {

				Debug.LogError("[UnityAppLOG]" + "No Request type came in Callback ");
			}

			SampleClass receivedData = (SampleClass) response.UserData;
			Debug.LogError("User Data Value : " + receivedData.Value);

		}

		else if (response.ErrorCode == ErrorType.ERROR_ALLOC_FAIL){
			Debug.Log("[UnityAppLOG]" + "Alloc Failed \n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_APP_CONTROL_ERROR){
			Debug.Log ("[UnityAppLOG]" + "APP CONTROL ERROR\n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_RESULT_FAIL ){
			Debug.Log ("[UnityAppLOG]" + "Result Failed \n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_RESULT_CANCELLED){
			Debug.Log ("[UnityAppLOG]" + " Result cancelled\n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_INPUT_FPTR ){
			Debug.Log ("[UnityAppLOG]" + " Invalid Input Fptr\n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_INPUT_PARAM){
			Debug.Log ("[UnityAppLOG]" + " Invalid Input Param \n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_ITEM_GRP_ID){
			Debug.Log ("[UnityAppLOG]" + " Invalid Item Group ID\n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_ITEM_ID){
			Debug.Log ("[UnityAppLOG]" + " Invalid Item Id \n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_TRANSACTION_ID){
			Debug.Log ("[UnityAppLOG]" + " Invalid Transaction Id\n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_ITEM_TYPE_ID){
			Debug.Log ("[UnityAppLOG]" + " Invalid Item Type \n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_PARAM_MCC ){
			Debug.Log ("[UnityAppLOG]" + " Invalid Mcc Param\n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_INVALID_PARAM_MNC){
			Debug.Log ("[UnityAppLOG]" + " Invalid Param Mnc\n");
		}

		else if (response.ErrorCode == ErrorType.ERROR_UNKNOWN_ERROR ){
			Debug.Log ("[UnityAppLOG]" + " Unknown Error \n");
		}
	}

	public void reEnableButton(Button button){
		button.interactable = true;
	}
	
	IEnumerator MyMethod(Button button) {
		Debug.Log("[UnityAppLOG]" + "Before Waiting 10 seconds");
		yield return new WaitForSeconds(10);
		Debug.Log("[UnityAppLOG]" + "After Waiting 10 Seconds");
		Debug.Log ("[UnityAppLOG]" + "ReEnabling Button\n");
		reEnableButton (button);
	}



	public void getMcclist(Button button){

		//calling IAP GET Countries API
		storeObj.GetCountries(appReq);

		Debug.Log ("[UnityAppLOG]" + "Disabling button\n");
		button.interactable = false;
		Debug.Log ("[UnityAppLOG]" + "Fetching Mcc list\n");
		StartCoroutine(MyMethod(button));


	}

	public void getMnclist(Button button){
	
		//automatically filled 
		Debug.Log ("[UnityAppLOG]" + "Disabling button\n");
		button.interactable = false;
		Debug.Log ("[UnityAppLOG]" + "Fetching Mnc list\n");
		GameObject.Find ("MNC").GetComponent<InputField> ().placeholder.GetComponent<Text>().text = "01";
		StartCoroutine(MyMethod(button));
	}

	public void userMccInput(Text text){
		Debug.Log ("User Input Data Being Fetched \n");
		userMCC = text.text;
		if(!string.IsNullOrEmpty(userMCC)){
		LogCheck(userMCC);
		}
	}

	public void userMncInput(Text text){
		Debug.Log ("User Input Data Being Fetched \n");
		userMNC = text.text;
		LogCheck(userMNC);
	}

	public void userGrpIdInput(Text text){
		Debug.Log ("User Input Data Being Fetched \n");
		userGrpId = text.text;
		LogCheck(userGrpId);
	
	}

	public void userItemTypeCode(Text text){
		Debug.Log ("User Input Data Being Fetched \n");
		userItemTypeCd = text.text;
		LogCheck(userItemTypeCd);
	}

	public void userBuyItemNameInput(Text text){
		Debug.Log ("User Input Data Being Fetched \n");
		userBuyItemName = text.text;
		LogCheck(userBuyItemName);
	}
	public void getItemList(Button button)
	{
		Debug.Log ("[UnityAppLOG]" + "Get Item List Button Pressed\n");

		Debug.Log ("[UnityAppLOG]" + "Disabling button\n");
		button.interactable = false;
		StartCoroutine(MyMethod(button));
		GameObject.Find ("Buy").GetComponent<Button> ().interactable = true;


		//setting user input values
		if(!string.IsNullOrEmpty(userMCC)){
			appReq.Mcc = userMCC;
		}
		else{
			GameObject.Find ("MCC").GetComponent<InputField> ().placeholder.GetComponent<Text>().text = appReq.Mcc;
		}
		if(!string.IsNullOrEmpty(userMNC)){
			appReq.Mnc = userMNC;
		}
		else{
			GameObject.Find ("MNC").GetComponent<InputField> ().placeholder.GetComponent<Text>().text = appReq.Mnc;
		}
		if(!string.IsNullOrEmpty(userGrpId)){
			appReq.ItemGroupId = userGrpId;
		}
		else{
			GameObject.Find ("GrpIdInput").GetComponent<InputField> ().placeholder.GetComponent<Text>().text = appReq.ItemGroupId;
		}
		if(!string.IsNullOrEmpty(userItemTypeCd)){
			appReq.ItemTypeCd = userItemTypeCd;
		}
		else{
			GameObject.Find ("ItemTypeCode").GetComponent<InputField> ().placeholder.GetComponent<Text>().text = appReq.ItemTypeCd;
		}
		 
		//calling IAP Get Item List API
		storeObj.GetAvailableItems(appReq);
		
		//for debugging
		//printAllDetails (userMCC, userMNC, userGrpId, userItemTypeCd);
		printAllDetails (appReq.Mcc,appReq.Mnc , appReq.ItemGroupId, appReq.ItemTypeCd);



	}
	public void getPurchasedList(Button button){
		
		//Calling IAP Get Purchase List API
		storeObj.GetPurchasedItems(appReq);


		button.interactable = false;
		StartCoroutine(MyMethod(button));
		GameObject.Find ("Buy").GetComponent<Button> ().interactable = true;

	}
	public void doBuying(Button button){

		if(!string.IsNullOrEmpty(userBuyItemName)){
			appReq.ItemName = userBuyItemName;

		}
		else{
			GameObject.Find ("BuyItem").GetComponent<InputField> ().placeholder.GetComponent<Text>().text = appReq.ItemName;
		}

		
		//Calling IAP Purchase API
		storeObj.PurchaseItem (appReq);

		button.interactable = false;
		StartCoroutine(MyMethod(button));

	}
}

 

 

 

 

 

 

 

 

 

 

Responses

11 Replies
daniel kim

Hi,

It seems that it is not happened in Unity sdk. Is it reproduced with real device only?

Regards

Wadja Wadja

Hi Daniel,

Thank you for your response, yes it happens in Unity Editor (Unity 5.3.3p1).

I've just imported the Tizen IAP plugin from the Asset Store, opened TizenSampleAppScene, and when I run it in the editor (click on play button), I have this log:

[UnityAppLOG]Get Item List Button Pressed

[UnityAppLOG]Disabling button

[UnityAppLOG]Before Waiting 10 seconds

Available Items requested from Application

Allocated for items

iapunity
UnityEngine.Debug:LogError(Object)
Tizen.IAP.StoreProvider:GetAvailableItems(IAP_AppRequest)
TizenSampleApp:getItemList(Button) (at Assets/Plugins/Examples/TizenSampleApp/Scripts/TizenSampleApp.cs:277)
UnityEngine.EventSystems.EventSystem:Update()

[UnityAppLOG]404

[UnityAppLOG]01

[UnityAppLOG]100000070614

[UnityAppLOG]10

[UnityAppLOG]After Waiting 10 Seconds

[UnityAppLOG]ReEnabling Button

 

You can see the "callBackHandler" is never called.

When I build the sample and run it in a device, in the log it hangs on "Waiting for Plugin Callback" and the callBackHandler is never called also.

Any idea how I can make IAP working?

 

Sukwon Suh

Hi Wajdi,

 

I'll check this issue then let you know results as soon as possible.

Regards

 

Ilji Seo

Hello,

This issue is that cause analysis was completed.

It has been modified with Unity.

I will reply as soon as modified version released.

Ilji Seo

Hello,

This issue is that cause analysis was completed.

It has been modified with Unity.

I will reply as soon as modified version released.

Wadja Wadja

Thanks for your support, I'll wait for your response.

Wadja Wadja

Hi,

There is any update about this issue?

Ilji Seo

Wajdi,
I'm sorry for late reply.
It is a privilege issue in Unity tizen, fix has been delayed.
We are looking for ways to solve a temporary before a new patch is issued.
As one that there is a way to use the older unity version temporarily.
If changes occur, I will share information ASAP.
Sorry again for having delayed.

Wadja Wadja

Thanks for the update, I'm looking forward for the fix.

But until that, what's the latest Unity version is currently working with your IAP Plugin?

Ilji Seo

Wajdi,
The version that guarantee a normal operation is 5.3.2p3.
But this version has a display problem(Can't go to sleep).
You can fix display problem add a code in unity script. As follows:
Screen.sleepTimeout = SleepTimeout.SystemSetting;
If added to the main object(ex, Camera)'s Start(), you will be able to solve the display problems.

Ilji Seo

Wajdi,

Fixed version was released.
Version is 5.3.4p1, you can find unity patch release page(https://unity3d.com/unity/qa/patch-releases?version=5.3).
One of details, due to this release, we have a change of privileges rule.
Previously few privileges has been built, not now.
So, if you want to use IAP plugin, please add a privilege in Tizen player setting. Add thing is "AppmanagerLaunch".
Of course, existing Unity IAP sample will be updated also. Until then, please use in addition.