Webflow script for pulling URL and then redirecting
Options
![Lachlan Hamilton](https://us.v-cdn.net/6037124/user_avatars/3700808.jpg)
Lachlan Hamilton
Member ✭
[Screen Shot 2022-03-11 at 10.31.25 am.png]Hi all,
I'm attempting to pull a link from a Stripe onboarding API (which, by the way, works in the debugger in Xano). The user clicks a button, the API is called, the link is pulled and passed to Webflow, and the user then needs to be redirected.
It doesn't seem like a difficult thing, but I don't know the script for Webflow. Can anyone help?
I'm attempting to pull a link from a Stripe onboarding API (which, by the way, works in the debugger in Xano). The user clicks a button, the API is called, the link is pulled and passed to Webflow, and the user then needs to be redirected.
It doesn't seem like a difficult thing, but I don't know the script for Webflow. Can anyone help?
Comments
-
At the risk of breaking up the no-code vibe: in my experience, often this is handled with a small bit of javascript on WebFlow. How it gets triggered depends on how you have set the button to call the API. (and if you haven't yet - it's not that bad using $.ajax) Within that snippet you would extract the target URL from result as stripeUrl, and then run:
window.location.href = stripeUrl
and you will get redirected immediately.
This can be easier to show and walk through than tell, so let me know if I can help better! -
Hi Ray - thanks so much. Yes, completely aware that it's my webflow code that I need to get right. This is what someone wrote out for me, and I added the API url:
function createStripeExpressLink() {
// URL here is your link
fetch('https://x8ki-letl-twmt.n7.xano.io/api:G2T11kbZ/CreateStripeExpressLink?account=accountID')
.then(res => res.json()) // extract json response
.then(result => { // process json res result and redirect
const redirectURL = result.url
window.location.href = redirectURL
})
}
-
I just ran that - Xano is showing a GET request instead of what should be a POST request.
-
Would love your help on this Ray, have opened a chat on your site. Look forward to chatting soon.
-
wonderful!
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback