Skip to main content
Returns a fluent builder for presenting offers at a named placement. The id is attributed on the offers request; the options carry everything the presentation can be configured with.

Signature

All argument combinations work:

PlacementOptions

One flat shape. The composition is derived from useCase, never selected separately:

Field Reference

headline and subheadline here set the copy. appearance.headline and appearance.subheadline set how that copy looks, or replace the element entirely. They are different fields with the same names, and they compose: a non-blank appearance.headline.text beats this one, and everything else about the slot is styling. See Advanced UI.
| statusIcon | 'success' \| 'none' | 'none' | Status icon above the headline. Nothing renders unless you explicitly ask for 'success', which draws a green-circle check. Only the 'rewardUsers' composition has a status block to put it in; 'reduceChurn' renders the carousel bare and ignores this. The default is 'none' deliberately, and it matches the native SDKs: a success check is a payment-status icon, and a reward sheet has not finished anything yet, it is still asking the user to choose a gift. Opt in only for the rare integration that wants one. | | appearance | AppearanceConfig | Encore’s palette | Theme colors injected as custom properties, plus per-element overrides for the reward sheet. The full contract is on Advanced UI. |
The useCase symbols match the native SDKs verbatim (iOS .reduceChurn / .rewardUsers, Android REDUCE_CHURN / REWARD_USERS), so a cross-platform integration reads one vocabulary. The values Encore sends and stores are separate frozen labels, which is what keeps a rename from ever changing the wire. You never type a wire value here: passing one is rejected as an unrecognized use case.
Usage end to end: Reduce Churn at the Paywall (useCase: 'reduceChurn', the default) · Post-Purchase Placements (useCase: 'rewardUsers').

PlacementBuilder

useCase(useCase)

Sets which use case this placement serves. Equivalent to passing useCase in the options object, and composes with the other builder methods:
Default 'reduceChurn' if never called. See Reward Users for the full guide. A value other than 'reduceChurn' or 'rewardUsers' is an integration bug, not a normal decline: show() resolves dismissed with an INVALID_REQUEST error, and onNotGranted carries it. The builder has no onError equivalent, so use Encore.show()’s inline form if you need that callback too. See Errors.

headline(text) and subheadline(text)

Override the sheet’s copy for this presentation. Identical in effect to passing headline / subheadline in the options object, so pick whichever reads better at the call site:
Same precedence as the options fields: this copy beats what Encore resolved for your app, which beats the copy shipped with the screen. Blank or whitespace-only falls through rather than blanking the sheet, so a builder step can never erase copy by passing an empty string. A later call wins, including over a value passed to placement() itself. Both steps match the native SDKs’ .headline(...) / .subheadline(...), so a cross-platform integration reads the same at every call site.

onNotGranted(callback)

Fires when the sheet closes without a claim, carrying the dismissal reason (the same NotGrantedReason a dismissed result carries).

onLoadingStateChange(callback)

Fires true when the presentation starts loading and false when it settles; useful for spinners and disabling the triggering button. Callbacks are scoped to this builder instance; they don’t persist across calls.

show()

Presents the sheet with this placement’s options and resolves the ShowResult ('claimed' | 'dismissed' | 'unavailable'). It takes no arguments: everything a placement can be configured with lives in PlacementOptions, passed to placement() or set through the builder steps above. Never rejects.

Examples

Reduce churn at a named placement

Reward users at a moment your app detected

For celebrating a moment your app already detected (a completed purchase, a streak, a milestone): the Reward Users use case. useCase: 'rewardUsers' renders its own chrome, and headline / subheadline are the top of its copy chain: