Redirect customer from thank you page

Hey! Im sending a api request to my own server and getting a link from there, And then i want to render a button that will redirect the user to the link i got from my server.

I only found the option to redirect users after they click a button via the “to” attribute, But i need to first send api call, get a link and then redirect the user.

Any solutions? :disappointed_face:

what?