我正在尝试遵循一些教程,遇到了一些错误。希望有人可以帮助我。
Stripe::InvalidRequestError in Users::RegistrationsController#create
This customer has no attached payment source
代码:
attr_accessor :stripe_card_token
def save_with_payment
if valid?
customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)
self.stripe_customer_token = customer.id
save!
end
end
答案 0 :(得分:0)
您的请求存在的问题是,在创建客户时,您输入的参数错误。
应该是
Stripe::Customer.create(description: email, plan: plan_id, source: stripe_card_token)
选中here