poiuytrez / AndroidInAppBilling

Android App Billing plugin for Cordova
173 stars 144 forks source link

refreshPurchases method added #102

Closed maxs15 closed 8 years ago

maxs15 commented 8 years ago

Hi @poiuytrez,

After using this plugin for some time, I noticed that some people for a mysterious reason had their payment processed successfully on the play store but not on my side. After some search, I found out that the success or fail callback of the buy method has never been called for these people and the product is not available in the list retrieved with the getPurchases method.

The only solution I currently found to fix this problem is to force refresh the list of owned products after a certain amount of time without any response from the callbacks and then consume/process the owned products if there is any.

The intend of this PR is to add the refreshPurchases method in order to be able to force refresh from the play store the list of the owned products. I also added the signature and receipt in the objects of the owned product list, that way the products can be processed (The success callback of the buy method already expose the signature and receipt of the purchased product).

Tested and works perfectly

poiuytrez commented 8 years ago

Thank you !