【问题标题】:Stripe payment to a customer with customer_id(strip_id)使用 customer_id(strip_id) 向客户进行条带付款
【发布时间】:2020-07-02 21:20:34
【问题描述】:

我为用户创建了一个捐赠应用程序。

  1. 使用 devise 和 stripe 添加了一个用户并使用用户登录凭据创建了客户。
  2. 然后创建了一个捐款页面,任何人都可以来捐款而无需注册。

下面是用户界面。

现在我想通过下面的代码用他的 customer_ID 向在 Bio:hello 注册的客户付款。

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_**.

请帮助我如何在不向该用户注册帐户的情况下捐款。

【问题讨论】:

    标签: stripe-payments strip


    【解决方案1】:

    您需要先将Token 附加/保存到Customer [0]。

    [0]https://stripe.com/docs/saving-cards#saving-credit-card-details-for-later

    【讨论】:

    • 根据您的回答,我们只是在创建客户并从他的卡中收费。但是这笔钱怎么会转到别人注册的卡上。我的要求是假设您是 bio: hello 的用户,并且您已经添加了您的客户详细信息并创建了卡片详细信息。现在,当我点击捐赠按钮时,应该会弹出 UI 显示卡的详细信息和资金,这将进一步转移到您的卡上。
    • 听起来您正在向连接的帐户(您的描述中的“其他”)付款。我建议联系 Stripe Support 以获取有关如何为整个业务流程建模的建议。
    猜你喜欢
    • 2015-03-01
    • 2021-09-27
    • 2016-08-31
    • 2021-10-29
    • 1970-01-01
    • 2018-11-17
    • 1970-01-01
    • 2020-07-15
    • 2021-07-26
    相关资源
    最近更新 更多