Skip to main content

Overview

Encore works alongside Superwall so you can present retention offers at key moments in your paywall flow.

Presenting Offers

Option 1: On Paywall Dismissal

Trigger Encore when a user dismisses your Superwall paywall without converting:
import SuperwallKit
import Encore

class SWDelegate: SuperwallDelegate {
    func willDismissPaywall(withInfo paywallInfo: PaywallInfo) {
        // User dismissed without purchasing
        Encore.placement().show()
    }
}

Option 2: Custom Paywall Action

Create/Update the Superwall delegate to handle custom actions from your paywall:
import SuperwallKit
import Encore

class SWDelegate: SuperwallDelegate {
    func handleCustomPaywallAction(withName name: String) {
        if name == "EncoreTrigger" {
            Encore.placement("superwall_trigger").show()
        }
    }
}
Then, in the Superwall editor, add a custom action named “EncoreTrigger” to any button or element in your paywall.
See the SDK Reference for complete API details: placement()

Handle Offer Results

Register handlers at app launch so Encore can delegate purchases to Superwall.

Register onPurchaseRequest

Encore.shared.onPurchaseRequest { purchaseRequest in
    guard let product = try await Product.products(for: [purchaseRequest.productId]).first else { return }
    let result = try await product.purchase()
}
See onPurchaseRequest() for RevenueCat, Adapty, and other subscription manager examples.

Register onPassthrough

Called when the user dismisses the offer or no offers are available. Use this to resume the user’s original action.
Encore.shared.onPassthrough { placementId in
    // Resume your original user flow
}

Alternative: Automatic StoreKit Purchase

If you don’t set onPurchaseRequest, Encore purchases via native StoreKit 2 automatically. Superwall can observe these transactions automatically.

Setup

  1. Configure Superwall to observe purchases:
let options = SuperwallOptions()
options.shouldObservePurchases = true
Superwall.configure(apiKey: "YOUR_SW_KEY", options: options)
Observer mode requires iOS 17.2+ and disables Superwall.shared.purchase(). Purchases go through StoreKit directly.
No onPurchaseComplete handler is needed — Superwall auto-detects StoreKit transactions in observer mode.

Configure Analytics

Encore Webhook

Encore uses Apple’s App Store Server Notifications to track subscription lifecycle events and measure offer impact. See Configure Analytics for full setup instructions.
If Superwall already occupies your primary App Store Server Notifications URL, use the Forward from Your Server option to send notifications to both Superwall and Encore.

Superwall Webhook

If you’re using the Automatic StoreKit Purchase approach above, Superwall also needs to receive App Store Server Notifications to observe transactions. In App Store Connect, add the ASSN V2 webhook URL from your Superwall Dashboard. If Encore is your primary URL, forward notifications to Superwall from your server.