Skip to content

feat: added hidden payment methods for headless#1573

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

feat: added hidden payment methods for headless#1573
ArushKapoorJuspay merged 1 commit into
mainfrom
feat/hidden-payment-methods-headless

Conversation

@ArushKapoorJuspay

Copy link
Copy Markdown
Collaborator

Type of Change

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

Description

Adds a hiddenPaymentMethods prop that allows merchants to filter out specific saved payment methods. Supported in both the embedded (PaymentElement) and headless (PaymentSession) flows.

Changes

  • src/hyper-loader/Types.res
    • Changed getCustomerSavedPaymentMethods type from unit => promise<JSON.t> to option<JSON.t> => promise<JSON.t>
    • Updated defaultGetCustomerSavedPaymentMethods stub to accept optional param
  • src/hyper-loader/PaymentSession.res
    • Forwards call-time options argument to PaymentSessionMethods
  • src/hyper-loader/PaymentSessionMethods.res
    • Added ~options: option<JSON.t> parameter; parses hiddenPaymentMethods internally
    • Applied filterSavedMethodsByHiddenList on customerPaymentMethodsRef after initial sort
    • isApplePayPresent, isGooglePayPresent, and customerDefaultPaymentMethodRef all derived from the filtered list
    • Removed stale debug Console.log2

Filter Logic

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

Backwards Compatibility

  • Embedded flow: omitting hiddenPaymentMethods preserves existing behaviour
  • Headless flow: getCustomerSavedPaymentMethods() with no argument → no filtering

How did you test it?

Checked the customers call list response after passing hiddenPaymentMethods prop

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 949060c into main May 19, 2026
10 of 12 checks passed
@ArushKapoorJuspay ArushKapoorJuspay deleted the feat/hidden-payment-methods-headless branch May 19, 2026 17:04
@github-actions github-actions Bot added the Closed Label will be automatically added when the PR will get merged to main label May 19, 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.

add hiddenPaymentMethods prop to savedMethodCustomization and getCustomerSavedPaymentMethods

3 participants