Namespaces
Events
-
On purchase
-
Allows to listen to events about the purchasing process.
- The callback 'start' receives a parameter the product id of the product being purchased when the purchase of a product starts.
- The callback 'complete' receives as parameter the Cocoon.InApp.PurchaseInfo object of the product being purchased when the purchase of a product is completed.
- The callback 'error' receives a parameters the product id and an error message when the purchase of a product fails.
Example
Cocoon.InApp.on("purchase", { start: function(productId) { console.log("purchase started " + productId); }, error: function(productId, error) { console.log("purchase failed " + productId + " error: " + JSON.stringify(error)); }, complete: function(purchase) { console.log("purchase completed " + JSON.stringify(purchase)); } });