Hi @eazyproo
For the most part, the logic of the hosted fields provided by the Advanced Card Processing is controlled by PayPal. This file renders the card fields, but the card type detection happens inside of the PayPal Hosted Fields SDK, as far as I am aware. This means the plugin currently doesn’t actively control at which point the card type is detected.
In the PayPal Hosted Fields SDK, the recognition of card type and triggering of the cardTypeChange event occurs when enough digits have been entered to identify the card type. Since this detection is done internally by the PayPal SDK, I’m not sure it can be modified from the code mentioned above.
If you want the icon to show earlier, you may need to implement your own card type detection logic outside of the PayPal SDK, which could trigger as soon as the first digits are entered. However, this could potentially be more complex and less reliable than using the SDK’s built-in functionality and would also increase the risk of handling sensitive card information.
Some of the examples in the PayPal documentation like this one appear to trigger the card detection earlier. Though I’m unsure if there is an easy way to have the hosted fields from the plugin behave the same way.
But to better understand possible options, I created an issue for our developers to investigate if this could be improved to detect the card earlier as per your request.
We’ll try to let you know when we had the chance to look into this deeper.
Kind regards,
Niklas
Hi @eazyproo
Our developers have looked into the behavior, and found a way to trigger PayPal’s card type detection earlier.
Please give it a try with this test version. With this test version, the card type detection should be triggered after the first couple of digits, as opposed to only when the full card number is provided (how it works right now). For reference, here are the changes that made this work.
Please let us know how this works for you.
Kind regards,
Niklas
Hello,
Thank you so much it worked perfectly hope you save the changes on all of your next updates, thank you.
Hi @eazyproo
Thank for the feedback. I’m glad to hear this works for you.
The tweak will likely be included in the next update which will be released sometime within the next two weeks.
Kind regards,
Niklas
The change was merged and will be part of the upcoming update. So I will mark this thread as resolved. Thanks again for the suggestions.
If you have any doubts or further questions, please do not hesitate to let us know.
Thanks!