条纹着陆页设置不起作用
Stripe landing page setting not working
我目前正在参加在线课程,在 rails 上使用 ruby 制作类似 airbnb 的 Web 应用程序。它使用 Stripe 进行支付,我想使从我的应用程序到 Stripe 的登录页面成为注册页面而不是登录页面。
我完全按照使用以下代码将注册页面成功制作为登录页面的教程进行操作。
stripe_landing: 'register'
但是我的登录页面仍然是登录页面。我用谷歌搜索了上面的代码,但我能找到的只是 2-4 年前的页面。我想知道 Stripe 最近是否更改了它。 (但 hpar 回复说什么都没有改变)
我把整个代码放在这里...当我点击 link 到 Stripe 时,它会转到 stripe#oauth。
class StripeController < ApplicationController
# Connect yourself to a Stripe account.
# Only works on the currently logged in user.
# See app/services/stripe_oauth.rb for #oauth_url details.
def oauth
connector = StripeOauth.new( current_user )
url, error = connector.oauth_url( redirect_uri: stripe_confirm_url )
if url.nil?
flash[:error] = error
redirect_to manage_listing_payment_path( session[:listing_id] )
else
redirect_to url
end
end
end
然后,
class StripeOauth < Struct.new( :user )
def oauth_url( params )
url = client.authorize_url( {
scope: 'read_write',
stripe_landing: 'register',
stripe_user: {
email: user.email
}
}.merge( params ) )
[ url, nil ]
end
# A simple OAuth2 client we can use to generate a URL
# to redirect the user to as well as get an access token.
# Used in #oauth_url and #verify!
# see this docs https://github.com/intridea/oauth2
def client
@client ||= OAuth2::Client.new(
ENV['STRIPE_CONNECT_CLIENT_ID'],
Stripe.api_key,
{
site: 'https://connect.stripe.com',
authorize_url: '/oauth/authorize',
token_url: '/oauth/token'
}
).auth_code
end
end
终端说;
于 2017 年 7 月 9 日开始为 ::1 获取“/connect/oauth”00:37:55 +0800
由 StripeController#oauth 处理为 HTML
用户负载 (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ?按 "users"."id" 升序限制 1 [["id", 1]]
重定向至 https://connect.stripe.com/oauth/authorize?client_id=ca_AuidWGx68TXWlWO3d3UbWcRcuPqfSeNH&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fconnect%2Fconfirm&response_type=code&scope=read_write&stripe_landing=register&stripe_user%5Bemail%5D=aaa%40gmail.com
所以我想我在这里 url 是正确的(与教程视频相同)。然而,在Chrome中,它实际上转到了;
抱歉解释不当,但如果有人能解开这个谜团就太好了。非常感谢!
根据 Stripe 的文档,最近这方面没有任何变化:
https://stripe.com/docs/connect/oauth-reference#get-authorize-request
你可以通过打开这个例子来测试link:
我试过 safari,它运行正常,所以我删除了 chrome 上的相关 cookie,它运行正常。
我目前正在参加在线课程,在 rails 上使用 ruby 制作类似 airbnb 的 Web 应用程序。它使用 Stripe 进行支付,我想使从我的应用程序到 Stripe 的登录页面成为注册页面而不是登录页面。
我完全按照使用以下代码将注册页面成功制作为登录页面的教程进行操作。
stripe_landing: 'register'
但是我的登录页面仍然是登录页面。我用谷歌搜索了上面的代码,但我能找到的只是 2-4 年前的页面。我想知道 Stripe 最近是否更改了它。 (但 hpar 回复说什么都没有改变)
我把整个代码放在这里...当我点击 link 到 Stripe 时,它会转到 stripe#oauth。
class StripeController < ApplicationController
# Connect yourself to a Stripe account.
# Only works on the currently logged in user.
# See app/services/stripe_oauth.rb for #oauth_url details.
def oauth
connector = StripeOauth.new( current_user )
url, error = connector.oauth_url( redirect_uri: stripe_confirm_url )
if url.nil?
flash[:error] = error
redirect_to manage_listing_payment_path( session[:listing_id] )
else
redirect_to url
end
end
end
然后,
class StripeOauth < Struct.new( :user )
def oauth_url( params )
url = client.authorize_url( {
scope: 'read_write',
stripe_landing: 'register',
stripe_user: {
email: user.email
}
}.merge( params ) )
[ url, nil ]
end
# A simple OAuth2 client we can use to generate a URL
# to redirect the user to as well as get an access token.
# Used in #oauth_url and #verify!
# see this docs https://github.com/intridea/oauth2
def client
@client ||= OAuth2::Client.new(
ENV['STRIPE_CONNECT_CLIENT_ID'],
Stripe.api_key,
{
site: 'https://connect.stripe.com',
authorize_url: '/oauth/authorize',
token_url: '/oauth/token'
}
).auth_code
end
end
终端说;
于 2017 年 7 月 9 日开始为 ::1 获取“/connect/oauth”00:37:55 +0800 由 StripeController#oauth 处理为 HTML 用户负载 (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ?按 "users"."id" 升序限制 1 [["id", 1]] 重定向至 https://connect.stripe.com/oauth/authorize?client_id=ca_AuidWGx68TXWlWO3d3UbWcRcuPqfSeNH&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fconnect%2Fconfirm&response_type=code&scope=read_write&stripe_landing=register&stripe_user%5Bemail%5D=aaa%40gmail.com
所以我想我在这里 url 是正确的(与教程视频相同)。然而,在Chrome中,它实际上转到了;
抱歉解释不当,但如果有人能解开这个谜团就太好了。非常感谢!
根据 Stripe 的文档,最近这方面没有任何变化:
https://stripe.com/docs/connect/oauth-reference#get-authorize-request
你可以通过打开这个例子来测试link:
我试过 safari,它运行正常,所以我删除了 chrome 上的相关 cookie,它运行正常。