Hi @patrick
FIRST ERROR
The JS Snippet (below) is included in the content page, keeping it within the ‘body’:
</div>
<script>
var stripe = Stripe('pk_test_MYKEY');
function runStripe() {
stripe.redirectToCheckout({
sessionId: dmx.parse('emailPack1form.data.stripe.data.id')
});
}
</script>
</main></div>
</div>
</div>
</main>
<script src="[bootstrap/4/js/popper.min.js](http://localhost:8100/bootstrap/4/js/popper.min.js)"></script>
<script src="[bootstrap/4/js/bootstrap.min.js](http://localhost:8100/bootstrap/4/js/bootstrap.min.js)"></script>
</body>
</html>
This is what it looks like in Wappler code editor:
This is what it looks like when I view source in the fully rendered page:
And the <script src="https://js.stripe.com/v3/"></script>
link is in the within the header on the layout page. Within the <header></header> tags.
As per the Stripe tutorial mentioned above, I have on form success a FLOW:
Wappler code editor view of the on-success form and FLOW:
The Server Action executes perfectly, and what should then happen on success is the redirect action. However, this is what I get:
I’ve followed the tutorial word for word, everything works except running the JS to redirect with the session ID to Stripe. So any help here or how I can debug further would be appreciated.
I’m no JS dev - so I’m sorry but I don’t know how to run this in the console. However I have pasted the JS snippet (without the script) and tried to run it that way - and it returns ‘undefined’ in the console, too.
I’ve now also tried creating the sessionId and inputting that manually in the sessionId incase it was dmx.parse that was causing issues - no change, same error.
SECOND ERROR:
This is now fixed. Redirect element is working fine, I had switched SC’s and this was an incorrect endpoint for billing portal.