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!
Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
ArrayList<String> signatureList =
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
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.