#sssssssss
1 messages ยท Page 1 of 1 (latest)
Thanks for replying!
Apparently, complete is available inside the event of the onChange event handler, right?
If the user attempts to click the submit button without even focusing on the CardElement, It's impossible to access the complete and that's the point I've been strugling ๐
Just so you know, I already used complete on 57 lines of checkout.tsx in codesandbox I shared.
hrm, i think maybe you're overthinking it - if you attempt to submit when the card number field is empty as an example, confirmCardPayment or confirmCardSetup would return an error anyway e.g. Your card number is incomplete.
wouldn't that be sufficient?
That totally makes sense though.
However, the system we are developing is an order management system, and until now, order placement has been done by the document.
This time, a ticket was issued to install a payment function using Stripe on a small scale, and I was assigned to implement it.
The policy of the specification is that after the user enters credit card information and order information, a Thank you page will be displayed regardless of success or failure, and the user will be notified of the payment result via email based on the webhook information issued by Stripe.
Therefore, it is not ideal to "press submit button โ send a payment request to Stripe โ failed โ redisplay the form screen.
gimme a while to test some stuff out
Of course. Thank you!
i still think the best way to go about this is to handle validation_errors specifically (instead of redirecting to another page) - when you click confirmCardPayment - you'll get the error: {code: 'incomplete_number', type: 'validation_error', message: 'Your card number is incomplete.'}
so if you receive type=validation error, you can display the error message instead of redirecting to another page
this is another method too : https://stackoverflow.com/a/65865033/2718163