Stripe Checkout Session - bug

Hello,

I’m having trouble setting up a payment using the Stripe Create a Checkout Session event. It was working fine until this morning, but I’ve been experiencing an issue since then.

First, I create a Stripe customer if the customer doesn’t exist and associate it with my user. Then, my workflow creates a checkout session, and I use the “Open an external workflow” action with the URL of the checkout session.

Every time I test it with a new user, my app crashes, and I receive an error message indicating that my app is encountering a temporary bug.

I tried to catch the error and create a log when it occurs. I get the error message 8 times: Error Getting Server Outcome

I’ve attempted the following for debugging:

  • Using the debugger in a step-by-step mode
  • Creating a log between each step of my workflow (they appear as expected)
  • Reviewing the logs, and it seems like my workflow stops at some point.
  • Look at the console
    I can see 14 times this error :
    Error handling response: Error: runtime/sendMessage: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
    at

Have you encountered this error before?
Considering that if I refresh the page and try again, it works fine.

Thank you so muchh 🥲

I had a lot of fun implementing stripe in a few apps.

I’ve found that it’s best to baby step the whole stripe process. When a user creates an account or starts a checkout (adds item to cart) I do the customer and intent api calls in the backend (I use backend here because stripe can take a few seconds to complete them and I don’t want to lag the user).

Then on checkout page I update the intent to the latest cart total (which I’ve calced via front end custom workflows on each cart item change so it’s immediately visible to user).

I normally break the checkout experience into 2 steps.

The first step is customer info - this is where I send the stripe intent update call whilst the user is distracted for a few seconds filling out a form.

Then when they click next the payment block has the updated intent all ready to go and loads up instantly (stripe has a little loading animation here). I also set this to 100% height so that it expands to fit the zip code field which gets added for US cards.

on stripe submit I usually change the state to “processing” and show a loader for the user since stripe will take a few seconds… 3-5 usually to process and return the success response.

I also add an error state to the checkout and disable the charge button until the stripe element is filled/valid.

then on success I’ll run a front end workflow to update the cart and redirect and an api workflow to do backend stuff like iterating through the cart items to make an order for fulfilment or whatever.

In short - I think you’re trying to do too much at 1 time with stripe api and you need to break it out into the stages where it makes sense to do the calls.

1 Like

Okk thanks, I’ll try a bit more step by step then !

Do I need to create a payment intent or can I just create the checkout session and make him/her pay directly?

Even if I create the customer, and then wait for a few minutes, I have still have this issue…

Depends on the stripe version and the api calls you are using.

V1 charge a user skips the customer and intent
V2 confirm payment needs a customer and intent

The conditions on my workflows were to heavy and it made everything freeze apparently