Stripe payments without price id

I have created sites with stripe a few times over the years with no issue. I went to create a new payment page today based on my own shopping cart and the old Stripe component is gone and I can see Stripe Elements and some other components. I did see a new doc on embedded shopping carts which looks good but it seems like you have to add products to stripe to get the price id. I want to setup a stripe payment based on a calculated price on my page but not sure how to do this with the new stripe components. Is there a new doc coming for this soon or has anyone else had experience with this?

So I have moved on and started playing with the new stripe components, looking at old projects and seeing how they relate. I created the server side payment intent and set it up to return the client secret. I added the Stripe Elements appconnect component and the stripe key. I set it up for With intent and then tried to use the data binding selector to add the client_secret and it popped up a notification saying "Server Data Bindings are only available in NodeJS!" I am using php so it won't let me select the data binding. This has never happened before and doesn't seem right. Is it a bug?

If you want to use the client secret with a dynamic value you can use the Dynamic Attributes > Stripe > Client secret.

Thanks Teodor. I really like the Embedded Checkout method you use in the docs. I have tested and it works well. Is there a way to do that without the Stripe price_id? I would prefer to use a dynamic product name, price, quantity, shipping etc. For this project I have a local database and the products are added there. Don't really want to duplicate on Stripe if I can help it.

In your case the flow should be using the payment element and then you create a payment intent with the amount to be paid (on the server side).
From what i understand this is what you're currently doing?

Thanks Teodor, that is what I was wanting to do. Would I use the same server connect as per embedded but set to default or is there a different template in this case?

the template is for the embedded checkout. For your case you need to setup a payment intent, so it will have different settings.

Thanks Teodor. More like the previous way I had done before. No problem. Thanks for the help.

Hi Teodor, I am lost.
I have the Stripe element component bound to the client secret and the stripe payment component accepting the card details.
On the server side I have a payment intent that is created and then another one updated when the form submits. I can't set an acceptable payment method on the intent. I tried using the List Payment Method Configurations server connect to provide the payment configurations but that didn't help.
I feel like the payment method should come from the form as the customer fills in their card details which defines that it is card. What is the format required in the payment intent to designate card? The stripe documents have not helped.
This is for a payment of a shopping cart total rather than a list of line items or an embedded checkout. It should be easy as I have done it before for simple payment forms but I am struggling with these new components.

The create payment intent action should have an option automatic_payment_methods.enable which you can set to true. The stripe payment element will then show all available payments methods that you have configured in the dashboard.

image

Perfect. I was trying to set the payment method in the payment intent. I removed that and it worked! Thanks Teodor!

Add this to Stripe docs.

Actually it stopped throwing errors at the server connect step but Stripe dahsboard says no payment method. The stripe payment element looks like it is working in that it sets up for a card payment ok. How is that collected information transferred to Stripe? With the old method you had to convert the form to a stripe form but that does not seem to be an option with the new elements. Only API or Server Connect.

I can see the Stripe Elements element has a dynamic attribute for Payment Method Types. Should that get the payment type from the Stripe Payment element (I tried stripepayment.value but does not work)? I feel like the Stripe payment element knows the payment method and that should then be passed to the Stripe Elelement or the Payment Intent. It is not working as the Stripe dashboard says no payment method selected by customer

I could not get this to work. Went for old style Stripe hosted checkout until the Wappler stripe implementation is documented / fixed.

There's indeed a small issue with some options missing from the UI of the payment confirmation on the front end.
We will be adding these to the UI along with the docs how to create custom checkout pages.

1 Like

Thanks Teodor