Dynamically start handlePaymentMethodSubmission

So far my JS script has:

		const cardButton = document.getElementById('sq-creditcard');
		cardButton.addEventListener('click', async function (event) {
			await handlePaymentMethodSubmission(event, card)   }

I don’t however want this to happen. When customer clicks on “Place order”, I want it to load my own javascript function, test some stuff, and THEN load the handlePaymentMethodSubmission function.

So I have this HTML Code for the “place order” button:

< input type=“button” id=“sq-creditcard” onclick=“form_submit();” value=“Place Order”>

And in the form_submit, if everything seems well, I tried adding this at the end of the JS function:
await handlePaymentMethodSubmission(event, card)

But it doesn’t start the handlePaymentMethodSubmission function. Any suggestions?
Thank you.

Is the form loading correctly and its only on submission that it’s failing? Are there any console errors or network errors? :slightly_smiling_face: