Closed andrewjanssen closed 11 years ago
LOL! Thanks for helping, Andrew! I am glad that I could be of help.
:thumbsup: :smile:
@thecurator Hi there, I see that you have used the stripe connect gem, i am also using the gem but have no idea how to integerate stripe connect in my rails app. Will you please guide me if i have to create a new model to hanfle the checkout process and where the post request goes in my rails app? I apologize this bothers you, but i really need some help. Thank you
I can help, Jaffery.
@isaacsanders Thanks you, I am trying to make the post request as mentioned in the stripe connect docs: and i don't know whether where that post request is to be made from Whether form CONTROLLER or MODEL?
The post request from stripe will come to your controller. You should write a controller action that will store the data that you need from stripe for your application.
The data will come in from request.env['omniauth.auth']
.
The following methods are what I used to extract the data my application needed:
def stripe_account_attributes
{
:stripe_user_id => oauth_hash['uid'],
:stripe_publishable_key => oauth_hash['info']['stripe_publishable_key'],
:token => oauth_hash['credentials']['token']
}
end
def oauth_hash
request.env['omniauth.auth']
end
Note: They are methods in my controller.
@isaacsanders Please take a look at this gist: https://gist.github.com/iftikhar0005/d59554a7f4697056d74f Here i have the controller, where i am making the post request? I apologize in advance if i am not making the right request.
@isaacsanders Do you have a omniauthcallbacks_controller or a saperate controller where you are making the post request?
What POST request are you talking about?
@isaacsanders Stripe-connect docs says that after the user has connected, you must make a post request to access request token:
You don't need to know how this works, if you are using omniauth-stripe-connect. The gem is a strategy for OmniAuth.
The gem takes care of the request level abstraction. You just need to link to the right endpoint, and then setup the handler, then you are done.
@isaacsanders Oh.. I see :100:
What part of the stripe docs do i have to follow? If i am using the omniauth-stripe-connect gem.
What are you trying to do?
I am trying to setup payment system for a marketplace like app.
And the application receives payments from the marketplace vendors, and the vendors receive payment from the users?
That's right.
Your vendors need to connect their Stripe Accounts before they can sell, correct? So the integration for this gem would go in their sign up process, or as part of their account details.
You are right. This is part of the signup process for all type of users which are buyers and as well as sellers.
Do i need to use the Stripe API library to make transactions between two users in my app?
For people signing up to be vendors, they need to connect their stripe account. At this point in the app, vendors need to go to /<devise-mapping>/stripe-connect/auth
. Then you need to create a controller action to deal with the data that comes back, and then puts them back into the sign-up process.
The JS API library would be preferable for making the sales, but Stripe also has that capability with their Ruby lib, I believe.
Thank you very much @isaacsanders , i kinda get the idea how would i set it up.. I think you should update the readme a little bit as it would help newbies like myself get insight or at least give them direction where they are headed. I appreciate the work you are doing.
Hi! On my first read through the README.md, I thought I needed to include both the config/initializers/omniauth.rb and the config/initializers/devise.rb code blocks. Doing so seems to result in duplicate oauth calls. Stripe allows the first one but denies the second one, saying that the code has already been used and is now revoked. I spent a bunch of time debugging devise's and OmniAuth's callbacks, only to realize that I should only use the devise initializer.
I thought I should include both initializers because the "Ruby on Rails apps with Devise" section currently says
I understood that to mean that I should add the devise initializer on top of the previous example code, which was an OmniAuth initializer. Anyway, the README.md patch I included may save the next developer some time.
Thanks @isaacsanders for such an awesome gem! This is very useful.