Integration Stripe - price not fixed

I have a problem with the stripe checkout integration.

I’ve configured Stripe correctly by providing the 4 keys (public live, secret live, public test, secret test) and I can then insert the Stripe form.

However, when I add it to a form container, I’d like to do the binding with the variable: “payment_intent_client_secret”, but it’s not proposed.

How can I do this? Is this a bug?

Did you create the client secret using a workflow as explained here? Stripe | WeWeb documentation

Thank you for answer. That’s exactly what it was !

However, I can’t figure out how to set the Stripe payment amount. I’ve seen that you have to create a product in Stripe and provide the price ID. However, I’d like to sell products that will all have different prices (and not necessarily created in Stripe beforehand).

Do you know how I can do this?

Thanks for your help.

To be honest, I don’t know as it depends on Stripe entirely for this. Maybe can you pass the price dynamically. Please check their docs on how to do it: Manage products and prices | Stripe Documentation

I’m pretty sure you will need a backend to generate the custom price. If you could send the price from the front end it would mean anyone could pay the price they want :thinking:

Stripe has probably an API to generate stripe product, returning the price ID the front end need to use.

You can indeed create payment intents or checkout sessions with amount created on the fly without the need to create a stripe price before. Of course you need to send the request from your secure backend.

2 Likes

I have a similar issue: Similar insofar as I only have one product with a fixed price but depending on the buyer’s country, VAT should be added to this price. For example: The net price is 100€. We are based in Germany. If a German customer buys the product, the total amount is 100+100*19/100 = 119€. The total amount is correctly calculated on our Order form but only the price of the product defined in Stripe is used. There seem to be a VAT feature in Stripe but I don’t understand how to use it. On our order form, I’m requesting all buyer data like country, address, VAT Id, etc. but WeWeb cannot send the calculated price to Stripe.
There are some Stripe help pages in dorilama’s answer but that is way too complicated.
The problem is that the stripePaymentIntent variable is only created/filled AFTER sending the payment. I cannot change the amount item. IMHO WeWeb should implement an amount parameter which will then be used in the stripePaymentIntent variable. If I add the Stripe element, there’s even a Prices field in the Create payment intent workflow step (see screenshot) but if I use it and test, an error is displayed (no product defined).

image

One possible solution came to my mind just now: I could add another product including VAT and choose it using a formula which depends on the country. This worked!!!

Any idea how to achieve my goal in an easy way?

what backend are you using? xano should have guides/recipes to make api requests to stripe.
the idea is to create a paymentintent/checkout session using your secure backend, then use this data in weweb to use in the stripe element or redirect to the stripe-hosted checkout page.

Hi Mariano,
I’m using Supabase. They also got a wrapper for Stripe but I’m not an experienced programmer and also I think that WeWeb should provide a better way to achieve the desired result.
Anyway, I’m kind of happy with my solution, i.e. having different rates for with and without VAT and selecting the price_id according to the buyer’s country (plus whether they have a VAT Id or not). Since I only have one or two products, this is feasible. But for someone with many products, the effort of having two rates for all of them might be too much.