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.
Handle Offer Results
Before presenting offers, register handlers that tell the SDK how to process purchases and what to do when a user dismisses. Register these once inApplication.onCreate(), after configure().
Register onPurchaseRequest
Called when a user accepts an offer. Use this to trigger a purchase via Google Play Billing, RevenueCat, Adapty, or your own billing implementation.
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.
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.Presenting an Offer
With Coroutines (Recommended)
Fire-and-Forget
For cases where you don’t need to await the result:onPurchaseRequest handler fires. When they dismiss or no offers are available, onPassthrough fires.
Placement IDs
Use meaningful placement IDs to track where offers are triggered in your app:Next Steps
- Add Subscription Product - Create a Google Play subscription product and connect it to Encore
- Configure Analytics - Track offer performance and measure impact