#sssssssss

1 messages ยท Page 1 of 1 (latest)

pure bloomBOT
hollow perch
#

hello! would checking if complete is true work?

round trail
#

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.

hollow perch
#

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?

round trail
#

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.

hollow perch
#

gimme a while to test some stuff out

round trail
#

Of course. Thank you!

hollow perch
#

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