Andrius Andrius - 1 month ago 12
Android Question

Get signature of previously purchased item In App Billing

I'm using Xamarin Android and Xamarin.InAppBilling component to integrate In App Billing functionality in my app.
Before providing users with digital content I do server-side signature verification to make sure order is legit. And the only way to get signature is immediately after the purchase in OnProductPurchased event like this:

.OnProductPurchased += (int response, Purchase purchase, string purchaseData, string purchaseSignature) =>
// Use purchaseSignature here!

Official Google documentation says that it is possible to get signatures of owned items like this:

Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
ArrayList<String> signatureList =

The problem is that
method in Xamarin component returns
and not
. That means that if for some reason my app will fail to connect to my server immediately after purchase, there will be no way to verify signature in the future and legit (paid) user won't be able to access content that they paid for.

So is there any way to get signatures of owned (previously purchased) items using Xamarin.InAppBilling component?


That response Bundle will return a list of Product IDs, Order Details for each Purchase, and Signatures of Each Purchase.

Thus you should be able to use the following method to return purchases:

public IList<Purchase> GetPurchases(string itemType)

You will then see inside the decompiled code that it parses the 3 items from the bundle as mentioned above:

IList<string> stringArrayList1;
IList<string> stringArrayList2;
IList<string> stringArrayList3;

stringArrayList1 = bundle.GetStringArrayList("INAPP_PURCHASE_ITEM_LIST");
stringArrayList2 = bundle.GetStringArrayList("INAPP_PURCHASE_DATA_LIST");
stringArrayList3 = bundle.GetStringArrayList("INAPP_DATA_SIGNATURE_LIST");

However the actual method returns a IList<Purchase> which is Deserialized into a Purchase object.

As a small side note, it may be possible to make a small extension library that will parse the bundle like above for the INAPP_DATA_SIGNATURE_LIST and extend the Purchase object to include any further information you need.