13

I'm working on a In App Store on my app, I used AndroidBillingLibrary by robotmedia, when I purchase android.test.purchased using the library the response is OK, all the data I need is in there.

The problem is, when I switched to Android In-App Billing v3 this is all received from the response, no signatures.

{"packageName":"com.my.sampleapp","orderId":"transactionId.android.test.purchased","productId":"android.test.purchased","developerPayload":"","purchaseTime":0,"purchaseState":0,"purchaseToken":"inapp:com.my.sampleapp:android.test.purchased"}

I followed exactly this sample https://developer.android.com/training/in-app-billing/preparing-iab-app.html#GetSample but there's no signatures. I even run the given sample app by Google but no luck.

I put my Base64-encoded RSA public key correctly in mHelper = new IabHelper(this, myPublicKey);

and this is my purchase code mHelper.launchPurchaseFlow(this, itempackage, 10001, mPurchaseFinishedListener);

OnIabPurchaseFinishedListener mPurchaseFinishedListener = new OnIabPurchaseFinishedListener() {
        public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
            Log.i("Billing", "purchasing: " + result.getMessage());

            if (result.isFailure()) {
                Log.i("Billing", "Error purchasing: " + result);
                return;
            } else if (purchase.getSku().equals("android.test.purchased")) {
                Log.i("Billing - signature", purchase.getSignature());
                consumeItems();
            } else {
                Log.i("Billing", "Error purchasing: " + result);
            }
        }
    };

Somehow my mPurchaseFinishedListener is not receiving anything after the purchase but the protected void onActivityResult(int requestCode, int resultCode, Intent data) is receiving something but there's no signature.

Any solutions to this? It's weird that v2 is receiving signatures and v3 is not.

Andy Dennie
  • 6,012
  • 2
  • 32
  • 51
NaviRamyle
  • 3,967
  • 1
  • 31
  • 49
  • Ivan. I am getting the same problem, have you found the answer yet? – melodiouscode Jan 13 '13 at 14:32
  • Not yet, I switched back to v2. Our app is in draft mode, not sure what is the result of *android.test.purchased* in published mode. – NaviRamyle Jan 14 '13 at 01:20
  • This is an exact duplicate of: http://stackoverflow.com/questions/13893259/android-billing-v3-no-signature – prdatur Jan 17 '13 at 21:00
  • @Ramyle Did you get any success with this? I am also not getting signatures when trying to purchase reserved product id's from a developer's phone. Do you know what might be the reason? – Krishnabhadra Jan 25 '13 at 09:45

3 Answers3

12

You don't get signatures for the test IDs, android.test.purchased, etc.

You'll receive signatures with real purchases.

Rawkode
  • 21,990
  • 5
  • 38
  • 45
  • hello are you sure that i will get signature with real purchase ??... because when i used google sample code for test product id i dont get data signature but when i used another code from another tutorial i do get datasignature for test product ids... – Swap-IOS-Android Jul 11 '13 at 11:40
  • @Swap-IOS-Android, for the benefit of other readers, what was the other code you used from "another tutorial"? I'd like to test with that too – wired00 Sep 04 '13 at 05:06
  • 1
    @wired00 here is link for another tutorial...but its in app version 2 not 3 ...http://www.androidhub4you.com/2013/03/how-to-inegrate-in-app-purchase-billing.html.. one more thing i found that when you are using Test.purchased product id for purchase than google send back signature null but if you try with sandbox than you will get signature but you will not charged for that transaction... – Swap-IOS-Android Sep 04 '13 at 07:55
  • @Swap-IOS-Android thanks for that, that's interesting about Sandbox. Actually though, what I've been doing, because its almost ready for production, is use a live product. I then receive a valid `OrderID` etc, but then simply login to the `Google Wallet Merchant` account to instantly refund the transaction/s (https://wallet.google.com/merchant‎) – wired00 Sep 05 '13 at 00:04
  • @wired00 but now google introduced sandbox so why to do this hassle...any ways happy coding – Swap-IOS-Android Sep 05 '13 at 08:01
  • @Swap-IOS-Android, right I'll look into the sandbox now thanks :) – wired00 Sep 06 '13 at 00:15
1

As was said by Rawkode, you no longer get signatures for test purchases (android.test.*). I took the dive and uploaded my app to the market place (just didn't publish it) using my real products.

Low and behold signatures started to be returned! I recommend amending any server side validation you are using to skip the signature check when the data contains an android.test.* item id.

melodiouscode
  • 2,105
  • 1
  • 20
  • 41
0

What you mean by Signatures? Is that Subscriptions? Or an in-app item (consumable or not)? Because in-App Billing v3 does not support subscriptions at the moment, if you want that feature you have to use v2 (https://developer.android.com/google/play/billing/billing_overview.html). Also, make sure your item is marked as "a managed item" on your developer console (for Billing v3).

Sorry if I misunderstood. Also, try enabling the debug mode on your IabHelper instance, this will provide you a better overview of your problem.

mHelper.enableDebugLogging(true, "YOURTAG");

I suggest taking a look at the implementation guide on the Developers website: https://developer.android.com/google/play/billing/billing_integrate.html

There's also sample code there.