Forum Academy Marketplace Showcase Pricing Features

Stripe Payments, "Back End"...Is it really this complicated?

I’m trying to figure out charging Users.
I’m told to do this on the “Back End” because should something go wrong (ie signal drops out during payment) then payment will still be made because it’s done on the “Back End”. That makes sense…BUT
…the payment is done via Stripe so isn’t it being done on their system so doesn’t need to be done on my app’s “Back End”?
The other thing is that there aren’t any Element Actions available when creating Back End workflows which is a problem because my app makes good use of Custom States to store basic stuff like how many of what product is being ordered and because this isn’t available to the Back End workflows I can’t get basic information to log in the transaction. In fact, I’m told that to do this I need to set up Parameters when I set up the Payment Intention in Stripe but to do this I appear to need to install the API Connector and use “Metadata” from the “JSON payload” which is all too daunting.
When it comes to the Amount to charge, I appear at least to be able to Request Data but this doesn’t work, the reference link goes nowhere and there are no options offered to Request the Data from. This is what I see when I try it…

Screenshot 2023-01-23 153103

So, at the moment, I have a button to “Confirm Order and Pay” and when a User clicks it, they’re taken to Stripe’s payment screen via a workflow on the button. A Webhook alerts my app that payment was successful and then I just want to log the order and move on. I’m not sure what I’m doing is very unusual but it seems so horribly complicated. Can anyone help or point me in the right direction or a helpful resource for this or even point me to an example of a payment being taken then the order being logged? I’d be so grateful if they can because I’ve spent 4 days trying to get this far and it’s getting very frustrating.

All the best
Joe

Here’s a simple outline of how I’d approach it:

Pay now button is clicked > create an order (or just use your shopping cart) > send user to Stripe and pass the unique ID of the order in the metadata.

On completion, redirect the user to your thank you page, including the order unique ID in the URL so you can display information about the order

The backend webhook picks up the successful payment, the payload contains a reference to the order’s unique ID in the metadata, so from that you can access all the other data you need to run you payment success workflows.

1 Like

Many thanks for this. It mostly makes sense but I think I’m a bit out of my depth so do you mind if I ask you one extra thing…

When you say “pass the unique ID of the order in the metadata” can you expand on this. I don’t even know what metadata is I’m afraid. Also, I generate my own Unique Ref IDs for orders so do I use these or the really long ones that Bubble does?

If you can give me a nudge to help me understand metadata and how to pass data into it, I can probably work out the rest.

I really appreciate your help as ever. Thank you so much.
Have a lovely evening.
Best
Joe

You must have some form of back-end in order to use Stripe. When you use Stripe Checkout (a form you can copy and paste onto your website), what happens is that Stripe verifies the card and then sends a code back to your server. Then, using that code, your server must make a second request to Stripe’s servers so that the right amount may be charged to the customer’s card.

You can pass it in the decsription field. But I don’t know how to do this with Plugins. That’s why I don’t like plugins for stripe (beyond “charge the user” as that needs JS).

When you say “pass the unique ID of the order in the metadata” can you expand on this. I don’t even know what metadata is I’m afraid.

Metadata is just any additional data you want to pass into the API call to Stripe that isn’t part of that actual functionality of the API call…

So, you just add the unique ID as the value in the API parameter… that way you can retreive it when it gets passed back to your app in a webhook.

Also, I generate my own Unique Ref IDs for orders so do I use these or the really long ones that Bubble does?

I’d definitely recommend using the Bubble generated unique ID for this, rather than any custom generated ID, to avoid any possible errors (plus you can read the unique ID directly from the URL on the success page without having to do any searches).