Need to stop Stripe Payment screen from resetting Custom States?

I log orders AFTER payment is successful via Stripe.
This is mostly successful but for fields in the order that are stored in Custom States because these custom states are wiped out when the Stripe screen closes. One of these fields contains email recipients so the SendGrid plugin has nobody to send to.
What’s the way around this please? It seems pretty fundamental as payment isn’t always the last step.
Is there perhaps a way to make the Stripe screen appear as a popup that can be shown and hidden?

I assume you’re using the Bubble Stripe plugin… which limits your options for what data you can pass into the checkout session, and therefore retrieve from it afterward…

So, you really need to be logging your order and saving everything you need to save before redirecting the user to the checkout page (which you should be doing anyway)

Anything saved in custom states will (obviously) be gone once the User leaves the page, so you’ll need to save those things permanently before you send you users to the Stripe Checkout page.

1 Like

Hi Adam
Many thanks, as ever, for this.
I’ve managed to resolve this now by, thankfully, doing what you said so your confirmation is gratefully received.
My issue was…
A user buys something to go and collect from a warehouse.
If the order is recorded prior to checkout, then the user can just shut down the checkout screen before paying and the order is created as per usual so along they go and pick up their free goods - not ideal.
I put an “Order Successful” field in the Data Type. It’s set to No by default. The order is recorded with all data, payment is taken, IF AND ONLY IF payment is successful, the “Order Successful” field is switched to YES and the emails are sent using email addresses which are recorded in the order.
Now everything has to be based on an order being set to Yes in the successful tab but also it means I’m trapping orders where payment wasn’t successful so I feel I have a more normal and fuller working app now!
And I had an error in the SendGrid email settings which I’ve now corrected and learned from.
And it’s a 4 day weekend!
So thank you and have a good one!
All the best

Exactly… you don’t mark the Order as complete until the payment has been successful (ideally you use a webhook for that).

Indeed I do…

Have a great weekend!

1 Like