Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

In App Purchase 2

Improve this doc

Repo: https://github.com/j3k0/cordova-plugin-purchase

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="<ANDROID_BILLING_KEY>"
    $ npm install --save @ionic-native/in-app-purchase-2@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2';


constructor(private inAppPurchase2: InAppPurchase2) { }

...

Instance Members

QUIET

ERROR

WARNING

INFO

DEBUG

verbosity

Debug level. Use QUIET, ERROR, WARNING, INFO or DEBUG constants

sandbox

Set to true to invoke the platform purchase sandbox. (Windows only)

FREE_SUBSCRIPTION

PAID_SUBSCRIPTION

NON_RENEWING_SUBSCRIPTION

CONSUMABLE

NON_CONSUMABLE

ERR_SETUP

ERR_LOAD

ERR_PURCHASE

ERR_LOAD_RECEIPTS

ERR_CLIENT_INVALID

ERR_PAYMENT_CANCELLED

ERR_PAYMENT_INVALID

ERR_PAYMENT_NOT_ALLOWED

ERR_UNKNOWN

ERR_REFRESH_RECEIPTS

ERR_INVALID_PRODUCT_ID

ERR_FINISH

ERR_COMMUNICATION

ERR_SUBSCRIPTIONS_NOT_AVAILABLE

ERR_MISSING_TOKEN

ERR_VERIFICATION_FAILED

ERR_BAD_RESPONSE

ERR_REFRESH

ERR_PAYMENT_EXPIRED

ERR_DOWNLOAD

ERR_SUBSCRIPTION_UPDATE_NOT_AVAILABLE

REGISTERED

INVALID

VALID

REQUESTED

INITIATED

APPROVED

FINISHED

OWNED

DOWNLOADING

DOWNLOADED

INVALID_PAYLOAD

CONNECTION_FAILED

PURCHASE_EXPIRED

products

validator

log

get(idOrAlias)

Get product by id or alias

Param Type Details
idOrAlias

error(onError)

Register error handler

Param Type Details
onError Function

function to call on error

register(product)

Add or register a product

Param Type Details
product IAPProductOptions

when(query, event, callback)

Param Type Details
query
event
callback

Returns: IAPProductEvents

once(query, event, callback)

Identical to when, but the callback will be called only once. After being called, the callback will be unregistered.

Param Type Details
query string|IAPProduct
event event

Optional

callback IAPQueryCallback

Optional

Returns: IAPProductEvents

off(callback)

Unregister a callback. Works for callbacks registered with ready, when, once and error.

Param Type Details
callback Function

order()

ready()

refresh()

API

Native

General