我已经为用户创建了一个捐赠应用程序。
下面是用户界面。
现在,我想通过以下代码向在 Bio:hello 中注册并带有其customer_ID的客户付款。
token = params[:stripeToken]
Stripe::Charge.create(
customer: @user.stripe_id,
source: token,
amount: 2000,
currency: 'usd',
description: 'Example charge'
)
But its throwing error. Stripe::InvalidRequestError: Customer cus_** does not have a linked source with ID tok_**.
请帮助我在不向该用户注册帐户的情况下捐款。
答案 0 :(得分:0)
您需要先将Token
附加/保存到Customer
[0]。
[0] https://stripe.com/docs/saving-cards#saving-credit-card-details-for-later