#adri10_payment-method-validation
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1291077120680005746
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
Sorry but I'm not quite grasping which type of error you are testing for. Do you want the card to pass validation in the front-end but fail in the back-end?
hi, no i want an error at the moment of creating the payment method
So on the front-end then? Like not event allowing you to submit the card?
yes, to let the user know if the card is expired or any other error that might happen. Right now only fail in the request server. These test card do failed trying to add the card to the customer but is curious that they don't cause error when creating the payment method
You can simulate that with any test card by providing an incorrect expiration date like 02/22
the stripe elements form validate that and do not allow that. im expecting to have an error on using one of the failure test card, it doesn't make sense get the paymentMethodId if not is a good card. I thought maybe stripe have a different list to test payment method, but the createPaymentMethod always work even submitting cards of the list of failure test cards
Ah, in that case the problem is you are using the createPaymentMethod function, not something like Setup Intents
That function does zero authorization checks
If you want to detect invalid payment methods I recommend you use Setup Intents to save them to a Customer
https://docs.stripe.com/payments/save-and-reuse
oh ok, thanks. That's what i want to know if there was a way to catch at the moment of creating the paymentMethod, but there's not. Thanks, i'll take a look on this
Happy to shed what ๐ก I can ๐