diff --git a/app/frontend/src/javascript/components/payment/stripe/stripe-keys-form.tsx b/app/frontend/src/javascript/components/payment/stripe/stripe-keys-form.tsx index efa56180d..d0a2f4f4f 100644 --- a/app/frontend/src/javascript/components/payment/stripe/stripe-keys-form.tsx +++ b/app/frontend/src/javascript/components/payment/stripe/stripe-keys-form.tsx @@ -73,6 +73,8 @@ const StripeKeysFormComponent: React.FC = ({ onValidKeys, o * Send a test call to the Stripe API to check if the inputted public key is valid */ const testPublicKey = (key: string) => { + setPublicKeyAddOnClassName(''); + if (!key.match(/^pk_/)) { setPublicKeyAddOn(); setPublicKeyAddOnClassName('key-invalid'); @@ -98,6 +100,8 @@ const StripeKeysFormComponent: React.FC = ({ onValidKeys, o * Send a test call to the Stripe API to check if the inputted secret key is valid */ const testSecretKey = (key: string) => { + setSecretKeyAddOnClassName(''); + if (!key.match(/^sk_/)) { setSecretKeyAddOn(); setSecretKeyAddOnClassName('key-invalid');