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<PlacementResult>. You can either await it and branch on the returned value (async-result) or register global onPurchaseRequest / onPassthrough handlers (handler-based). Both work; pick whichever fits the call site.
For the cross-platform decision tree, see Integration Patterns.
Async-result pattern
Use this when the component that triggersshow() already has access to your purchase + decline logic.
Basic example
From a component
Result type
granted / not_granted; Android surfaces completed / dismissed / no_offers. Treat both grant cases (granted, completed) as success and the rest as decline.
See PlacementResult.
Handler pattern
Use this whenshow() is invoked from many sites that share post-purchase logic, or when the trigger is far from your billing code.
Register at app startup
Then show() from anywhere
When to use which
- Async-result — component already imports your billing client. Branch-specific code lives at the call site.
- Handler — registered once at app root; many
show()sites share the same purchase delegation. - Mixed — register handlers for cross-cutting telemetry; still
await show()for site-specific UI navigation.
Re-registration semantics
currentSubscription?.remove() before adding the new listener — there is no double-fire. The returned unsubscribe function is useful for component lifecycles (call from a useEffect cleanup) but is not required to prevent double-fires when you replace via re-registration.
Platform-specific notes
- Status values vary by platform — iOS surfaces
granted/not_granted; Android surfacescompleted/dismissed/no_offers. Code that handles both cases is portable. - Event-emitter under the hood — handlers are wired via
NativeEventEmitter, but the JS API has replace semantics on the JS side as well. You don’t need to manuallyremovelisteners between re-registrations. completePurchaseRequestis required — unlike iOS / Android native SDKs whereonPurchaseRequestsimply throws or returns, RN’s bridge needs an explicit ack. Always call it.- Provider — wrap your root in
<EncoreProvider apiKey="...">so the bridge is configured before anyshow()call.
See also
- Concepts — Integration Patterns — cross-platform decision tree
- Quickstart — Present Offers — handler-pattern walkthrough
- SDK Reference —
placement() - SDK Reference —
PlacementResult - SDK Reference —
completePurchaseRequest()