Notify paywall webview on transaction abandon with custom purchase controller#414
Merged
ianrumac merged 1 commit intoJun 22, 2026
Conversation
82bdd3f to
a481f4a
Compare
a481f4a to
b208f38
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a paywall uses a custom
PurchaseControllerand 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'sonAbandonactions 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_abandonanalytics event is tracked, but that is separate from thepaywall_event_receivermessage the webview needs to drive the purchase action'sonAbandoncallbacks.Root cause
TransactionManager.trackCancelled(thePurchaseSource.Internalbranch) tracks the abandon event but does not forward atransaction_abandonmessage to the paywall webview. There is also noTransactionAbandoncase in the AndroidPaywallMessagetypes.This works on iOS. In
Superwall-iOS,TransactionManagerdoes both, right after tracking:and iOS
PaywallMessageincludestransactionStart,transactionComplete,transactionFail,transactionAbandon,transactionTimeout. The AndroidPaywallMessageonly hasTransactionStartandTransactionComplete, so the abandon message had no representation and was never sent.Fix
Mirror the iOS behaviour:
PaywallMessage.TransactionAbandon.PaywallMessageHandlerby forwardingSuperwallEvents.TransactionAbandon.rawNameto the webview (samepass(...)path asTransactionStart).DependencyContainer, wire anotifyOfTransactionAbandonlambda that resolves the active paywall view by cache key and postsPaywallMessage.TransactionAbandon(mirrorsnotifyOfTransactionComplete).TransactionManager.trackCancelled(Internal branch), right aftertrack(...), 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 anonAbandonaction that sets a state variable bound to a close button's visibility. Before: abandoning the purchase left the exit/close UI hidden. After: theonAbandonaction runs and the exit offer / close button appears, matching iOS.