#mirajacc-payment-element-react

1 messages · Page 1 of 1 (latest)

gritty hazel
#

By empty field do you mean when customer push the submit button, there is some fields left unfilled?

winter night
#

Yes. I have a few API calls added before confirmPayment() so I need to check if the user has completed the form to make those API calls.

gritty hazel
winter night
#

I had a look at it before. Tried, but couldn't make it work in the React application, so reached out here.

gritty hazel
#

I am not super familiar but why is it not working in a Reaction application?

winter night
gritty hazel
#

ah I see, because you don't have access to paymentElement

winter night
#

Correct. And I'm trying to see if I can use useElements(). Compared console logs for both success and error cases, no distinct field to check if any field is empty.

quartz whale
#

stepping in on behalf of orakaro. Can you give an example of a field which you're validating that it's not empty?

winter night
#

Thanks Alex. The fields are credit card number, expiry and cvc.

quartz whale
#

the payment element is already performing those validations though, why do you want to validate it too?

winter night
#

I have a few APIs that I need to call before the payment is made. These should be called after the pay button is clicked and before the confirmPayment() is called. This is where I need the check and handle API calls accordingly.

#

This is basically for inventory lock and order placement. We don't want the payment to be made before the inventory check or order placement.

quartz whale