Can Stripe payment be optional?

I’ve searched here but without success but think this must be easy and I’m just not thinking right!

I have a payment form using Stripe and it’s all working perfectly. However, the form has a select which gives the visitor the option of paying by card (Stripe) or paying by bank transfer. If they select Bank Transfer then I want the form to process all the data but not check the Stripe transaction as there won’t be one. I’ve already set the Stripe card details box to only show when Card is selected but if I select Bank Transfer then it gives an error because Stripe has failed.

Where do I put some kind of condition so Stripe is only processed if Card is selected?

There’s a disabled flag - try that

Thanks @scalaris. Which element should I disable?

The Dynamic Attributes on the form only contain these:

Screenshot 2023-10-28 at 18.23.44

And the Stripe component Dynamic Atributes contain these:

Neither have a Disabled option.

I’m looking at this :

Unfortunately not. That disables the card input but doesn’t stop the processing where it’s needing the Stripe response so I’m still getting the error.

Im out at the moment but will take a look tomorrow AM.

1 Like

Thanks for that. Very much appreciated.

So the issue is on the server connect processing side?

The quick answer is I’m not entirely sure!

@Teodor would be a good person to chip in on this.

The form is submitted as a Stripe form:

<form is="dmx-stripe-checkout-form"

So I think what happens is it requires the response from the API to contain the client secret. This happens fine when someone enters card details but it obviously fails if they select a different method of payment.

So I need to know how the form can be changed to or from being a Stripe form depending on a select value. Or is there a way for the SC API to give a response which the form is happy with if non-Stripe is selected?

I hope all that makes sense. This is another issue where the lack of documentation is making this a lot harder than it needs to be.

So if bank transfer then you want to process a server connect form, correct?

How about having a second form? It would be a server connect form and you would add the hidden attribute to it. Place a series of inputs in that form which have dynamic values referencing the inputs from the Stripe form. In the Stripe form use a default button that doesn’t submit and use a flow to evaluate the value of your card/transfer select and submit the appropriate form.

1 Like

That’s my plan B but is quite a bit of work and overkill if there’s a built-in simple option to just set a dynamic value of whether it’s to be processed by Stripe or not.

It’s one of those things where I’m sure others have needed this option. It might be multiple payment options in a form - Stripe or PayPal for example - or just the chance to submit it without paying at all. Maybe send an invoice for payment later. These are all viable options for any e-commerce site so I’m expecting Wappler to say it’s already built in and this is the dynamic attribute that you change.

We went another way, building our own Stripe integration with API actions - really struggled to get the Wappler Stripe library to function as we wanted and when something went wrong, it wasn’t easy to find out what went wrong.

I’d suggest re-working your flow as you’ve outlined, based on what payment method is selected - that way you can easily expand the options to include additional payment methods in the future. E.g. we’ve just added GoCardless - which is a very nice API for recurring payments.

Interestingly I did have it set up using the Wappler API actions as it was done before the Stripe integration was added. However, it stopped working recently and I just couldn’t get to the bottom of why so I decided to do it again using the Wappler Stripe functionality and it was really easy to use and get working. But, this is the bit I just can’t work out how to do. I’m reluctant to go back to how it was before as I’m still sure there must be an easy way to achieve it.

Hopefully someone from the Wappler team will be able to chip in.

I even tried changing the is= to be dynamic like this:

<form dmx-bind:is="var1.value"

and then set the var1 value to be either dmx-stripe-checkout-form or dmx-serverconnect-form but that broke it all.

@George, @Teodor and @patrick - before I spend time implementing @mebeingken’s suggestion, can you let me know if there’s a way of bypassing/ignoring the Stripe payment in a Stripe form? Please read this thread to get the context.

If there isn’t currently a way, is this something that could be added as I feel sure this is something lots of e-commerce sites would need to be able to do.

Cheers, Jon.

If you want to use a method different than a credit/debit card payment with stripe, why not setup two conditional regions on the page and show 2 different forms? If the user selects a card payment - show the stripe form, if they select a bank transfer, then show the other one.


Thanks for getting back to me. The form has a lot more information in it. It’s not just the payment. It’s a registration form which includes the option to pay at the same time. I don’t like duplicating things and your suggestion means I’d have to make two identical forms, with all the fields, with just the payment fields different.

Or would using an include be the way to simplify it?

I take it there’s no way to disable the Stripe processing based on a dynamic value?

Maybe a 2-step form Jon?
Keep the fields in the second step and prompt for the payment-way in the first.

In a few words
a) A checkbox or select waiting for the payment way
b) A variable with value “bank” if select=“bank” and “card” if select==“card”

All your mutual fields (for bank or card payment) and the extra fields wil be inside a conditional region defined from the variable value

And after all you check on server-side what you do depending (condition) on the values

(never done a stripe payment but I think it is doable…)

1 Like

Yep, that’s a good call.

@Teodor - can I assume there isn’t this facility built in? I just want confirmation before I rebuild the form.


It hadn’t occurred to me that this was a problem, but obviously it depends on the approach. When I’ve offered alternative payment options, the checkout page shows the order details and customer details form - and radio buttons to choose a payment options. Then a confirmation page displays the (non-editable) details again, and a Stripe payment form (if card payment was selected).