inAppPurchase
进程:
inAppPurchase
模块触发以下事件:
一个或多个 transactions 更新时会触发这一事件。
返回:
event
Eventtransactions
Transaction[] - Array ofTransaction
objects.
方法
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
之前,你应该尽可能快的监听transactions-updated
事件
Returns Promise<Product[]>
- Resolves with an array of objects.
检索商品的描述
Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.
The payment queue delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.
inAppPurchase.getReceiptURL()
Returns String
- the path to the receipt.
完成所有待处理的交易
inAppPurchase.finishTransactionByDate(date)
date
String - 待完成交易的ISO标准日期格式