【发布时间】:2016-09-23 06:54:36
【问题描述】:
我希望客户能够在我的 Rails 应用中更新他们的信用卡详细信息。 Stripe 有关于如何实现这一点的文档,但文章显示了一个 PHP 示例,但我需要一个 Rails 示例:https://stripe.com/docs/recipes/updating-customer-cards
基本上,我需要保存客户的信用卡而不收取任何费用。
这是subscribers_controller.rb:
class SubscribersController < ApplicationController
before_filter :authenticate_user!
def new
end
def update
token = params[:stripeToken]
customer = Stripe::Customer.create(
card: token,
plan: 1212,
email: current_user.email
)
current_user.subscribed = true
current_user.stripeid = customer.id
current_user.save
redirect_to profiles_user_path
end
end
【问题讨论】:
-
看看这个页面可能会有所帮助support.stripe.com/questions/…
标签: ruby-on-rails ruby stripe-payments