appStorePurchase

Type Event
Dispatch chain Runtime
Revision Release 2024.3703
Keywords Apple, IAP, in-app purchases, App Store Promoted Purchases
See also store.deferStorePurchases()
store.proceedToPayment
store.*

Overview

This event is generated when App Store purchase is deferred and sent to listener set by store.deferStorePurchases().

Properties

event.name

Always set to "appStorePurchase".

event.product

Product description identical to productList.products entry.

event.payment

This value can be passed to store.proceedToPayment to show the payment request. It also contains following fields

event.payment.type

Always "payment"

event.payment.productIdentifier

Product identifier

And other optional fields mimicking SKPayment fields.

Example

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)