Skip to content

fix: deliver Compose PayPal and Pay Later results after Activity recreation - #1755

Merged
agedd merged 4 commits into
pay-later-button-featurefrom
compose-resultkey-fix
Nov 9, 2026
Merged

agedd merged 4 commits into
pay-later-button-featurefrom
compose-resultkey-fix

Conversation

@agedd

@agedd agedd commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary of changes

  • Add PayPalLauncher(ActivityResultRegistry, String resultKey), following the resultKey convention from Fix: allow a custom ActivityResult registration key #1707. It passes the key to the new BrowserSwitchClient(registry, key) constructor (browser-switch-android#140).
  • The Compose PayPal and Pay Later buttons now save a launcher key with rememberSaveable and restore the stored pending request before completing the flow.

Why

If the Activity is destroyed while PayPal is open (e.g. "Don't keep activities"), the new launcher registered under a random key and never received the Auth Tab result, so the flow was reported as a cancel. A key that survives recreation lets the result reach the new launcher, and restoring the pending request lets it complete as a success.

Depends on

browser-switch-android 3.7.0

Testing

  • Unit tests for restoreStoredRequest (nothing stored, restore succeeds, restore fails).
  • Emulator, "Don't keep activities" on: both Compose buttons return a nonce after recreation; cancel still reports Cancel.

AI Usage

Which AI Agent Was Used?

  • Copilot
  • Claude
  • Other (Type Name Here)

How was AI used?
debugging and refactor

Estimated AI Code Contribution

  • less than 30%
  • 30 - 60%
  • 60 - 100%

Checklist

  • [ ] Added a changelog entry
  • Tested and confirmed payment flows affected by this change are functioning as expected

Authors

List GitHub usernames for everyone who contributed to this pull request.

…ivity is recreated

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@agedd
agedd requested a review from a team as a code owner November 9, 2026 15:36
@agedd
agedd requested a review from mzlangreder November 9, 2026 15:36
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread CHANGELOG.md Resolved
Co-authored-by: Jax DesMarais-Leder <jdesmarais@paypal.com>
Signed-off-by: agedd <ageddam@paypal.com>

@saralvasquez saralvasquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good! Just a small nit since there's a dependency update

Comment thread gradle/libs.versions.toml Resolved
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@saralvasquez saralvasquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@jaxdesmarais jaxdesmarais left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 thanks for the detailed description and tests

@agedd
agedd merged commit 9d2e1e7 into pay-later-button-feature Nov 9, 2026
9 checks passed
@agedd
agedd deleted the compose-resultkey-fix branch November 9, 2026 22:02
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.

3 participants