inAppPurchase
进程:主进程
模块触发以下事件:
一个或多个 transactions 更新时会触发这一事件。
返回:
event
Eventtransactions
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 (可选) - 用户所要购买的商品数量.ReturnsPromise<Boolean>
- Returnstrue
if the product is valid and added to the payment queue.
在调用purchaseProduct
之前,你应该尽可能快的监听事件
productIDs
String[] - 预购商品IDcallback
Function - 当商品不存在时,被商品对象或空数组调用的回调products
Product[] -Product
对象的数据检索商品的描述
inAppPurchase.getProducts(productIDs)
productIDs
String[] - 预购商品IDReturnsPromise<Product[]>
- Resolves with an array ofProduct
objects.
检索商品的描述
inAppPurchase.canMakePayments()
返回 Boolean
, 用来判断用户是否可以发起支付.
返回 String
, 指收据路径.
inAppPurchase.finishAllTransactions()
完成所有待处理的交易