Skip to content

feat: add support for fiat payment methods in PayWithModal#30184

Merged
vinistevam merged 33 commits into
mainfrom
vs/pay-with-bank-card-section
May 15, 2026
Merged

feat: add support for fiat payment methods in PayWithModal#30184
vinistevam merged 33 commits into
mainfrom
vs/pay-with-bank-card-section

Conversation

@vinistevam

@vinistevam vinistevam commented May 14, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a Bank and card section to the redesigned Pay With bottom sheet so users can pay a confirmation with a fiat payment method (Debit/Credit card, Apple Pay, Google Pay, etc.) in addition to crypto. The new section wraps the existing useFiatPaymentHighlightedActions hook so it inherits the same gating and selection behavior the legacy PayWithModal already uses for fiat methods — same data source, same controller writes, new UI surface.
When a user taps a fiat method, the controller's selectedPaymentMethodId updates and the bottom sheet closes. Tapping an already-selected fiat row just dismisses the sheet without deselecting. The section renders above the existing Crypto section.
When the new bottom sheet is enabled, the legacy PayWithModal no longer surfaces fiat highlighted items — it continues to serve as the underlying token picker reachable via "Other assets". The Bank and card section becomes the single source of truth for fiat payment methods in this flow.
A few related fixes that surfaced during integration:

  • Mutually-exclusive selection between fiat and crypto. When a fiat method is selected, crypto rows in the same sheet no longer show a checkmark. This mirrors the existing legacy modal behavior so selection semantics stay consistent between the old and new pickers.
  • Sheet dismissal coordination. Both pay-token and fiat-payment changes can dismiss the sheet; a shared latch ensures only one dismissal fires per controller write, preventing the sheet from popping the screen behind it when both values change at once.
  • Icon color consistency. Fiat payment method icons now render with the same token color as other secondary icons in the sheet for visual parity.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1364

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

WhatsApp.Video.2026-05-14.at.14.26.49.mp4

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Moderate UI/state-flow changes in the confirmations payment picker: selection semantics and navigation dismissal now react to both token and fiat method changes, which could cause regressions in how pay methods are applied or screens are popped.

Overview
Adds a new Bank and card section to the redesigned Pay With bottom sheet via usePayWithFiatSection, mapping useFiatPaymentHighlightedActions into selectable rows (with PaymentMethodIcon) and ordering it before the crypto section.

Updates crypto-row selection behavior to be mutually exclusive with fiat selection (hides/clears crypto checkmarks/rows when a fiat method is selected) and replaces useDismissOnPayTokenChange with useDismissOnPaymentChange so the bottom sheet dismisses once on either pay-token or fiat-method changes.

When the new bottom sheet is enabled (isPayWithBottomSheetEnabled), PayWithModal now suppresses fiat highlighted actions so it functions only as the “Other assets” token picker; tests and the en.json string for confirm.pay_with_bottom_sheet.bank_and_card are added/updated accordingly.

Reviewed by Cursor Bugbot for commit cfde84e. Bugbot is set up for automated code reviews on this repo. Configure here.

vinistevam and others added 27 commits May 8, 2026 10:59
…sk/metamask-mobile into vs/pay-with-bottom-sheet-skeleton
@vinistevam vinistevam added team-confirmations Push issues to confirmations team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels May 14, 2026
@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@vinistevam vinistevam removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 14, 2026
@vinistevam vinistevam marked this pull request as ready for review May 14, 2026 14:59
@vinistevam vinistevam requested a review from a team as a code owner May 14, 2026 14:59
@MetaMask MetaMask deleted a comment from sonarqubecloud Bot May 15, 2026
Base automatically changed from vs/pay-with-last-used to main May 15, 2026 09:01
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations, SmokePredictions, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR modifies the "Pay With" payment selection flow in the transaction confirmation system. Key changes:

  1. New usePayWithFiatSection hook: Adds a "Bank and card" section to the Pay With bottom sheet, integrating fiat payment methods (bank/card) alongside crypto options.

  2. Updated usePayWithSections: Now includes both bankCardSection (fiat) and cryptoSection in the bottom sheet sections array.

  3. New useDismissOnPaymentChange (replaces useDismissOnPayTokenChange): Extended to dismiss the bottom sheet when either the pay token OR the fiat payment method changes, enabling proper UX when a bank/card option is selected.

  4. Updated usePayWithCryptoSection: Now checks hasFiatPaymentSelected to suppress crypto selection indicators when a fiat method is active, preventing conflicting UI states.

  5. Updated pay-with-modal.tsx: When isPayWithBottomSheetEnabled() feature flag is active, suppresses fiat highlighted actions from the modal (since the bottom sheet now handles them), preventing duplication.

  6. Locale: Added "bank_and_card" string for the new section title.

Tag Selection Rationale:

  • SmokeConfirmations: Primary tag - these changes directly affect the transaction confirmation pay-with flow (EIP-7702 gas fee token payment, transaction pay modal/bottom sheet). The transaction-pay.spec.ts test uses SmokeConfirmations and exercises TransactionPayConfirmation.tapPayWithRow().
  • SmokePredictions: The Predict deposit flow uses TransactionPayConfirmation.tapPayWithRow() (seen in predict-deposit.spec.ts and musd-conversion-happy-path.spec.ts). Changes to the pay-with bottom sheet could affect the Predict deposit flow.
  • SmokeWalletPlatform: Required by SmokePredictions tag description (when selecting SmokePredictions, also select SmokeWalletPlatform for Trending section).

The changes are feature-flag gated (isPayWithBottomSheetEnabled), reducing risk of regression in existing flows. No core infrastructure, controllers, or navigation changes are involved.

Performance Test Selection:
The changes are UI/hook-level modifications to the Pay With bottom sheet in the confirmation flow. They add a new fiat section and update dismiss behavior. These are not performance-sensitive changes - no list rendering optimizations, no data loading changes, no app startup/initialization changes, and no changes to performance-critical paths like account lists or swap flows. The changes are also feature-flag gated, further limiting their performance impact scope.

View GitHub Actions results

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cfde84e. Configure here.

});
navigation.goBack();
}, [navigation, preferredToken, selectToken]);
}, [navigation, preferredToken, setPayToken]);

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.

Double navigation pop when switching from fiat to crypto

High Severity

handlePreferredTokenPress calls both setPayToken(...) and navigation.goBack(). When a fiat method was previously selected, the controller's updatePaymentToken atomically clears the fiat payment. useDismissOnPaymentChange in PayWithBottomSheet then detects the selectedPaymentMethodId change and fires a second navigation.goBack(). The latch (isDismissingRef) only guards against multiple hook-triggered dismissals — it does not prevent the combination of the manual goBack() from the press handler plus the hook's goBack(). This double-pop dismisses the bottom sheet AND the screen behind it.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cfde84e. Configure here.

@sonarqubecloud

Copy link
Copy Markdown

@vinistevam vinistevam added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit 5d7085d May 15, 2026
120 of 140 checks passed
@vinistevam vinistevam deleted the vs/pay-with-bank-card-section branch May 15, 2026 13:10
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.79.0 Issue or pull request that will be included in release 7.79.0 size-L team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants