Monday, 7 September 2015

On-Boarding Feature Of Stripe

When User Wants to create Instant account for Payment Process On Stripe, And App Owner wants to add new user under his Current Stripe Account to manage all his app users.

Step 1 :- To Start this, We need a client_id from stripe account. below the screen shot from when we can get client Id in Stripe account dashboard.

Stripe Dashboard => Account Setting => Connect tab => Client Id

Step 2 :- Now add this Client Id in below link where you want to add on-boarding link.

This above link will take user to Stripe On-boarding Form, From where user need to fill all the info related to stripe account.

Step 3 :- Now, The user will then be redirected back to your site (specifically to your redirect_url), passing along either an authorization code or an error ( if the connection request was denied)
So For this, we need to add redirect url into our stripe account. See Below :

Stripe Dashboard => Account Setting => Connect tab => Redirect URLs: 

Dynamically Setting the redirect URI 

For security purposes, Stripe will only redirect a user to a pre-defined uri. However, Connect allows you to define more than one redirect URI, which can be used to further customize the user's experience. For example, you could have some of your users redirected back to "" and others sent to "", each with custom behavior.

First, In Your platform setting (Stripe Dashboard => Account Setting => Connect tab => Redirect URLs:), set the redirect URIs to a comma-separated list of allowed URIs. Second, add a redirect_uri parameter to your authorization request with a value found in your comma-separated list.

Step 4 :- After the user has connected

When the user arrives at Stripe, they'll be prompted to allow or deny the connection to your platform, and will then be sent to your redirect_uri page. In the URL, Stripe will pass along an authorization code:


Step 5 :- Get Stripe Credentials from authorization code

api_key = Secret Key ( Stripe Dashboard =>Account Setting => Api Keys)

client_id = client id ( Stripe Dashboard => Account Setting => Connect => Client Id )

options = {:site => '', :authorize_url => '/oauth/authorize', :token_url =>'/oauth/token', :raise_errors => false}

client =, api_key, options)  ( For this you will need to add oauth2 gem in your gemfile)

resp = client.auth_code.get_token(AUTHORIZATION_CODE, :params => {:scope => 'read_write'})

Stripe will return a response containing the authentication credentials for the user :

  "token_type": "bearer",
  "stripe_publishable_key": PUBLISHABLE_KEY,
  "scope": "read_write",
  "livemode": false,
  "stripe_user_id": USER_ID,
  "refresh_token" : REFRESH_TOKEN,
  "access_token" : ACCESS_TOKEN

and if there was a problem, they'll instead an error.

  "error": "invalid_grant",
  "error_description": "Authorization code does not exist: AUTHORIZATION_CODE"

Stripe provided some more options in this on-boarding process. Use below link for your extra need in app.

No comments:

Post a Comment