Rails Stripe如何从控制器发布请求

时间:2014-07-30 09:39:42

标签: ruby-on-rails http-post stripe-payments

我正在尝试将Stripe Connect与我的rails应用程序集成。阅读找到的文档here,我将用户定向到Stripe连接端点,并成功重定向回我的应用程序,接收代码' Stripe的参数。下一步是使用此代码参数向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? *

作为回报,它会交换“代码”'以换取' access_token'。我的问题是从我的控制器发出这个帖子请求的最佳方法是什么?我是否应该从Stripe重定向包含'代码'对发出请求的控制器中的操作进行参数调整? 最重要的是这个帖子请求的代码在rails中会是什么样子?

我是否应该将访问令牌保存到指定用户的数据库以供将来参考?

非常感谢任何帮助/建议。

谢谢

1 个答案:

答案 0 :(得分:0)

相关问题