PurchaseRequest containing the product ID, placement ID, and optional promotional offer ID. Use it to trigger the purchase via your subscription manager (e.g. StoreKit, RevenueCat).
Signature
Return
true on success. Returning true tells Encore the purchase completed, and Encore auto-dismisses the offer sheet. Return false (or throw) when the purchase was cancelled or failed — the sheet stays up so the user can retry. A thrown error is caught by the SDK and treated as false.A legacy ... async throws -> Void overload also exists but is deprecated: it can’t signal success/failure reliably, so dismiss behavior is less predictable. Always use the Bool-returning form.Parameters
PurchaseRequest Properties
Returns
@discardableResult — returns the Encore instance for chaining (.onPurchaseRequest { … }.onPassthrough { … }).
When It Fires
Usage
- StoreKit
- RevenueCat
- Adapty
- Qonversion
- Custom
Chained with onPassthrough
The handler is an
async throws -> Bool function, so you can await other async APIs (StoreKit, network requests) directly inside it. Return true once the purchase succeeds so Encore dismisses the offer sheet.When no
onPurchaseRequest handler is set, Encore handles purchases via native StoreKit 2 automatically.
Use onPurchaseComplete to sync these transactions with providers that don’t auto-detect StoreKit transactions (e.g., Adapty, Qonversion).