How to finish workflow on different page after purchase?

Hi!

I’ve set up Stripe so that after a buyer pays a seller in a marketplace, the buyer will be redirected to Stripe checkout page, and then brought back to my Bubble app.

The issue I’m having:

  1. Buyer clicks to checkout for a digital item
  2. In the same workflow they receive an automatic download and I create a transaction record

The problem is this flow happens instantly even if the charge fails or if they simply go back to the bubble app without completing payment. Thus receiving something they didn’t pay for.

What I need to do is:

  1. Buyer clicks to checkout for a digital item
  2. Buyer redirected to Stripe
  3. Buyer taken back to my bubble success page after successful purchase, only then is a transaction record created and they receive the download

I understand parameters for the most part, however the download and transaction record rely on information coming from a repeating group item that it can no longer reference :(.

What would be the easiest and/or best way to reference the original purchased item? Can I temporarily store information somehow?

Thanks for your help!

You shouldn’t run the ‘create a transaction’ workflow, or any other post-purchase actions in the same workflow as the Stripe checkout is created, as the user may not even complete the payment, but your transaction will still be created, and access given to the (non)customer for download.

You should also NOT rely on using a success page on your app for post-purchase workflows (like creating transactions, or giving access to certain parts of your app).

A payment might successfully go through, but there could be any number of reasons why the customer may not reach the thank-you (success) page (connectivity issues, hitting the back button, a power-cut etc.), so your workflow will not be triggered and the customer won’t get access to what they’ve just paid for.

Conversely, it’s also possible for people to reach the success page when they haven’t made a purchase (perhaps a buyer shares the success url, including any parameters with a friend, or a buyer bookmarks the page and revisits it several times).

In these cases you’ll end up with transactions created for people who haven’t paid, or duplicated transactions for the same buyer.

So using ‘in browser’ workflows based on users visiting a particular page in your app is not best practice for handling post-payment processes which must only be done upon a successful payment.

Instead, use a Stripe Webhook to trigger an API Endpoint in your app, and run the necessary actions there (create the transaction, allow download access to the user etc.). You can pass all necessary data needed for the workflow through to Stripe, and back to your app via a Webhook, using URL parameters in your initial checkout call.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.