Closed gfragioud closed 8 years ago
this will return the product state to OWNED
store.when("product").updated(function(product) {
if(product.loaded && product.valid && product.state === store.APPROVED) {
product.finish();
}
});
Thanks for your reply but I can't get how this would help.
My products are apple hosted, so I call product.finish() inside when().downloaded(). The state changes to owned as it should but when user reinstalls the app or install it in a new device, all products are valid and not owned.
in this case you need to change products state that already purchased from approved to owned in the update query.
var products = ['p0','p1','p2'];
for (var i = 0; i < products.length; i++) {
pro = {
id: products[i],
type: store.NON_CONSUMABLE
};
store.register(pro);
}
store.refresh();
store.when("product").updated(function(product) {
if(product.loaded && product.valid && product.state === store.APPROVED) {
product.finish();
}
});
$scope.buy = function(product_id) {
store.once(product_id).approved(function (product) {
console.log("You've purchased the content for " + product.id + " - it will now download to your device!");
});
store.when(product_id).downloading(function(product) {
});
store.when(product_id).downloaded(function (product) {
product.finish();
});
store.order(product_id);
}
Thank you for your suggestion but unfortunately it didn't make the magic. After app installation, all products (both purchased & not purchased) are loaded as not owned.
Is there any chance this happens only in debugging mode and not in production?
that what i did on android ! . what the product state for purchased products after installation ?
All are in state "valid"...
and transaction ?
What do you mean? There is no transaction. I want to check the ownership of the product before proceed to purchase (order)...
the transaction for purchased products should not be null.
I just checked it and it is null for all products...
hi @gfragioud , could you help me on ios ?
Probably... What's your problem exactly?
my app got rejected by apple because in app purchase not working.
I have created NON_CONSUMABLE products in iTunes Connect, but when use
store.register({id:'p4', store.NON_CONSUMABLE})
and
store.get('p4');
all details are null.
should submit the app with in-app purchase products to get products details ? or just create them and do store.register() and store.get() to get detail of product(price, title, ...) ? .
all invalid ! {"id":"p11","alias":"p11","type":"non consumable","state":"invalid","title":null,"description":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"transaction":null,"valid":false}
Does it matter if the "In-App Purchase" hasn't been submitted for review? Does it have to be accepted even during the testing stage?
Apparently the IAP only has to be entered into iTunes Connect and afterwards the testing API from Apple is supposed to return the proper data to this plugin (there used to be a 24 hour delay or something) but I have not been able to get a product to return a "ready for purchase" or whatever the status it has to be in for this plugin to work. There are no actual working examples that I can find of this plugin.
@AbuHani @Createstandard Thousands of apps use this plugin successfully, be assured that it does work on iOS.
Here's a partial checklist:
@j3k0 Thank you, the problem was no Paid Apps contract in effect.
Hello and thank you for this great plugin.
I need help with ownership of products in iOS. Products are being purchased and finished properly. I checked that .owned is true after the finished transaction. I also checked that .owned remains true after kill+reopen the app. All perfect until this point.
The problem occurs when user changes device or reinstalls the app. I sell books inside my app separately and in bundles. So before purchase a book I want to check if user already owns the bundle that contains this book, and if yes cancel the purchase. And the opposite. BUT in this initial state all products seem as not owned.
I don't want to force user to perform a "restore purchases" after app installation, so I am looking a better solution to handle this.
Any suggestion?