Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load payment element #1727

Closed
darylknight opened this issue Jan 21, 2025 · 6 comments
Closed

Could not load payment element #1727

darylknight opened this issue Jan 21, 2025 · 6 comments
Assignees
Labels
issue Something isn't working correctly

Comments

@darylknight
Copy link

darylknight commented Jan 21, 2025

What happened?

There's a live form here that I recently upgraded from Freeform 4 to 5, and I cannot get the Stripe integration to load. The keys are correct and there's a green "authorized" for the integration on the backend. It's not a multipage form.

The stripe field just shows "Could not load payment element.". The Freeform docs only mention this in the context of a multipage form.

The value is meant to be coming from the Individual/Clan (Family) radio field, which have 25 and 50 values. Settings screenshot attached.

Am I doing something wrong, or is this related to #1670 ?

Image

Errors and Stack Trace (if available)

How can we reproduce this?

  1. Add a stripe integration

Freeform Edition

Pro

Freeform Version

5.8.7 (also happens on 5.9.0)

Craft Version

4.13.7

Additionally, when I view this site in local dev, I see this error in the console:

Image
@darylknight darylknight added the issue Something isn't working correctly label Jan 21, 2025
@kjmartens kjmartens self-assigned this Jan 23, 2025
@kjmartens
Copy link
Contributor

Sorry for the delay and the trouble you're experiencing @darylknight.

I don't think this is related to #1672, as that was corrected. 🙂

If you try updating to 5.9.1.1 and enable the new Debug log (Settings -> General -> Integrations Logging Level), and load the form again, what shows up in the log?

Also, please review the Best Practices guide here:
https://docs.solspace.com/craft/freeform/v5/integrations/stripe-payments/#best-practices

If the issue persists, can you attach a screenshot of what the Stripe integration (inside the Integrations tab of the builder) looks like? And also what the option values look like for the Choose your membership type field.

Thanks! 🙂

@darylknight
Copy link
Author

Thanks :)
The only thing that shows in the new log is this:

[2025-01-23T16:30:37.685793+00:00] stripe.DEBUG: Mapping processed {"category":"customer","mapping":{"email":""}} {"requestId":"Hksu8e"}

Here's the screenshot of the integration:

Image

Here are the values for Choose Your Membership:

Image

@kjmartens
Copy link
Contributor

Ok, I can duplicate this issue as well. It's pretty much the same issue as #1672, as you mentioned, but applies to Radio fields specifically (whereas the fix was applied within the context of the Calculation field type.

Note

Interestingly enough, there was a fresh 5.9 issue with Calculation fields in the builder, so please update to Freeform 5.9.1.2+ first.

I will have a developer work on a fix for this, but in the meantime, if you want to get things resolved immediately, you can work around this by adding a Calculation field type to your form:

  1. Add a Calculation field to the form layout, e.g. My Calculation Field

  2. Set the Calculation field to be hidden, assuming you don't want it displayed an additional time in the form.

  3. Add the handle of the Choose your membership type field as the logic for the Calculation field, e.g. chooseYourMembershipTypeRenewableEachYear. You can just use the "Insert Field" dropdown to pop it in there.

    Image
  4. Update your Stripe field to look to your new Calculation field as the Amount field.

  5. Save the form.

It should work now. Once the new fix for Radios (and likely other) field types is in, you can switch the Stripe Amount field back to chooseYourMembershipTypeRenewableEachYear and delete the Calculation field we added as a workaround. 🙂

Warning

One last note... in your Donation form that you send in private support ticket, you are not selecting any default radio option, so that will always fail. If you wish to have the Stripe field on a one-page form, you'll need to have a default option selected. This is out of our control, as it is a Stripe requirement. If you wish to have no default option selected, the Stripe field will have to be on a later page in the form.

Please let me know if you have any further questions. 🙂

@darylknight
Copy link
Author

Hey Kelsey,

Thank you for such a detailed reply and the workaround. I've just applied this to both forms and they are both working with the workaround. Although it might be worth pointing out that the Become a friend form continued to show "Could not load payment element" until I removed the Stripe field and re-added it again. As far as I could tell both forms were identical but it still wasn't working. All good now. I've used a hidden calculation field as you suggested, but getting that patch live would be great too.

Thank you!

@kjmartens
Copy link
Contributor

The real fix should be available later today or early next week. 🙂

@kjmartens
Copy link
Contributor

This should now be resolved in Freeform 5.9.2+ 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

2 participants