launch Billing Flow With Superwall
Extension function for BillingClient that launches the Google Play billing flow while allowing Superwall to observe the purchase.
This method acts as a proxy between your app's purchase flow and Google Play Billing, enabling Superwall to track the purchase lifecycle when observer mode is enabled. It wraps the standard BillingClient.launchBillingFlow method and adds purchase observation capabilities.
The method will:
Check if Superwall SDK is initialized
Verify if purchase observation is enabled via SuperwallOptions.shouldObservePurchases
Notify Superwall before each product purchase begins
Launch the actual billing flow
Purchase events can then be observed through Superwall.delegate or Superwall.placements, which will emit events like:
SuperwallEvent.TransactionStart when purchase begins
SuperwallEvent.TransactionComplete on successful purchase
SuperwallEvent.TransactionFail on purchase failure
Return
BillingResult containing the response from launching the billing flow
Parameters
The activity that will host the billing flow
Wrapper around BillingFlowParams containing product details for the purchase
See also
Throws
if Superwall SDK is not initialized