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

# onPassthrough()

> Handle not-granted outcomes (dismiss, no offers)

Registers a listener invoked for all not-granted outcomes — when the user dismisses the offer or no offers are available. This signals "Encore didn't result in a purchase — run your original button logic."

<Warning>
  Register `onPassthrough` before calling `show()`. If not set, the SDK will log a warning.
</Warning>

## Signature

```tsx theme={null}
onPassthrough(handler: (event: PassthroughEvent) => void): () => void
```

## Parameters

| Name      | Type                                | Description                              |
| --------- | ----------------------------------- | ---------------------------------------- |
| `handler` | `(event: PassthroughEvent) => void` | Callback receiving the passthrough event |

### PassthroughEvent

| Field         | Type    | Description                                |
| ------------- | ------- | ------------------------------------------ |
| `placementId` | string? | Which placement triggered this passthrough |

## Returns

An unsubscribe function. Call it to remove the listener.

## When It Fires

| Scenario                          | Fires?                                                |
| --------------------------------- | ----------------------------------------------------- |
| User dismisses without purchasing | Yes                                                   |
| No offer available for this user  | Yes                                                   |
| Network or system error           | Yes                                                   |
| User accepts an offer             | No — see [onPurchaseRequest()](./on-purchase-request) |

## Usage

### Cancel flow passthrough

```tsx theme={null}
const unsubscribe = Encore.onPassthrough(({ placementId }) => {
  switch (placementId) {
    case 'cancel_flow':
      proceedWithCancellation();
      break;
    case 'downgrade_flow':
      proceedWithDowngrade();
      break;
    default:
      console.log(`Passthrough for ${placementId}`);
  }
});
```

<Tip>
  Use `onPassthrough` to ensure your original button logic still runs when Encore doesn't intercept. For example, if a user taps "Cancel Subscription" and Encore has no offers, the passthrough handler lets you proceed with the cancellation flow.
</Tip>
