Overview
Encore allows you to present targeted offers to users in exchange for rewards (free trials, discounts, credits) at critical moments like cancellation flows or feature paywalls. The SDK uses a delegation pattern — you register purchase and passthrough handlers, then call.show() wherever you need an offer.
Present Offers
Presenting an Encore offer is a single line. The facade is@MainActor, and show() presents on the main thread automatically:
Register handlers before presenting. See Handle Offer Results below.
Observing the outcome
The fire-and-forgetshow() above hands control to your registered handlers. If you’d rather branch on the outcome at the call site, use the async form — it returns a PresentationResult. Because a SwiftUI Button action is synchronous, wrap the await in a Task:
show() only throws for genuine transport/SDK failures. A user dismissal is .notGranted(...), not a thrown error.Handle Offer Results
Register handlers that tell the SDK how to complete purchases and what to do when a user dismisses. Register these once at app launch, afterconfigure().
Register onPurchaseRequest
Called when a user accepts an offer. Use this to trigger a purchase via StoreKit, RevenueCat, Adapty, or your own billing implementation. Return true on success — Encore then auto-dismisses the offer sheet. Return false (or throw) to keep the sheet up so the user can retry.
Register onPassthrough
Called when the user dismisses the offer or no offers are available. Use this to resume the user’s original action (e.g., proceed with cancellation).
onPurchaseComplete (Optional)
Only needed when you don’t set an onPurchaseRequest handler, or when integrating with subscription managers that don’t auto-detect purchases (e.g., Adapty, Qonversion). RevenueCat and Superwall auto-detect purchases and don’t need this callback.
The handler receives the verified StoreKit transaction and the productId (in that order):
Summary
| Callback | When it fires | Required? |
|---|---|---|
onPurchaseRequest | User accepts the offer | Yes |
onPassthrough | User dismisses or no offers available | Yes |
onPurchaseComplete | Purchase finishes (for managers that don’t auto-detect) | Optional |
Both
onPurchaseRequest and onPassthrough must be registered before presenting any placements.Third-Party Paywall Integrations
For Superwall and RevenueCat integrations, see the dedicated guides:Using Superwall
Trigger Encore from Superwall paywalls and dismissals
Using RevenueCat
Trigger Encore from RevenueCat paywalls and dismissals
What a Grant Looks Like
When a user accepts an offer, Encore grants the entitlement in two phases: a provisional grant for instant UX (visible immediately), then a verified grant once the backend confirms the transaction. Provisional grants can later be revoked if verification fails. Gate reversible UI (unlocking a screen, hiding an upsell) on the broad.all scope; gate irreversible or expensive grants on .verified. See EntitlementScope — Two-phase entitlements for the full model.
Next Steps
- Add Subscription Product - Create an App Store subscription product and connect it to Encore
- Configure Analytics - Track offer performance and measure impact