Creating orders only when payment successfully received

I’ve got an app where people can order things to collect from a warehouse later. My problem is that, due to my own inexperience, I’ve set it up so that ordering and paying is all done on the “front end”. This means that currently you can order your stuff, the app logs it, sends the order to the warehouse for collection and then Stripe takes the money. Subsequently this means that;

  1. when you get taken to the Stripe payment page you can just shut the browser and because the order’s done and registered at this point it’ll be waiting at the warehouse without you paying. Obviously that won’t do!

  2. The payment stuff with Stripe needs to be done on the back end instead so that things continue to process if, for example, signal drops out during the transaction etc

So…

I’ve created a Back End workflow and used Webhooks to trigger it when Stripe’s successfully received payment. Currently this WF just sends me a “Send Ssuccess email” when Stripe pings the success.

I now want to move all the order creation workflow actions from the Front end to the Back end and replace the “Send Success Email” action with them all. However a lot of the information for an order comes from Custom States and there’s no “Element Actions” option on the Back End workflows so I’m a bit stuck.

I thought I was nearly there with building this app and this is my last hurdle (until the next one) so if anyone can offer successful guidance, I’ll be delighted.

Many thanks
Joe

Stripe allows you to send a parameter when you create the payment intent.

This is then sent back to you as part of the webhook.

Alternatively you can store the payment id and then look this up in the same way.

That means you can find the thing that needs processing in your database and do everything you need to complete the order.

Nigel, thank you so much for taking the time to answer my query.

When you say "Stripe allows you to send a parameter when you create the payment intent.

This is then sent back to you as part of the webhook."

Can you tell me or point me to a resource that will tell me, how I get hold of and manage this parameter?" Presumably then I can create a B_E WF that is conditional on that parameter?