Skip to content

Latest commit

 

History

History
78 lines (65 loc) · 4.85 KB

pluginAPI.md

File metadata and controls

78 lines (65 loc) · 4.85 KB

Cordova-Plugin-InAppPurchases

PLUGIN USAGE

Calls should be done after cordova's onDeviceReady function is called.
The plugin creates an inAppPurchases object for you to make calls to the store.
The object is a promise-based API, click on each for more information on using the function.

Add these calls inside of your cordova javascript to make in-app purchases and subscriptions:

  • get a list of the products found on the app store for your app
  • use on the start up of the device (onDeviceReady) to edit UI and include prices from the app store
  • on iOS make sure to use this when the device loads in onDeviceReady before calling the other requests to set up the API

show price listings


  • get a list of the purchased products from the app store
  • use when device first loads in onDeviceReady, and onResume to update which products are currently owned
  • create a button, (for example in a settings section), called restore so that users can call this function themselves to restore their products, Apple requires a button

put a restore button somewhere

  • make a purchase (a one-time purchase or a subscription)
  • when this is sucessful (and not pending), call completePurchase
  • you can deliver the paid content right away after the first purchase call and revert it if the completePurchase fails, or deliver the paid content after the completePurchase goes through

buy an in app purchase or subscription from a button press

  • confirm the purchase
  • use right after purchasing
  • this "consumes" consumable products (able to buy it again) and "acknowledges" the products (if they are not acknowledged in Android, the purchase will be revoked after a few days)
  • FYI: this function is only needed on Android, as on iOS purchases are consumed during the inAppPurcahses.purchase(productId) call

buy an in app purchase or subscription from a button press

Tips:


go to main