Catching a payment form submit before it is submitted

Hi everyone,

Is it possible to catch the moment where a user clicks on “Pay” to fire a webhook before his payment actually gets processed?

I need to make sure there are enough available spots before selling a ticket.

Thanks,
Tomas

Likely this would be a jquery before you submit to check availability.
Kelson at Ksense would be a great partner to reach out to:
https://www.knack.com/experts#expert-directory/expert-details2/606f962e30281f001d42acaa/

Yes, but for this I would need to know what Knack’s event handler is…

From Knack’s own doc, I only found this:

// Change scene_1 to the scene with your checkout view
$(document).on('knack-checkout-submit.scene_1', function(event, view, record) {
  // Do something after the payment has gone through
  alert('Payment successful');
});

Which is neat, but this actually triggers once the payment has been completed. I want to check just before it is passed to the payment gateway, and, if needed, stop the process right there.

Of course, I can attach an event handler to “knack-view-render” but this would only check the availability during the rendering process. I need it to be checked just before/during the payment intent.

Thanks,
Tomas

Hi @Tomas - I’m not a coder so can’t assist you, hopefully someone else will offer some assistance :blush:

Hi Tomas,

Not sure if you have solved the problem, but the others may use my inputs for similar issues.

Are you storing information about available spots in the Knack db as well?

Do you have db connections that allow you to calculate number of available spots using the Knack equation fields?

If yes, you may try to play with the app wireframe logic and check the spots available without custom coding.

Say, your customers are adding their spot demand through a form, Knack creates a record in the demand table. An equation field links to spot supply table and calculates Spot available number (from spot supply table) minus customer demand number.

The next page is confirm order page - you create a detail view and add two action buttons - adding the names like ‘go to payment’ and ‘not enough spots available, please change your order’.

You set the action criteria: ‘Go to payment’ displays if the equation field (spots-demand) is more than 0, while ‘Not enough spots’ displays when the equation is below 0. The former action button leads to the actual payment page, the latter one redirects them to a respective page in your app.

This way, they would always see one button only, with the content depending on the spot availability check.