craft-freeform icon indicating copy to clipboard operation
craft-freeform copied to clipboard

Stripe could not load payment element error

Open icreatestuff opened this issue 4 months ago • 2 comments

What happened?

We have a form with a Stripe field set to allow dynamic payments via an 'amount' field.

Using the form Rules we have the Stripe field set to only display if a checkbox is ticked.

The checkbox appears before the amount field in the order of fields within the form.

We've noticed that if the checkbox is ticked, there is an AJAX request sent to initialise the Stripe Element which fails because there is so far no 'Amount' set - that makes sense. However when an amount is then set within the field, that AJAX request isn't being re-run meaning the Stripe element is then never initialised.

I believe this has only started to be the case since Freeform v5.6.3. Beforehand it seemed as though any change or keyup for the amount field would re-trigger the Javascript.

Errors and Stack Trace (if available)

No response

How can we reproduce this?

  1. Create a form that uses a Stripe field set to have a dynamic amount based on a number input field
  2. Have the Stripe field hidden until a checkbox is ticked
  3. Tick the checkbox and notice the Stripe field appear but is not rendered
  4. Enter an amount in the number field and notice the Stripe field remains uninitialised

Freeform Edition

Pro

Freeform Version

5.6.3

Craft Version

4.12.5

When did this issue start?

No response

Previous Freeform Version

5.6.2

icreatestuff avatar Sep 30 '24 09:09 icreatestuff