#ahmed_delta - ACH sample
1 messages ยท Page 1 of 1 (latest)
Hello, happy to help. I am not immediately familiar with that sample but am looking in to it. Is the sample supposed to redirect like that by default or is this a modification that you are adding yourself?
Hi Pompey, thanks for your help! This is a modification I am adding myself.
The stripe payment portion works fine. However, I get error when I try to redirect a user to another page. Initially, I tried to redirect a user via a form post. However, that failed. So I figured fetch might work instead. That failed too unfortunately.
I'm sure if I can see an example of someone using flask/django redirecting their user to another page, then I should be able to figure it out on my own. Thanks!
Can you tell me more about how it failed? Did you get an error message somewhere?
Can you send me your code snippets that you tried out for this as well?
Sure thing. Can you add me as a friend so I can share the snippets?
Please give me about 10 minutes to clean up my code and generate the error again.
I'd prefer you share your snippets in this thread if possible. It will be easier to share if I have to pass this off to a colleague. Of course redact any API keys or anything
No problem. I'm doing that right now ๐
here is what I add to server.py
here is my success page
and in the stripe javascript code, I attempt to enter the success page with the following code
however, my page doesn't redirect
I hope that helps explain the problem.
Does your client page see the URL that you are trying to pass back to it?
It may also be worth it to do a server side redirect instead of a client side one here
Yes it does. In the developer tools, it shows the request as status code 200. However, it doesn't re-direct to it.
Do you have js code on the client side that redirects to the URL in that json?
If you want it to immediately redirect, it may be easier to just do a 303 redirect to your /success URL https://stackoverflow.com/questions/408541/how-to-produce-a-303-http-response-in-django
That will tell the browser to redirect as soon as it gets the response instead of relying on client side js
I see. Okay, I'll take a look at that.
I initially thought I was doing a server side redirect because in my flask code, I have a route that renders the template 'success.html'
Something else I just noticed is that the page does load on the developer tools. However, I can't get it to load to the user
Can you send your client side code hat reaches out to the endpoint that you want to redirect?
That is it. I am bouncing around a couple other threads but should be able to look in to this again in a few minutes.
No problem at all. I am trying my own workarounds. I'll let you know if I end up solving it before you.
Figured it out!
inelegant solution, but I ended up creating a new form within payment.status == 'processing' and submitted it from there
Nice!