Hi world,
I’m hoping you can help me figure this out. In the My Account section of my app, I give users the option to save a payment card for future one-time or recurring purposes. Using Stripe Elements and Setup Intents, my goal is to:
- Authorize and Validate the Card: I want to ensure the card is valid, not expired or stolen, and suitable for future use. Stripe Elements performs a basic check, but I’m trying to use Stripe’s Setup Intent action to do a more thorough verification.
- Tokenize and Save the Card: After validating, I’d like to tokenize the card via Stripe, then save the tokenized information in my database for future use.
I can successfully create and save the payment method with Stripe, but integrating the validation step using Setup Intents is where I’m stuck.
The Problem: I’m having trouble interpreting Stripe’s response to determine whether a card is fully validated and ready to be saved. For example, when I test using Stripe’s known-bad test card numbers (like for insufficient funds or stolen cards), I’m not able to distinguish between a successful validation and a failed one. This makes it difficult to prevent invalid cards from being saved to the database.
Any insight or guidance on handling the Setup Intent response to differentiate valid from invalid cards would be greatly appreciated!
’m