I'm trying to set up stripe connect in a Python/Django application so that I can have a number of contractors taking work from a site and being paid directly.
I'm trying to get authorisation by getting a token for a new contractor. I've got the following view:
def authorise(request):
site = 'https://connect.stripe.com' + '/oauth/authorize'
params = {
"response_type": "code",
"scope": "read_write",
"client_id": STRIPE_CLIENT_ID
}
# Redirect to Stripe /oauth/authorize endpoint
url = site + '?' + urllib.urlencode(params)
return redirect(url)
This will take me into Stripe to setup a connection but when I select the stripe connect button on the Stripe site I get:
127.0.0.1 refused to connect.
My callback URL is 127.0.0.1/contractor/stripe_contractor_callback and the url call is: http://127.0.0.1/contractor/stripe_contractor_callback?scope=read_write&code=my_text_code
What am I missing?
EDIT
I've just noticed it will also not take me to a different page if I just type in a URL which I know if valid
The problem is the callback. I need to specify 127.0.0.1:8000 because it is trying to send back to the normal internet port of 80 but I'm running Django development server.