inAppPurchase

    进程:主进程

    模块触发以下事件:

    一个或多个 transactions 更新时会触发这一事件。

    返回:

    • event Event
    • transactions Transaction[] - Array of objects.

    方法

    inAppPurchase.purchaseProduct(productID, quantity, callback)

    • productID String - 预付款商品的ID (com.example.app.product1 的ID是 product1).
    • quantity Integer (可选) - 用户所要购买的商品数量.

    即将弃用

    inAppPurchase.purchaseProduct(productID, quantity)

    • productID String - 预付款商品的ID (com.example.app.product1 的ID是 product1).
    • quantity Integer (可选) - 用户所要购买的商品数量.Returns Promise<Boolean> - Returns true if the product is valid and added to the payment queue.

    在调用purchaseProduct之前,你应该尽可能快的监听事件

    • productIDs String[] - 预购商品ID
    • callback Function - 当商品不存在时,被商品对象或空数组调用的回调

      • products Product[] - Product 对象的数据检索商品的描述

    inAppPurchase.getProducts(productIDs)

    • productIDs String[] - 预购商品IDReturns Promise<Product[]> - Resolves with an array of Product objects.

    检索商品的描述

    inAppPurchase.canMakePayments()

    返回 Boolean, 用来判断用户是否可以发起支付.

    返回 String, 指收据路径.

    inAppPurchase.finishAllTransactions()

    完成所有待处理的交易

    inAppPurchase.finishTransactionByDate(date)