[英]Rails Stripe How To Post Request From Controller
I'm trying to integrate Stripe Connect with my rails application. 我正在尝试将Stripe Connect与我的rails应用程序集成。 Reading the documentation found here , I direct my users to the Stripe connection endpoint and am successfully redirected back to my application receiving the 'code' params from Stripe. 阅读此处找到的文档,我将用户定向到Stripe连接端点,并成功重定向到我的应用程序,该应用程序从Stripe接收了“代码”参数。 Next step is to make a post request to Stripe using this code param, an example they give on their website: 下一步是使用此代码参数向Stripe发出发布请求,他们在其网站上给出了一个示例:
curl -X POST https://connect.stripe.com/oauth/token \
-d client_secret=sk_test_Bt0BtznEVxO2etFU0CZdx4nK \ * This is the secret key from my appication? *
-d code=AUTHORIZATION_CODE \ * Assuming this where I enter the code param *
-d grant_type=authorization_code * Leave this set to authorization_code? *
Which would in return swap the 'code' in return for an 'access_token'. 后者将交换“代码”以换取“ access_token”。 My question is what is the best way of making this post request from my controller? 我的问题是从控制器发出此发帖请求的最佳方法是什么? Should I have the redirect from Stripe containing the 'code' param to an action in a controller that makes the post request? 我应该从包含“代码”参数的Stripe重定向到发出发布请求的控制器中的操作吗? Most importantly What would the code for this post request look like in rails? 最重要的是,此发布请求的代码在Rails中会是什么样子?
Should I then save the access token to the database for the specified user for future ref? 然后,我是否应该将访问令牌保存到指定用户的数据库中,以备将来参考?
Any help / advise would be greatly appreciated. 任何帮助/建议将不胜感激。
Thank you 谢谢
Lee 背风处
Try stripe gem https://github.com/stripe/stripe-ruby . 尝试条纹gem https://github.com/stripe/stripe-ruby 。 And read this doc https://stripe.com/docs/api/ruby 并阅读此文档https://stripe.com/docs/api/ruby
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.