Closed CyrilleGuimezanes closed 6 years ago
Try calling refresh only after registering your products. Does that work?
I tried to remove refresh on ready event but no working...
Sorry, I re-read your code. You should get the product information from within a store.when
callback:
store.when("product").loaded(function(product) {
console.log(product);
});
store.when("product").updated(function(product) {
console.log(product);
});
Try adding these two callbacks with the query "product"
before calling store.refresh
and see if your product is loaded.
I wrote this:
store.verbosity = store.DEBUG;
store.ready(function() {
alert("Ready!");
});
store.register({
id: PREMIUM_PACK1_ID,
alias: "myalias",
type: store.NON_CONSUMABLE
});
store.when(PREMIUM_PACK1_ID).loaded(function(product) {
alert("Price1:"+ product.price);
});
store.when(PREMIUM_PACK1_ID).updated(function(product) {
alert("Price2:"+ product.price);
});
store.refresh();
I get the alert("Ready!"); but I never get any of "loaded" or "updated" event
As a last resort you could try:
store.when("product")
or
store.when("myalias")
No luck :(
Any idea @j3k0 ?
Ok, after some debug I am able to get the product prices but only after a call to 'order(id)' method.
I would like to get prices at ready state to be able to show a button with labels like: "My great object - $5" or "Mon super objet - 5€ " according to the user language...
I'm open to call a method to force the refresh if needed...
I reopen because I have new inputs that tells me that there is a trouble on the plugin:
I have now 6 registred products, I bought 2 of them. I get these logs:
STEP1: I register products (These line repeat for each product)
store.queries !! 'bargainadv.pack.premium1 registered'" store.queries !! 'product_0 registered'" store.queries !! 'non consumable registered'" store.queries !! 'registered'" store.queries !! 'bargainadv.pack.premium1 updated'" store.queries !! 'product_0 updated'" store.queries !! 'non consumable updated'" store.queries !! 'updated'"
STEP 2: I register 3 callback foreach product
queries ++ 'bargainadv.pack.premium3 loaded'" queries ++ 'bargainadv.pack.premium3 updated'" queries ++ 'bargainadv.pack.premium3 owned'"
STEP3 : I call refresh method
store.trigger -> triggering action refreshed" queries !! 'refreshed'" refresh -> checking products state (6 products)" refresh -> product id bargainadv.pack.premium3 (product_0)" in state 'registered'"
STEP4: Re-reshesh is called internaly and get product as owned
store.trigger -> triggering action re-refreshed" queries !! 're-refreshed'" android -> product data for bargainadv.pack.building3" {"orderId":"GPA.1324-4427-2340-25831","packageName":"com.luditeam.nego","productId":"bargainadv.pack.building3","purchaseTime":1454099703901,"purchaseState":0,"purchaseToken":"....","receipt":"{\"orderId\":\"...\",\"packageName\":\"com.luditeam.nego\",\"productId\":\"bargainadv.pack.building3\",\"purchaseTime\":1454099703901,\"purchaseState\":0,\"purchaseToken\":\"..."}"}" store.queries !! 'bargainadv.pack.building3 approved'" store.queries !! 'product_0 approved'" store.queries !! 'bargainadv.pack.building3 updated'"
STEP5: I print the events recevied, here, only updated is called and I have no price and owned state is false (I bougth this product)
I/chromium( 7600): [INFO:CONSOLE(18)] "UPDATED: ProductId: bargainadv.pack.building3 price: null Owned:false"
Also, Good to know when I call: store.inappbilling.getAvailableProducts (internal function) I get the two product I owned with the prices.
Any idea?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello,
In my app, created with Cordova, I would like to do IAP and show prices with local currency.
On the documentation I have:
And I wrote:
Some informations:
Did I miss something?
Regards,