titaniumtitanium-mobileappcelerator-titaniumtitanium-modules

Restore purchase using com.logicallabs.inappproducts


How do you restore a purchase using: com.logicallabs.inappproducts? I have been messing around with this all afternoon. I can purchase a product and restore it as if I were to buy it again, but can't figure out how to directly restore it.


Solution

  • You can get a list of purchased products with this:

    InAppProducts.addEventListener('receivedPurchases', function(e) {
       e.purchases.forEach(...
    });
    InAppProducts.getPurchases();
    

    Then when you find the product you're trying to restore, execute the same code that calls when you purchase it.

    Found in docs: http://docs.logicallabs.com/titanium-modules/in-app-products/android/modules/Readme.html