Skip to main content
Creates a placement builder for presenting offers. This is the recommended way to present offers — it matches the API pattern across all Encore SDKs.

Signature

placement(id?: string): PlacementBuilder

PlacementBuilder

class PlacementBuilder {
  show(): Promise<PlacementResult>
}

Parameters

NameTypeDescription
idstring (optional)The placement identifier configured in the Encore Dashboard. Defaults to empty string

Returns

PlacementBuilder.show() returns a PlacementResult object.

Usage

const result = await Encore.placement('cancellation_flow').show();

if (result.status === 'granted') {
  // User accepted the offer
} else {
  // User dismissed — proceed with original flow
}

With named placements for analytics

await Encore.placement('onboarding_upsell').show();
await Encore.placement('cancel_flow').show();
await Encore.placement('settings_upgrade').show();
Register onPurchaseRequest and onPassthrough handlers before calling show(). See onPurchaseRequest() and onPassthrough().