Forum Academy Marketplace Showcase Pricing Features

Error from Toolbox Run Javascript

I’m implementing a Stripe Integration I have implemented in numerous other applications.

I am implementing it in the same exact way. Part of the implementation is to use the Run Javascript workflow action to direct a user to the Stripe Connect Page using the below approach

Screen Shot 2021-08-12 at 6.39.42 PM

All details are correct in the dynamic expressions, however, I always get this error and I’m not directed to the Stripe checkout page

Screen Shot 2021-08-12 at 6.39.29 PM

@mishav does this error code mean anything to you? I’ve tried everything I could to figure out how to resolve it, including changing the dynamic expressions to static values, and nothing seems to work.

Has anybody else experienced issues with the plugin recently?

This looks to me as though the Stripe library is not loaded at the point at which this script is executed. Stripe() should become a defined constructor method once it is. How are you loading the Stripe library into the page?

Have you tried wrapping it in an jQuery document ready event? (Though this only really makes sense if you’re executing the above during initial page loading…)

$('document').ready(function(){});

Otherwise checking that the library is pulling down correctly would be my second test.

1 Like

Thank you @edwardbutcher for the insight. I kept thinking the Stripe()reference in the error code was referring to my dynamic value used for the publishable key. Completely forgot about the script on the page.

Just added the script to the page using an HTML element and it is working now.

Thanks for the help.

By the way, when trying to figure this out, I came across an alternative approach, to use the Open External Website workflow action and use the API calls URL, which worked well.

Do you have any thoughts on the different pros/cons of either approach?

2 Likes

I haven’t done a huge amount with Stripe so probably not qualified to comment.

If using the URL route saves you loading the Stripe JS library then that equates to a 300kb saving which seems like a benefit. Though it’s likely you’re using other parts of the library elsewhere in your app - token generation etc. - so removing it may not be an option.

There’s maybe the fewer things to break argument with the URL / params approach. I go with whatever reliably works so if they both pass that test then I would happily settle for either.

1 Like