Closed Sanafan closed 5 years ago
@Sanafan Same problem here.
Any developments on this? Seems like store.refresh() doesn't do anything on android? Are you encountering this on android or iOS? iOS works fine for me.
Hello! Same here. I also have not been able to find the 'official' guide to restore purchases, as no code related is included in the guides (minimal and complete example), so I can't be sure to have developed the right flow.
Anyone could point me to a guide? I would appreciate it
You have to call store.refresh() again in your restore button. It seems to require this after the initial call. This is loosely documented.
@aesculus You sure? I am going to do this and send again for review. All fingers crossed hope it works
b>@sarahsga</b: I am in the same place as you are. I thought at first that it worked on its own but either it stopped or did not work like I thought it did. I had 4 apps submitted to Apple that are exactly the same, just different content. Three of them passed but the 4th the reviewer complained because my restore was really causing the user to repurchase the feature but then they were told they have already paid for them.
So I went back and looked over the documentation again and noticed that the restore example stated that you would need to call refresh again. Actually it was more like you should limit your calls to refresh since it fires all sorts of events and is wasteful. The example was how it could be used in a restore feature.
So I rebuilt the app where my restore calls store.refresh. This causes the triggers of the products etc to fire and the second time it shows the product as owned. Problem solved.
So all 4 apps are back to Apple for review. Lets hope it takes this time.
@aesculus I believe it works as i just tested it. Resubmitting the app. I will post here when I receive a response from apple. Thanks a lot!
I just got all my apps approved by Apple with this technique.
@aesculus do you show some type of loading screen and hide and/or notify the user when all of their transactions have been run through the verify process? I hate to just call store.refresh() and let the user sit and wait with no visible object. I have multiple paid subscriptions and cannot seem to find a callback that executes when the refresh is completed.
Well not exactly but similar. First off my restore button will error if the store is not online. Then if it is only I call store.refresh() and then post a message that I requested all the features purchased to be restored. The product updates when the store.when("manual").updated(function (product) {}); fires.
I had messages there but decided to take them out as it was too busy.
Note my IAP just turns on already installed content so there is not lag to actually download anything.
@aesculus My app got rejected again, same reason :( I have added a button in my side menu, called"Restore Purchase", which calls store.refresh() when clicked. And I have checked it, the restore mechanism works perfectly, calling store.refresh() restores purchases made in previous installations of the app. Still, app got rejected and the reason provided was same.
Where did you put your restore button? Did you make a new button called "Restore Purchase", or did you let the user click on a locked item, and then have a popup appear asking for restoration of previous purchases?
@aesculus Got my app approved! :)
This is what I'm finding to happen. I'll call store.refresh()
which will find that there is prior purchase, like so:
[store.js] INFO: ios -> restored purchase com.ionicframework.id.0
[store.js] INFO: ios -> restore completed
[store.js] INFO: ios -> transaction 1000000162734239 purchased (1 in the queue for com.ionicframework.id.0)
But then when I use store.get(product)
it returns owned: false
?
SOLUTION:
Make sure to use updated
not loaded
as the loaded
event will not fire when calling the second store.refresh()
as referenced in this issue https://github.com/j3k0/cordova-plugin-purchase/issues/184
@aesculus I am experiencing this issue and calling sore.refresh() a second time from a "Restore Purchases" button does not seem to work for me (for a non-consumable). This is on iOS.
I registered all required callbacks including "updated" (per product). All the events fire on first call to sore.refresh() but none is called on the second call. Although, the second call causes the phone to prompt for "Sign In to iTunes Store" dialog. But signing-in does not seem to do anything.
Do I need to update the inapp purchase plugin, maybe?
I am currently running ver 3.11.0, downloaded with "cordova plugin add https://github.com/j3k0/cordova-plugin-purchase.git"
Any help appreciated.
I found the problem. I was not handling the "approved" event properly during the second call to store.refresh(). All is now working fine after I added the below event and called product.finish() in the listener function "approveFn".
store.once("product").approved(approveFn);
so @okeyto may you please share your solution for restoring purchases.
@okeyto or @aesculus are you able to share your solution for restoring purchases. It would be much appreciated. Thanks,
Here is the steps to make the Restore Purchases work:
<button onclick="restorePurchases()">Restore Purchases</button>
function restorePurchases (){
store.refresh();
store.when(“the.product.id”).approved(function (order) {
order.finish();
});
}
After click the Restore Purchases button, restorePurchases will do the store.refresh, and the owned
property in the return will be true
, if the product had been purchased. Then, you can update the owned info in the html.
See #414.
I called store.refresh(). but nothing happened, store.when(appid).approved not trigged either.
In my xcode log, I can see
2016-03-20 16:09:32.185 mathwp[17752:11973484] InAppPurchase[objc]: Request to refresh app receipt 2016-03-20 16:09:32.187 mathwp[17752:11973484] InAppPurchase[objc]: Starting receipt refresh request... 2016-03-20 16:09:32.187 mathwp[17752:11973484] InAppPurchase[objc]: Receipt refresh request started 2016-03-20 16:09:32.571 mathwp[17752:11973484] InAppPurchase[objc]: Got refreshed receipt 2016-03-20 16:09:32.574 mathwp[17752:11973484] InAppPurchase[objc]: Send new receipt data
Same here. I am trying to restore a purchased NON_CONSUMABLE product. The product has the field canPurchase=false but "approved" event is not triggered after calling store.refresh(), I have tried calling it several times still nothing happens. I am on Android 6.0.1
I would recommend to don't waste your time with this plugin. I did change to another one that works as expected without too much headache.
That plugins is: https://github.com/AlexDisler/cordova-plugin-inapppurchase
That's the one that I've used for Quizionic 2 app to handle consumables and no-consumables.
Have a look at it here: https://codecanyon.net/item/quizionic2-ionic2-app-template-w-sqlite-admob-inapppurchase/18182426
Regards, Flavio
On Wed, Mar 29, 2017 at 2:41 PM, HerbiShtini notifications@github.com wrote:
Same here. I am trying to restore a purchased NON_CONSUMABLE product. The product has the field canPurchase=false but "approved" event is not triggered after calling store.refresh(), I have tried calling it several times still nothing happens. I am on Android 6.0.1
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/j3k0/cordova-plugin-purchase/issues/221#issuecomment-290186060, or mute the thread https://github.com/notifications/unsubscribe-auth/AFcNciwz1vwJAcXI2KzXMimaL_M-k2owks5rqqXzgaJpZM4FDbs5 .
@fpassa I moved here from that plugin. I have implemented In-App purchase with the plugin you are suggesting, it was extremely easy to integrate but that plugin is no longer maintained and we are having issues on Android 6.0. We have released the app but it is not working on some devices and some users are complaining while for some others it works fine. That is not a solution in our case but I am also having a lot of trouble with this one, so far 2 major.
store.refresh not working at all and I can not restore products
I have spent countless hours to integrate this and still do not see a green light, I am not sure what to do now!
Thanks for your suggestion
@Herb-sh
Sorry, my fault. I was trying to meant this plugin instead: https://github.com/cranberrygame/cordova-plugin-payment-iap
Regards, Flavio
@fpassa Thanks for your help, I will check it out :)
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.
Hey Guys, just facing a problem. When i log in with another user into my application, and i want to restore the inApp-Purchases and call
store.refresh()
this is my output:After that nothing happens. No window appears which appears normaly and says "Thanks, your purchases were restored". Do i have to do anything else then calling
store.refresh()
? Of course i have to restore the purchases from my server, but i would like to do this after i got the message from the iTunes-Store that the restore was accepted.Just saw that product.transaction() gives me some details, but should i take those details like the transaction number and call a refresh then which would look for products with transaction ID X and restore them then?