Stripe Plugin Error Handling

Hi. I am having a challenge handling errors with the Stripe Plugin. When the transaction is successful (200 OK) the workflow continues. When the transaction fails (eg 402 ERR) it just terminates. I cant find any way to track that the workflow has terminated so I can do some error handling.

I am using v2 of the Stripe Checkout Version. I tried v3 and it just took me back to the same page i was on after success. Either way, i don’t know how to determine if the transaction was successful or not so I can perform other actions.

The sequence of events is:

  • It’s a one off payment and I gather the name, email and amount.
  • When the “Pay” button is pressed, it starts a workflow
  • the workflow hides all clickable elements (so users don’t click away when waiting for app to respond)
  • it then performs a charge to customer transaction
  • if fails, a message pops up (similar to one below) and then the workflow terminates.
    image

I have also tried

  • starting a workflow on an unhandled event
  • starting a workflow when an element has an error running a workflow

If the transaction is successful I want to display a message with the continue button.
If the transaction fails I want to prompt the person to try again.

Any thoughts?
Thanks
Stuart

1 Like

@lateral.business we have the exact same question. I have yet to figure out how to gracefully handle 402 ERR response.

How did you guys ever deal with this?

Surprising that there isn’t clear docs on how to go through the entire Stripe flows! I ran into the same issue and came up with a solution, but it would be nice to hear validation that this is the right path: Use a workflow “When an unhandled error occurs” to trap the terminated workflow and deal with it.

Any insights on this? Any formal docs by Bubble?

@emmanuel @nick.carroll @sam8

This seems like a very important feature. I am also running into issues handling payment errors. I would like to set up workflows to email admins/customers for failed payments (our platform has automatic scheduled payments)

Is there any insight the team can offer?

Great questions. I would need a little more details on the user or payment flows to be able to give more specific answers (especially on when a 402 ERR is being sent), but can try and offer more general insight.

In general, Yes - “When an unhandled error occurs” is probably the most straightforward way to catch errors and handle them manually (instead of browser alerts).

Version 3 of the Stripe Plugin uses the Stripe Checkout experience, which means actions like subscribing the user to a plan or paying for a product happen on a stripe hosted page. As such, error handling will happen on that Checkout page directly (such as an expired card) and the user will only be directed back to the Bubble app on a successful payment.

For automatic payments, like recurring subscriptions, Stripe also has built-in error handling. You can configure these settings in your Stripe Dashboard > Settings > Subscriptions & emails for things like retrying failed payments or notifying the user of a failed payment.

For more custom error handling in Bubble, we recently enabled more thorough error handling within workflows using the API Connector with the option to allow workflows to continue running and expose the error object. In the past, we would simply terminate the workflow if there was an error. If any of your payment flows involve the api connector, this will help give you more control.

Lastly, setting up Stripe Webhooks on specific errors you’d want to handle that might fall outside of the options available in the Stripe Dashboard should give you the most control. API Workflows can be set up to run when a webhook is received to perform whatever action you’d like.

Hope this helps!

3 Likes