Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support stripe_express: true in the the OmniAuth URL helper #2

Open
wants to merge 2 commits into
base: suggested_capabilities
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ Then you can hit `/auth/stripe_connect`

If you hit `/auth/stripe_connect` with any query params, they will be passed along to Stripe. You can access these params from `request.env['omniauth.params']`. Read [Stripe's OAuth Reference](https://stripe.com/docs/connect/reference) for more information.

### Stripe Connect Express

Stripe Connect Express accounts are supported by declaring the `stripe_express` and `suggested_capabilities` params (devise example):

```ruby
config.omniauth :stripe_connect, "STRIPE_CONNECT_CLIENT_ID", "STRIPE_SECRET", stripe_express: true, suggested_capabilities: ['transfers']
```

If you need to to support both Standard and Express accounts in the same project you also have the option of setting these paramters using the omniauth url helper:

```ruby
<%= link_to 'Authorize Stripe Connect', user_stripe_connect_omniauth_authorize_path(redirect_uri: user_stripe_connect_omniauth_callback_url, stripe_express: true, suggested_capabilities: ['transfers']) %>
```

## Auth Hash

Here is an example of the Auth Hash you get back from calling `request.env['omniauth.auth']`:
Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/stripe_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def callback_url

def request_phase
stripe_client = client
stripe_client.options[:authorize_url] = "/express/oauth/authorize" if options[:stripe_express]
stripe_client.options[:authorize_url] = "/express/oauth/authorize" if options[:stripe_express] || (authorize_params['stripe_express'] == 'true')

redirect stripe_client.auth_code.authorize_url(authorize_params)
end
Expand Down