Prime31 "In-App Billing" plugin, where to put my logic?


I just writing an interface for the IAB plugin (, but I’m not really sure where to put my “succeed”-logic in.

I have two events:

  • purchaseSignatureVerifiedEvent
  • purchaseSucceededEvent

but which one is called first? Because the purchaseSignatureVerifiedEvent is confirming the transaction (using confirmPendingPurchases), I suppose the order is succeed then verified.

I do not want to unlock content before verification (or doesn’t it matter?), but I also do not want to have it confirmed, before my game is saved successful. On the other hand the verified event does not receive any productid…

And do anybody knows, which events are called, when google play tries to complete pending transactions from previous sessions, that were not confirmed before.
Am I able to cancel these transactions, e.g. when the item id is not valid anymore in my game?

( Sorry, I do not have any device to test the order by my self :frowning: )

best regards

OK, maybe someone else will have similar problems…

I ran tests on some devices (Galaxy Ace 2.3.6, LG-P350 2.2.1) and both fired purchaseSignatureVerifiedEvent. The purchaseSucceededEvent was never called, I have no idea what this is for.

Anyway, you get all needed data (includes productid) from the signedData string in the hashtable that is passed to the event as json. Using Json.Net you can copy the snippet below.

using Newtonsoft.Json;

public sealed class SignedDataResponse
	public sealed class Order
		[JsonProperty(PropertyName = "notificationId")]
		public string NotificationId;

		[JsonProperty(PropertyName = "orderId")]
		public string OrderId;

		[JsonProperty(PropertyName = "packageName")]
		public string PackageName;

		[JsonProperty(PropertyName = "productId")]
		public string ProductId;

		[JsonProperty(PropertyName = "purchaseTime")]
		public long PurchaseTime;

		[JsonProperty(PropertyName = "purchaseState")]
		public int PurchaseState;

	[JsonProperty(PropertyName = "nonce")]
	public long Nonce;

	[JsonProperty(PropertyName = "orders")]
	public Order[] Orders;

your callback:

private void PurchaseSignatureVerifiedEvent(Hashtable payload)
	if (null != payload)
		var signedData = payload["signedData"].ToString();
		var signature = payload["signature"].ToString();

		var response = Newtonsoft.Json.JsonConvert.DeserializeObject<SignedDataResponse>(signedData);

		UnityEngine.Debug.Log("productId: " + response.Orders[0].ProductId);