Posted: September 22, 2020 at 10:12 am
September 22, 2020 at 10:12 am Hi All, 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. Unfortunately, the form does not follow a normal submit() process (uses AJAX instead). Is there a way I can run a javascript function before the AJAX POST request is sent with the main registration 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. |
|
September 22, 2020 at 12:51 pm Well, I figured out a tricky work-around. The new payment method appears to be working… Source is here: https://github.com/own3mall/secure-submit-heartland-payments-event-espresso-4-payment-plugin |
|
Hi there, 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: https://monosnap.com/file/3oVTubI9iAnhWxEI93adf221rZnnu1 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: https://monosnap.com/file/gipRMVdt3FBxiCRrmlylmeF72wzqwt 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. |
|
Thanks for your feedback. I only just saw your response. In my case, we only wanted to use Secure Submit as our only payment method, so I was not aware it impacted other payment methods. I’ll see if I can create a work around for this. I’ll return a basic <p> message rather than using a die statement. |
|
Does this address the issues mentioned in your feedback? Do you have any other suggestions or feedback? Is this something Event Espresso can add as a supported payment method? |
|
Oops, another minor change: |
|
The changes do indeed fix the issues I mentioned.
I haven’t tested the payment method any further than activating it and adding some dummy values to the settings, I assume the payments work as expected?
We wouldn’t add a payment method we didn’t create and test ourselves into Event Espresso’s core payment methods but we can add you to the list of 3rd party repo’s if preferred? https://eventespresso.com/third-party-addons/ — I’d like to ask a question outside of Event Espresso if I may? I’m curious as to what the benefit is with your current GitHub repo setup vs using say master as ‘release’ with feature branches and automated Github releases? Right now, unless I’m mistaken it looks like you manually zip up a release and include it in the The reason I’m asking is I can’t just check out your repo and clone it locally to view it as a plugin, I need to manually change the working tree to your the directory in your |
|
Yes, that would be great if you’d add it to the third party addons. We’ve been processing tons of payments with this plugin, so it certainly works well for us and should work well for anyone else wanting to use this payment method. I just created a release in that github repo. I just do things a little differently sometimes for time saving sakes. |
|
Sure, I’ve created a ticket for this.
Sorry to clarify, it’s not just creating releases within Github as that release is exactly the same as your current repo and can’t be used as-is. It has the To show an example of a different setup that makes it much quicker for other developers to collaborate with yours, take a look at our waitlist add-on repo: https://github.com/eventespresso/eea-wait-lists The root directory of that repo is essentially your You’re obviously free to set up your repo however you prefer, I was just wondering if I/we were missing something with a different setup that we could then investigate. |
|
Gotcha. Evidently, my browser PaleMoon is no longer supported by GitHub. I thought I had uploaded the release properly, but that didn’t happen. It should be good now: |
|
The support post ‘New Payment Method – Hook Into "Proceed to Finalize Registration" Call’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.