> ## 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.

# placement()

> Present Encore offers to users via a fluent builder API

## Purpose

Create and present Encore offers using a fluent builder API. Fetches available offers for the current user and presents them in a native offer sheet.

## Signature

```kotlin theme={null}
// Create a placement
fun placement(id: String? = null): PlacementBuilder

// Present the offer (suspend)
suspend fun PlacementBuilder.show(): PresentationResult

// Present the offer (fire-and-forget)
fun PlacementBuilder.show(scope: CoroutineScope)
```

## PlacementBuilder Methods

| Method        | Parameters              | Description                                                                                                     |
| ------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------- |
| `placement()` | `id: String?`           | Creates a placement with optional identifier. If omitted, auto-generates a unique ID                            |
| `show()`      | —                       | Suspending — fetches offers and presents the offer sheet. Returns [`PresentationResult`](./presentation-result) |
| `show()`      | `scope: CoroutineScope` | Fire-and-forget — launches `show()` in the provided coroutine scope                                             |

## Returns

`show()` returns a [`PresentationResult`](./presentation-result):

| Result                         | Description                                            |
| ------------------------------ | ------------------------------------------------------ |
| `PresentationResult.Completed` | User completed an offer flow (tapped CTA, opened link) |
| `PresentationResult.Dismissed` | User dismissed the offer sheet without completing      |
| `PresentationResult.NoOffers`  | No offers were available for this user / placement     |

## Usage

### Suspend (recommended)

```kotlin theme={null}
lifecycleScope.launch {
    val result = Encore.placement("cancel_flow").show()

    when (result) {
        is PresentationResult.Completed -> {
            Log.d("Encore", "Offer completed: ${result.offerId}")
        }
        is PresentationResult.Dismissed -> {
            Log.d("Encore", "Dismissed: ${result.reason}")
            proceedWithCancellation()
        }
        is PresentationResult.NoOffers -> {
            proceedWithCancellation()
        }
    }
}
```

### Fire-and-forget

```kotlin theme={null}
// When you don't need the result — handlers via onPurchaseRequest/onPassthrough
Encore.placement("cancel_flow").show(lifecycleScope)
```

### With named placement for analytics

```kotlin theme={null}
// Placement ID appears in your analytics and global listeners
Encore.placement("onboarding_upsell").show(lifecycleScope)
Encore.placement("cancel_flow").show(lifecycleScope)
Encore.placement("settings_upgrade").show(lifecycleScope)
```

<Tip>
  Provide a descriptive placement ID to identify this specific placement in your analytics. If omitted, a random ID is generated.
</Tip>

<Info>
  The `show()` suspend variant throws `EncoreError.Integration.NotConfigured` if the SDK hasn't been configured. The fire-and-forget variant catches and logs errors internally.
</Info>
