Raibaz
Raibaz

Reputation: 9700

(Possibly) undocumented error when purchasing an item with Android In-App Billing

I'm having issues performing purchases with Android's IAB.

I seem to be able to get the 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 message on the app stating "Item purchase impossible (Error code IAB-LPD)" (loosely translated from Italian), and in the onActivityResult method, when doing

int responseCode = data.getIntExtra("RESPONSE_CODE", 0);

I get a responseCode of 2, that is not documented in the IAB API reference, as it documents error codes 0, 1, 3, 4 and so on.

The Api V2 Reference says that error code 2 is for the case when the network connection is down, but my device's connection seems to be working ok.

I also haven't found any reference to the error code "IAB-LPD" anywhere on the Internet.

I tried changing my License key to an invalid value, and I expectedly got an error message stating "This app is not authorized for billing", so I assume it's not a problem with the license key I'm using.

What am I missing?

Update: I also don't think it's an issue with permissions, as I'm able to get SKU details from the same technique described in the documentation.

Further update: I also don't get any errors in LogCat, neither when starting the intent nor when executing onActivityResult.

Upvotes: 3

Views: 545

Answers (1)

abahgat
abahgat

Reputation: 13530

I am assuming the error message you see is

Impossibile acquistare l'articolo. (Codice di errore: IAB-LPD)

There seems to be an error in the Italian translation of that message (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 address your problem.

(I apologize for the inconvenience, I submitted a fix for the error and it should be fixed in the upcoming releases.)

Upvotes: 2

Related Questions