Skip to content

Apple Pay supportedNetworks Not Respected Due to brands Configuration #3196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jureperak opened this issue Mar 18, 2025 · 6 comments
Closed
Labels
Needs more info Further information is requested

Comments

@jureperak
Copy link

jureperak commented Mar 18, 2025

Describe the bug
When configuring Apple Pay in Adyen's Web SDK, setting the supportedNetworks option does not work as expected. Instead, the configuration checks the brands property first. However, brands is not a valid option for Apple Pay in Adyen’s TypeScript types, making it impossible to properly restrict specific card networks.

To Reproduce
Steps to reproduce the behavior:

  1. Configure Apple Pay in Adyen with supportedNetworks set to specific card brands (e.g., ['masterCard']).
  2. Attempt to pay using a restricted card brand (e.g., Visa or Amex or Discover).
  3. The restricted card brand still appears as an available option.

Expected behavior
Apple Pay should only display the card networks specified in supportedNetworks, ignoring any invalid brands checks.

Screenshots
It only works if I manually set brands: [] property, which does not exists in ApplePay configuration
Image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context
The issue seems to stem from Adyen's Apple Pay implementation prioritizing brands (which is not configurable in Apple Pay) over supportedNetworks. This prevents merchants from correctly limiting available card brands in Apple Pay transactions.

The problem seems to be in this line:

const supportedNetworks = props.brands?.length ? mapBrands(props.brands) : props.supportedNetworks;

@jureperak jureperak changed the title Adyen Apple Pay supportedNetworks Not Respected Due to brands Configuration Apple Pay supportedNetworks Not Respected Due to brands Configuration Mar 18, 2025
@jureperak
Copy link
Author

Hi, I wanted to check if there's any update on this issue. Please let me know if any additional information is needed. Thanks!

@ribeiroguilherme
Copy link
Contributor

Hi @jureperak ,

The brands from props.brands that you highlighted in the code snippet are the ones returned by the backend along with the configured payment method. You must be getting something like:

{
  type: "applepay",
  name: "Apple Pay",
  brands: ['visa', ... ],
  configuration: { ... }
}

Ideally you should rely on those brands and do not have to set them explicitly on the frontend side using the brands or supportedNetworks object.

The supportedNetworks / brands are meant for the same thing. I am not entirely sure why we have that check in place (I guess it is there for legacy reasons), but I believe that the supportedNetworks must be removed and we should support only brands in case the merchant really wants to override their values, although doing any changes to this code for now can lead to breaking changes.

Is there any reason why can't you rely on the brands returned in the payment methods response?

@ribeiroguilherme ribeiroguilherme added the Needs more info Further information is requested label Mar 26, 2025
@jureperak
Copy link
Author

Hey @ribeiroguilherme,
for some reason, I thought that the brands from /payment-methods would not load properly into the ApplePay component. However, I will rely on the brands returned from the server and will not override them manually. Sorry for the confusion.

@jureperak
Copy link
Author

I will continue in this thread so that we have some context.
What if I want to enable only Google Pay or Apple Pay (without card input) but only for specific brands, e.g., Visa and Mastercard? What do I need to send in AllowedPaymentMethods on the server?

@jureperak jureperak reopened this Apr 2, 2025
@ribeiroguilherme
Copy link
Contributor

@jureperak just to confirm, do you want to tweak the brands supported by Google Pay / Apple Pay based on the availability of the Card component?

allowPaymentMethods will just remove the whole payment method from the response. It won't change the brands returned as far as I know.

@jureperak
Copy link
Author

@ribeiroguilherme no no, i wanted to know how can i influence brands availability inside of GooglePay/ApplePay from the server. If we on the server (e.g. session flow) set following:

AllowedPaymentMethods = [
  {
       "visa",
       "mc",
       "googlepay"
   }
],
BlockedPaymentMethods = [
  {
     "visa_googlepay"
  }
]

it will offer me only MC brand in GooglePay.

We can close this issue now, everything is resolved (through service ticket also).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants