Adapter for a payment or in-app purchase platform

Implements

Constructors

Properties

autoRefreshIntervalMillis: number = 0

The GooglePlay bridge

canSkipFinish: boolean = true

Returns true if the adapter can skip the native finish method for a transaction.

Some platforms (e.g. Apple AppStore) require explicit acknowledgement of a purchase so it can be removed from the queue of pending transactions, regardless of whether the transaction is acknowledged or consumed already.

id: Platform = Platform.GOOGLE_PLAY

Adapter identifier

initialized: boolean = false

Prevent double initialization

name: string = 'GooglePlay'

Adapter name

ready: boolean = false

Has the adapter been successfully initialized

retry: Retry<Function> = ...

Used to retry failed commands

supportsParallelLoading: boolean = false

Set to true if receipts and products can be loaded in parallel

trimProductTitles: boolean = true

Accessors

  • get isSupported(): boolean
  • Returns true on Android, the only platform supported by this adapter

    Returns boolean

Methods

  • Find a purchaseToken for an owned product in the same group as the requested one.

    Parameters

    • productId: string

      The product identifier to request matching purchaseToken for.

    • Optional productGroup: string

      The group of the product to request matching purchaseToken for.

    Returns undefined | string

    A purchaseToken, undefined if none have been found.

  • Finish a transaction.

    For non-consumables, this will acknowledge the purchase. For consumable, this will acknowledge and consume the purchase.

    Parameters

    Returns Promise<undefined | IError>

  • Refresh purchases from GooglePlay

    Returns Promise<undefined | IError>

  • Prepare the list of SKUs sorted by type

    Parameters

    Returns {
        inAppSkus: string[];
        subsSkus: string[];
    }

    • inAppSkus: string[]
    • subsSkus: string[]
  • Initializes a platform adapter.

    Will resolve when initialization is complete.

    Will fail with an IError in case of an unrecoverable error.

    In other case of a potentially recoverable error, the adapter will keep retrying to initialize forever.

    Returns Promise<undefined | IError>

  • Open the platforms' billing management interface.

    Returns Promise<undefined | IError>

  • Parameters

    • result: "OK" | "UserCanceled" | "UnknownProduct"

    Returns void

  • Called by the bridge when a purchase has been consumed

    Parameters

    Returns void

  • Called when the platform reports updates for some purchases

    Notice that purchases can be removed from the array, we should handle that so they stop being "owned" by the user.

    Parameters

    Returns void

  • Called when the platform reports some purchases

    Parameters

    Returns void

  • Replay the queue of transactions.

    Might ask the user to login.

    Returns Promise<undefined | IError>