j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

ERROR 6777001: Init failed - Failed to query inventory: #76

Closed Moussawi7 closed 5 years ago

Moussawi7 commented 9 years ago

Hi @j3k0 , I am unable to purchase the same product twice, although that my products are CONSUMEABLE . and i read the documentation carefully but you didn't mentioned how to consume a product, in order to purchase it again. note that i am getting the following error:

ERROR 6777001: Init failed - Failed to query inventory: IabResult: Error refreshing inventory (querying owned items). (response: 6777017:Error)

Thank you.

j3k0 commented 9 years ago

You need to finish the transaction: https://github.com/j3k0/cordova-plugin-purchase/blob/master/doc/api.md#-purchasing

Moussawi7 commented 9 years ago

Sure, I am finishing all purchases automatically using:

store.when("product").approved(function(p) {
alert("approved fired");
    p.finish();
});

but it's never fired.

j3k0 commented 9 years ago

Should work, it's been tested on both ios and android.

Full working example here: https://github.com/Fovea/cordova-plugin-purchase-demo/blob/master/www/js/index.js

Can you share more source or logs?

Moussawi7 commented 9 years ago

in fact, I was using the code you provided, with some customizations:

    if (!window.store) {
        log('Store not available');
        return;
    }
    store.verbosity = store.DEBUG;

    store.register({
        id: 'product1',
        alias: 'Product1',
        type: store.CONSUMABLE
    });
    store.register({
        id: 'product2',
        alias: 'Product2',
        type: store.CONSUMABLE
    });
    store.register({
        id: 'product3',
        alias: 'Product3',
        type: store.CONSUMABLE
    });

    // Log all errors
    store.error(function (error) {
        log('ERROR ' + error.code + ': ' + error.message);
    });
    store.when("product").approved(function (p) {
        alert(JSON.stringify(p));
        p.finish();
    });

    store.refresh();
    store.order("product3");
j3k0 commented 9 years ago

Can you show the output of "adb logcat" ?

Moussawi7 commented 9 years ago

Hi @j3k0 , i was having some trouble on my "eclipse IDE", now it's OK. anyway, i was trying to debug the purchases, but the application crash each time i call store.refresh(). Thank you.

j3k0 commented 9 years ago

Hi @Moussawi7,

Sorry I can't help much without logs and more details.

Moussawi7 commented 9 years ago

Hi @j3k0 , Thank you a billion. The issue ERROR 6777001: Init failed - Failed to query inventory: is never happened, and the crash issue #103 has been solved by replacing $BILLING_KEY with its value. Thanks again.

j3k0 commented 9 years ago

Ok thanks for notice. This error message has to be less cryptic.

On Tue Dec 23 2014 at 11:36:37 AM Ali Moussawi notifications@github.com wrote:

Hi @j3k0 https://github.com/j3k0 , Thank you a billion. The issue ERROR 6777001: Init failed - Failed to query inventory: is never happened, and the crash issue #103 https://github.com/j3k0/cordova-plugin-purchase/issues/103 has been solved by replacing $BILLING_KEY with its value. Thanks again.

— Reply to this email directly or view it on GitHub https://github.com/j3k0/cordova-plugin-purchase/issues/76#issuecomment-67938948 .

cameronbourke commented 8 years ago

@j3k0 Awesome plugin man, but I'm running into the same error on Android aswell, but for a different reason.

ERROR 6777001: Init failed - Failed to query inventory: IabResult: Error refreshing inventory (querying owned items). (response: 6777017:Error)

I've finished any pending transactions, and the billing key is correct. The error occurs the first time store.refresh() is called. What can I get to help you out?

Here's the log in the console https://gist.github.com/cameronbourke/f4b70284a77bccb72ada

The apk has been uploaded to play dev console more than 24hrs ago and I'm running a signed apk on my device using ionic run android --device --release.

dawidroz commented 8 years ago

@cameronbourke - you fix this? We have a this same problem

@j3k0 - can you help? We have this same problem. After bought product log said: "Signature verification failed for sku myproduct" and after restart app we have "Failed to query inventory: IabResult: Error refreshing inventory".

cameronbourke commented 8 years ago

Hey @dawidroz. Do you get an error response. Should look something like this: (response: 6777017:Error)

dawidroz commented 8 years ago

Yes. Exactly

Dnia 14 cze 2015 o godz. 07:33 Cameron Bourke notifications@github.com napisał(a):

Hey @dawidroz. Do you get an error response. Should look something like this: (response: 6777017:Error)

— Reply to this email directly or view it on GitHub.

cloakedninjas commented 8 years ago

For people getting this error message after purchasing android.test.purchased. The issue lies with Google:

After you buy android.test.purchased the verifyPurchase function in Security.java will always fail and the QueryInventoryFinishedListener will stop at the line if (result.isFailure()); this is because the android.test.purchased item always fails the TextUtils.isEmpty(signature) check in Security.java as it is not a real item and has no signature returned by the server.

A workaround for being able to purchase the test item multiple times is to clear data: Settings -> Apps -> Google Play Store -> Clear Data

fer8a commented 8 years ago

@j3k0 Any thoughts on this? I have the same problem as @cameronbourke and @dawidroz . It happened to me with non_consumable products. I get the error response only after a purchase has been made even though my billing_key is properly set.

I tested with another Google account (one without any purchase, hence the error is not happening) and in the logs what I can notice is that for the one with the error the android -> ready is not being called.

Like @cameronbourke shows here that's the point where the execution ends. This is what is supposed to be executed after:

store-android.js:453 [store.js] DEBUG: android -> ready
store-android.js:726 InAppBilling[js]: getAvailableProducts called!
store-android.js:453 [store.js] DEBUG: android -> loaded -
dominhquan commented 8 years ago

@cloakedninjas : clear all data from google playstore doesn't solve the problem, we cant get the response from google play, i need it for my server to verify itself. How can i get the valid data, or how to skip this verify phase from this plugin ?

aerialglasgow commented 8 years ago

Nov 2015. Great plugin thanks! But this problem is still occurring in Android on the all purchases initiated AFTER the first purchase.

ERROR 6777001: Init failed - Failed to query inventory: IabResult: Error refreshing inventory (querying owned items). (response: 6777017:Error)

When the google play app data is cleared I can then start to purchase, but attempting a second purchase the Inventory errors appears again. I am using:

store.off(render);
product.finish();
order.finish();
product = null;

I presume this is completing the order.

Has anyone found this also?

Thanks

Chuckv01 commented 8 years ago

I was able to fix this error:

ERROR 6777001: Init failed - Failed to query inventory: IabResult: Error refreshing inventory (querying owned items). (response: 6777017:Error)

I had to completely uninstall the purchase plugin (ionic plugin rm cc.fovea.cordova.purchase) and reinstall it (ionic plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="..."). After reinstalling the plugin the error was resolved.

pooblej commented 7 years ago

My solution was to use the intel xdk and used

Githubissues.
  • Githubissues is a development platform for aggregating issues.