Send email only upon successful payment? (Stripe integration)

Hi,

I have a form where people sign up for events, choose the membership type (price) and then submit the form, that takes them to stripe to complete the payment.

The problem is when the submit button is pressed it processes and sends all the form information, irrespective if payment is made. So we often find people fill the forms but don't pay, and it's difficult to admin for popular events to see who has paid or not.

Is it possible for any conditional logic linked to stripe where the emails are only sent for successful payments? Or is there a php script which will work?

Many thanks in advance!

Replies are visible only to logged in members with an active subscription.