Documentation Index
Fetch the complete documentation index at: https://docs.encorekit.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Encore.placement(id).show() returns a Promise<PresentationResult>. The Web SDK does not expose global onPurchaseRequest / onPassthrough handlers — browsers handle the purchase flow directly via redirects to advertiser URLs, so there’s no purchase-delegation contract to register.
Instead, you have two ways to react to a placement resolving:
- Async-result —
await show()and branch on the returnedPresentationResult. - Per-placement callbacks — chain
.onGranted(...),.onNotGranted(...),.onLoadingStateChange(...)on the placement builder before calling.show().
Async-result pattern
The most direct shape —await the call and branch locally.
Result type
Per-placement callbacks
Same shape as the async-result pattern, but expressed as chained callbacks. Useful when you want to read top-to-bottom or attach cross-cutting telemetry.onGranted / onNotGranted / onLoadingStateChange are scoped to this placement call. They aren’t global and don’t persist across calls.
See placement() and presentOffer().
When to use which
- Async-result — call site already has access to your post-grant + post-decline logic. The most common shape.
- Per-placement callbacks — fluent style; useful when you also want to react to loading state (
onLoadingStateChange) for spinners. - Both — you can chain callbacks and
awaitthe result. The callbacks fire first, then the promise resolves.
Why no global handlers?
iOS, Android, RN, and Flutter SDKs exposeonPurchaseRequest because their host environments need to delegate the actual purchase to a billing library (StoreKit, Play Billing, RevenueCat, etc.). The Web has no equivalent: when a user accepts a Web offer, the SDK opens the advertiser’s URL directly. There’s nothing to delegate.
If you need cross-cutting telemetry across many placements, wrap show() in a small helper:
Platform-specific notes
- No
Encore.shared— Web uses the default-exportedEncoreobject directly:Encore.configure(...),Encore.placement(id).show(). - Per-placement callbacks are scoped to the call — they don’t persist. Set them on every
placement()call where you need them, or wrap in a helper. - Backend validation matters — entitlements granted client-side should be validated server-side. See Track Entitlements.
- Framework integration — see the per-framework guides: React, Vue, Angular, Svelte, Next.js, Vanilla JS.
See also
- Concepts — Integration Patterns — cross-platform decision tree
- Quickstart — Present Offers — full presentation walkthrough
- SDK Reference —
placement() - SDK Reference —
presentOffer() - Framework Integration — per-framework patterns