Contents

intents

The asynchronous sequence that emits a purchase intent when customers initiate a purchase outside of the app.

Declaration

static var intents: PurchaseIntent.PurchaseIntents { get }

Mentioned in

Discussion

Your app receives a purchase intent when customers initiate a purchase outside of your app by selecting a promoted product on the App Store, or redeeming a win-back offer. Use the product object to complete your app’s purchase workflow, including finishing the purchase, unlocking the product, and any other workflows specific to your app.

The following example code receives the purchase intent, and calls a method to complete the purchase workflow:

func purchaseProduct(_ product: Product) async {
    // Complete the purchase workflow.
    do {
        try await product.purchase()
    }
    catch {
        // Add your code to handle errors.
    }
    // Add your code for the remaining purchase workflow.
}

for await purchaseIntent in PurchaseIntent.intents {
    // Receive the purchase intent and then complete the purchase workflow.
    await purchaseProduct(purchaseIntent.product)
}

See Also

Getting purchase intents