Posted: September 22, 2020 at 10:12 am
I’m developing a new payment method for Secure Submit, and with Secure Submit, I need to be able to intercept the ‘ee-spco-payment_options-reg-step-form’ form submit event and make a call to the Secure Submit API to get a token that needs to be posted with the form.
The secure submit js used is:
var theForm, data, i, cardType;
// stop form from submitting
It then makes a token request, gets the token, places it as a hidden input in the form, and then submits the form. How do I do this with my payment method? submit() is never called on the form due to the way it’s working via an AJAX call.
I need a way to run a function that completes before submitting the ajax registration call.
Well, I figured out a tricky work-around.
The new payment method appears to be working… Source is here:
What you are trying to do above sounds a little similar to how the Stripe payment method worked and it would simply hide the Finalize button when the Stripe payment method was selected and trigger a click on that element when it was done processing.
Your license has access to that add-on so I’d recommend taking a look in
Thank you for sharing your payment method and whilst you haven’t asked for feedback I did some quick testing with your payment method so I’ll add my notes here should you wish to take them on board.
When you initially activate the payment method it will break any registrations attempting to take place on the site as there will be no public key set, so THIS breaks check out completely. That might not seem like an issue but we’ve seen in the past that people will activate payment methods, realize they don’t have credentials and go off to find them meaning during that time registrations are blocked on their site with your PM. The text displayed doesn’t give any indication that it is from the payment method and the registrant wouldn’t be able to change it either way. Right now it will kill the stript on the attendee information step, like this:
All I’ve done there is select some tickets after the PM was activated. So I recommend switching that out to simply display a message in the payment form when someone selects the payment method.
A bigger issue is that your JS still runs after the user has selected a different payment method if they’ve selected yours at all. So say you have this payment method and Invoice enabled, on the payment options select this PM and select Invoice, once Invoice has loaded click to Finalize:
You JS is still running and prevents me from finalizing. If you take the same path the Stripe payment method uses you’ll see how we prevent that within the add-on.