条纹连接 Python Django

Stripe Connect with Python Django

我正在尝试在 Python/Django 应用程序中设置 stripe connect,这样我就可以让许多承包商从一个网站上工作并直接获得报酬。

我正在尝试通过为新承包商获取令牌来获得授权。我有以下观点:

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)

这将带我进入 Stripe 以设置连接,但是当我 select Stripe 网站上的 stripe 连接按钮时,我得到:

127.0.0.1 refused to connect.

我的回调 URL 是 127.0.0.1/contractor/stripe_contractor_callback 而 url 调用是:http://127.0.0.1/contractor/stripe_contractor_callback?scope=read_write&code=my_text_code

我错过了什么?

编辑

我刚刚注意到,如果我只输入 URL 我知道它是否有效

,它也不会带我到不同的页面

问题出在回调上。我需要指定 127.0.0.1:8000 因为它试图发送回正常的互联网端口 80 但我是 运行 Django 开发服务器。