Skip to main content
Registers a listener invoked when Encore’s offer flow completes and a purchase is needed. The listener receives the product ID and placement ID and should trigger the purchase via your billing library.
You must call completePurchaseRequest() in every code path of your handler — both success and failure. Failing to do so will block the SDK from presenting future offers until the app restarts.

Signature

Parameters

PurchaseRequestEvent

Returns

An unsubscribe function. Call it to remove the listener.

When It Fires

Usage

Every code path must call completePurchaseRequest(). If your handler throws without calling it, the SDK will remain locked until the app restarts. Always use try/catch.

With onPassthrough

Clean up listeners when your component unmounts by calling the unsubscribe function in a useEffect cleanup.