Skip to content

Fix collectPaymentMethod returning stale result on iOS dismiss#6354

Closed
finn-stripe wants to merge 1 commit intomasterfrom
finn-fix-ios-bottom-sheet-dismissal
Closed

Fix collectPaymentMethod returning stale result on iOS dismiss#6354
finn-stripe wants to merge 1 commit intomasterfrom
finn-fix-ios-bottom-sheet-dismissal

Conversation

@finn-stripe
Copy link
Copy Markdown

@finn-stripe finn-stripe commented Apr 17, 2026

Summary

Fix LinkController.collectPaymentMethod to return nil on dismiss instead of the previously selected payment method. The completion handler now passes a PaymentMethodPreview? directly, making the cancellation vs. selection result explicit.

Motivation

https://jira.corp.stripe.com/browse/ONRAMP-342

When calling collectPaymentMethod in the stripe-react-native onramp SDK, iOS and Android behaved inconsistently when the user dismissed the bottom sheet by tapping X. iOS returned displayData for the most recently selected payment method even on dismiss, while Android always returned cancellation. This change aligns iOS with Android: tapping X always returns nil (cancellation), regardless of whether a payment method was previously selected during the session.

Test plan

  • All changes in PR are covered by tests
  • Failures and edge cases tested
  • Manually ran affected jobs

Rollout/revert plan

  • Safe to revert

Monitoring plan

  • Change has no runtime impact

The async collectPaymentMethod wrapper read self.paymentMethodPreview
after the callback fired. On dismiss with shouldClearSelection=false,
this returned a stale preview from a prior selection instead of nil.

Pass the result explicitly through the completion closure so cancel
always returns nil, matching Android behavior.

Committed-By-Agent: claude
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.

1 participant