Stripe session url redirect with the Browser ⏭

The createCheckoutSession.url redirect server side creates a CORS error so Stripe recommends a client side redirect on success of the submit form, using “window.location”, eg the browser component. But the goto action is silently failing to do the redirect (I do get a 200 response but page remains idle)


Any hints please to what I should check?

I see this message in the Console, if anyone understands the meaning:


Any clue why the Browser does not fire the goto action upon success of the submit form?

Probably an error in the expression used for the goto method that you are calling.

Thanks, I’ve checked and the expression looks correct, doesn’t it? I’ve followed @Teodor’s solution shared in this Make the new Stripe url avaialble post.

Checked the code for you at the line it generated the error. I could probably improve the code there a bit, but the error comes when the url is not given, so the expression returned null or undefined.

1 Like

“null/undefined” yet my set value does return the url from the session create which I use in my Browser goto. :thinking: But I get it… there is a mysterious “redirect” with null value.


Looking forward to your fix, thanks Patrick

But your screenshot shows that you are calling this url from under createCheckoutSession, so expand it and see if it really returns a value:

You are not using this setvalue step in your GoTo action.

The session does generate a url:

And my Browser does use the set value (I’ve tried both direct binding and thru set value):

But was the value set at the moment you called the goto action, so didn’t you perhaps call the goto action to early before that value was set. At which moment do you call the action, perhaps you could use a flow instead with a wait step before calling the goto action to have a short delay to make sure the value was set.

SetValue is after the session create in my API steps:
image
And anyway it is the same problem when Browser goto fetches the url straight from the session.

And the Browser goto action is on Success of the submit event:

Not understanding how your suggested flow makes it better.

UPDATE: I tested both with a 2s wait and with a condition (if a set value has a url then run goto) and the browser is still idle, with a redirect: null in the dev tool response.

Please update us on the proposed next step (fix or more testing?) so I can spend a peaceful weekend… :grinning:

Please replace the dmxBrowser.js with the following one.

dmxBrowser.zip (1.6 KB)

The updated version should give a warning in the browser console when there is no url passed to the goto action and it should also output the data variables from that moment.

1 Like

Thanks Patrick, so I’ve replaced the file inside C:\Users\fredk\WprojectX\dmxAppConnect\dmxBrowser then uploaded the installed file to our remote. I get this message in the browser console:

Are you sure you uploaded it, it still shows the old message. Also make sure you clear cache, it is possible that it loaded the old file from cache.

Cleared the cache (good catch!) and browser won’t take the url. I’ve put a 3sec wait in the flow.


Whether I bind the session url directly or through a set value (which does get the session url):

<form method="post" is="dmx-serverconnect-form" id="bookBtnForm" 
action="dmxConnect/api/user/stripeCheckout.php" 
dmx-on:success="run([{wait:{delay:3000}},{run:{action:`browser.goto(stripeCheckout.data.createCheckoutSession.url)`}}])">
<button id="bookOffer" class="btn btn-primary btn-sm rounded-pill" 
type="submit">Book this offer</button>
<input id="offerID" name="offerID" value="" dmx-bind:value="OfferID" type="hidden">
</form>

Is it an issue with our code or flow or the Browser still?

The source maps show the wrong code, the warning is something that I added. It should also output the data structure in the console, you can use that to see which data was set at the moment of the warning.

By source maps you mean I didn’t upload the dmxBrowser.php file that you sent correctly?
Or is it some other file?

Just open the browser console and check for any output there.

Not sure how to read the console’s output so may I share it here for your review:




What do you read?