简体   繁体   English

Stripe与Python Django连接

[英]Stripe Connect with Python Django

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. 我正在尝试在Python / Django应用程序中设置条纹连接,以便可以让许多承包商从站点进行工作并直接付款。

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: 这将带我进入Stripe建立连接,但是当我在Stripe站点上选择Stripe Connect按钮时,我得到:

127.0.0.1 refused to connect. 127.0.0.1拒绝连接。

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 我的回调URL是127.0.0.1/contractor/stripe_contractor_callback调用是: http://127.0.0.1/contractor/stripe_contractor_callback?scope=read_write&code=my_text_code : 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. 我需要指定127.0.0.1:8000,因为它试图发送回80的正常Internet端口,但是我正在运行Django开发服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM