PurchaseRequest containing the IAP product ID, placement ID, and optional promotional offer ID, and should trigger the purchase via your subscription manager (e.g. RevenueCat, Google Play Billing).
Signature
Parameters
| Name | Type | Description |
|---|---|---|
handler | suspend (PurchaseRequest) -> Unit | Suspending callback receiving a PurchaseRequest. Trigger your purchase flow here. |
PurchaseRequest
| Property | Type | Description |
|---|---|---|
productId | String | The Google Play product identifier to purchase |
placementId | String? | The placement that triggered this purchase |
promoOfferId | String? | Promotional offer identifier, when applicable |
Returns
Returns theEncore instance for chaining.
Usage
With RevenueCat
Chained with onPassthrough
The handler is a
suspend function, so you can call other suspending APIs (like network requests or billing APIs) directly inside it.When no
onPurchaseRequest handler is set, Encore handles purchases via native Play Billing automatically.
Use onPurchaseComplete to sync these transactions with providers that don’t auto-detect Play Billing transactions (e.g., Adapty, Qonversion).