(Possibly) undocumented bug when purchasing item with Android In-App billing system
I'm having problems purchasing with Android IAB.
I think I can get buyIntent and I start it with this code taken from the IAB documentation:
Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(),
sku, "inapp", getString(R.string.iab_key));
int response = buyIntentBundle.getInt("RESPONSE_CODE");
if(response == 0) {
PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
startIntentSenderForResult(pendingIntent.getIntentSender(),
1001, new Intent(), 0, 0, 0);
}
However, when the intent starts, I get an error in the app that says "Purchase of item is not possible (IAB-LPD error code)" (loosely translated from Italian) and in the method onActivityResult
when doing 21> p>
int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
I get responseCode
from 2, which is not documented in the IAB API link as it documents error codes 0, 1, 3, 4, etc.
The Api V2 reference says that error code 2 is for the case where the network connection is disconnected but the connection to the device is working fine.
I also haven't found any links to the "IAB-LPD" error code anywhere on the internet.
I tried changing my license key to an invalid value and I was expecting to get the error "This app is not allowed for billing", so I'm guessing this is not a problem with the license key I'm using.
What am I missing?
Update . I also don't think this is a permissions issue, as I can get the SKU details from the same method described in the documentation.
Further update . I also don't get any errors in the LogCat, neither on startup nor on execution onActivityResult
.
source to share
I am assuming the error message you are seeing is
Impossibile acquistare l'articolo. (Codice di errore: IAB-LPD)
There seems to be an error in translating this post into Italian (the error code has been translated).
The error message you are looking for is
The item could not be purchased. (Error code: IAB-DPTL)
The answer to this question should help you solve your problem.
(Sorry for the inconvenience, I have submitted a bug fix and should be fixed in a future release.)
source to share