Skip to content

Notify paywall webview on transaction abandon with custom purchase controller#414

Merged
ianrumac merged 1 commit into
superwall:developfrom
konroj:fix/android-transaction-abandon-webview
Jun 22, 2026
Merged

Notify paywall webview on transaction abandon with custom purchase controller#414
ianrumac merged 1 commit into
superwall:developfrom
konroj:fix/android-transaction-abandon-webview

Conversation

@konroj

@konroj konroj commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Problem

When a paywall uses a custom PurchaseController and the user abandons a purchase (backs out of the Google Play sheet), the paywall webview is never told the transaction was abandoned. As a result, a purchase button's onAbandon actions configured in the paywall editor (e.g. setting a state variable to reveal an exit offer / close button) never run, so the exit UI never appears.

The transaction_abandon analytics event is tracked, but that is separate from the paywall_event_receiver message the webview needs to drive the purchase action's onAbandon callbacks.

Root cause

TransactionManager.trackCancelled (the PurchaseSource.Internal branch) tracks the abandon event but does not forward a transaction_abandon message to the paywall webview. There is also no TransactionAbandon case in the Android PaywallMessage types.

This works on iOS. In Superwall-iOS, TransactionManager does both, right after tracking:

await Superwall.shared.track(transactionAbandon)
await paywallViewController.webView.messageHandler.handle(.transactionAbandon)

and iOS PaywallMessage includes transactionStart, transactionComplete, transactionFail, transactionAbandon, transactionTimeout. The Android PaywallMessage only has TransactionStart and TransactionComplete, so the abandon message had no representation and was never sent.

Fix

Mirror the iOS behaviour:

  • Add PaywallMessage.TransactionAbandon.
  • Handle it in PaywallMessageHandler by forwarding SuperwallEvents.TransactionAbandon.rawName to the webview (same pass(...) path as TransactionStart).
  • In DependencyContainer, wire a notifyOfTransactionAbandon lambda that resolves the active paywall view by cache key and posts PaywallMessage.TransactionAbandon (mirrors notifyOfTransactionComplete).
  • Call it from TransactionManager.trackCancelled (Internal branch), right after track(...), before resetting the loading state — matching iOS order. The new constructor parameter has a no-op default, so it is non-breaking for existing callers/tests.

Testing

Reproduced on an emulator with a custom PurchaseController (RevenueCat) on a paywall whose purchase button has an onAbandon action that sets a state variable bound to a close button's visibility. Before: abandoning the purchase left the exit/close UI hidden. After: the onAbandon action runs and the exit offer / close button appears, matching iOS.

@konroj konroj force-pushed the fix/android-transaction-abandon-webview branch from 82bdd3f to a481f4a Compare June 22, 2026 09:58
@konroj konroj force-pushed the fix/android-transaction-abandon-webview branch from a481f4a to b208f38 Compare June 22, 2026 10:00
@ianrumac ianrumac merged commit 2cb87dd into superwall:develop Jun 22, 2026
2 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants