Skip to content

feat: added hiddenPaymentMethods customization prop#1569

Merged
ArushKapoorJuspay merged 1 commit into
mainfrom
feat/hidden-payment-methods
May 18, 2026
Merged

feat: added hiddenPaymentMethods customization prop#1569
ArushKapoorJuspay merged 1 commit into
mainfrom
feat/hidden-payment-methods

Conversation

@ArushKapoorJuspay

Copy link
Copy Markdown
Collaborator

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Adds a new hiddenPaymentMethods prop inside savedMethodCustomization that allows merchants to filter out specific payment methods from the SavedMethods section only. The new payment methods list is unaffected.

Changes

  • src/Types/PaymentType.res
    • Added hiddenPaymentMethods: array<string> field to the savedMethodCustomization type
    • Added hiddenPaymentMethods: [] to defaultSavedMethodCustomization
    • Added "hiddenPaymentMethods" to unknownKeysWarning to avoid spurious console warnings
    • Parsed the new field in getSavedMethodCustomization using getStrArray
  • src/Utilities/PaymentUtils.res
    • Added filterSavedMethodsByHiddenList utility function
    • Applied filter at both saved-methods pipeline call sites (standard + grouped)
    • Added hiddenPaymentMethods to useMemo dependency array in useGetPaymentMethodList
  • src/PaymentElement.res
    • Chained filterSavedMethodsByHiddenList before filterSavedMethodsByWalletReadiness in the saved methods useEffect pipeline
    • Added hiddenPaymentMethods to the useEffect dependency array
    • Removed redundant Array.copy (dead code since Array.filter returns a new array)

Behaviour

Input Result
["apple_pay"] Hides saved Apple Pay entries
["google_pay"] Hides saved Google Pay entries
["card"] Hides all saved cards (credit + debit)
["google_pay", "card"] Hides saved Google Pay and all saved cards
["wallet"] No effect — silently ignored
[] / omitted No filtering, existing behaviour preserved

Notes

  • Filter runs before filterSavedMethodsByWalletReadiness so merchant intent takes priority
  • Matching is case-insensitive
  • ["wallet"] is explicitly not supported — merchants must pass specific method names like "apple_pay" or "google_pay"

How did you test it?

Passing all these payment_methods in the prop one by one to verify whether that payment method has been removed or not

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@semanticdiff-com

Copy link
Copy Markdown

Review changes with  SemanticDiff

@github-actions

Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@ArushKapoorJuspay ArushKapoorJuspay merged commit fdeb29c into main May 18, 2026
10 of 12 checks passed
@ArushKapoorJuspay ArushKapoorJuspay deleted the feat/hidden-payment-methods branch May 18, 2026 14:15
@github-actions github-actions Bot added the Closed Label will be automatically added when the PR will get merged to main label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Closed Label will be automatically added when the PR will get merged to main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add hiddenPaymentMethods prop to savedMethodCustomization

2 participants