Sign In Register

How can we help you today?

Start a new topic
Answered

BuyVirtualGoodsRequest.Send Callback Not Called When Insufficient Currency

Hey guys! So I have this really quick question regarding the callback to BuyVirtualGoodsRequest.Send. I have observed that when this request is sent, the callback doesn't seem to be called when insufficient funds/currency is detected. 


Here is a very brief depiction of my scenario:

1) Player has '0' currency1

2) Player initiates a BuyVirtualGoodsRequest for a virtual item that costs '1' currency1

3) In the console, the system displays the following message

GS: RECV:{"@class":".BuyVirtualGoodResponse","currencyType":0,"error":{"currency1":"INSUFFICIENT_FUNDS"},"requestId":"635877823643559050_11","scriptData":null}

My in-line callbacks, however, are not called at all. I know they work because when currency1 has a value greater than '0', the request pushes through and my Debug.Logs inside the proper callback is invoked. Here is the snippet that sends the request and handles the response:

private void BuyVirtualGood()
{
	BuyVirtualGoodsRequest request = new BuyVirtualGoodsRequest().SetCurrencyType (1).SetQuantity (1).SetShortCode ("GOLD_COIN");
		request.Send ( (response) => {
		
		if (response.HasErrors)
		{
			Debug.LogWarning ("Error buying virtual good GOLD_COIN: " + response.Errors.JSON);
		}
		else
		{
			Debug.Log ("Successfully bought 1 GOLD_COIN: " + response.JSONString);
		}
			
	});
}

The Debug.Log also gets called when there are actual errors encountered.


So, I'm just wondering why none of the Debug.Logs inside the callback are called when currency1 is insufficient :D


Best Answer

Well that was silly of me. I callback was, in fact, being called. It was just not displaying properly in the Unity console (due to warnings messages being filtered out).


Sorry folks, false alarm! This was my bad.

1 Comment

Answer

Well that was silly of me. I callback was, in fact, being called. It was just not displaying properly in the Unity console (due to warnings messages being filtered out).


Sorry folks, false alarm! This was my bad.

Login to post a comment