appStorePurchase

类型 事件
分派链 Runtime
修订版 发行版 2024.3703
关键字 Apple、IAP、应用内购买、App Store 推广购买
另请参阅 store.deferStorePurchases()
store.proceedToPayment
store.*

概述

App Store 购买被延迟并发送给通过 store.deferStorePurchases() 设置的侦听器时会生成此事件。

属性

event.name

始终设置为 "appStorePurchase"

event.product

productList.products 条目相同的商品描述。

event.payment

此值可传递给 store.proceedToPayment 以显示付款请求。它还包含以下字段

event.payment.type

始终为 "payment"

event.payment.productIdentifier

商品标识符

以及其他模拟 SKPayment 字段的可选字段。

示例

local store = require( "store" )

local function transactionListener( event )
    -- ...
end
store.init( transactionListener )


local function deferredPurchases(event)
    local payment = event.payment

    -- Tore `payment` somewhere and when time is right call
    store.proceedToPayment(payment)
end
store.deferStorePurchases(deferredPurchases)