Skip to content

VGS - Add support for valid card brands#370

Merged
fernanDOTdo merged 2 commits into
mainfrom
vgs-card-brands
Jan 17, 2026
Merged

VGS - Add support for valid card brands#370
fernanDOTdo merged 2 commits into
mainfrom
vgs-card-brands

Conversation

@StoneMoney

Copy link
Copy Markdown
Member

From: https://app.productive.io/2650-4site-interactive-studios-inc/tasks/15072056

This implements support in the VGS module to allow a client theme to specify supported card brands. By default, all brands are supported (with a value of null, rather than an exhaustive list). Because of this, I have made a special exception to the deepMerge, as deep merging with the defaultOptions having value of null or undefined would result in a failed merge, defaultOptions having all available card types would result in all available card types working regardless of client theme specification, and defaultOptions having a value of an empty array would require all client themes be updated to specify what card types are needed. This was my best approach to maximizing compatibility.

Test page: https://protect.worldwildlife.org/page/69817/donate/1?assets=deny-diner-jcb&debug=log

Testing steps:
Attempting any card only requires inputting the value into the credit card field, no other fields are needed to be filled to test validation.

  • Attempt a test visa card 4242424242424242, no error should occur for the credit card field when hitting submit.
  • Attempt a test Diner's Club card 3056930009020004, a "Credit Card number is invalid" error should occur
  • Attempt a test union pay card 6200000000000005, no error should occur
  • Attempt a test JCB card 3566002020360505, a "Credit Card number is invalid" error should occur

Further testing could include pulling the deny-diner-jcb branch, and this vgs-card-brands branch together locally and modifying the options in index.ts:91 such as

  • Removing the options entirely and testing that all brands work
  • Removing visa and testing that a visa card now has an invalid error
  • Adding jcb and testing that jcb no longer has an invalid error

Just remember to update the url such that assets=local

The list of available brand codes is here: https://docs.verygoodsecurity.com/vault/developer-tools/vgs-collect/js/customization#card-brand-identification

@StoneMoney
StoneMoney requested review from MichaelT372 and fernanDOTdo and removed request for MichaelT372 January 14, 2026 23:39
@fernanDOTdo
fernanDOTdo merged commit f9a911b into main Jan 17, 2026
2 checks passed
@fernanDOTdo
fernanDOTdo deleted the vgs-card-brands branch January 17, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants