【问题标题】:Saving payment for later with activemerchant使用 activemerchant 保存付款以备后用
【发布时间】:2015-02-26 03:53:56
【问题描述】:

Active Merchant 似乎是一个不错的付款方式。但是,我需要能够保存客户的付款信息,然后在以后从卡中扣款(即在发货时而不是在下订单时)。

BraintreeStripe 都可以通过给我一个客户 ID 来保存到我的数据库来做到这一点。然后我会在某个日期使用这个 ID 向客户收费。

我查看了Active Merchant Stripe code,它的purchase() 有cmets:

   # To create a charge on a customer, call
   #   purchase(money, nil, { :customer => id, ... })

似乎有一种方法可以获取客户 ID。

如何让 Active Merchant 创建客户对象并返回 Stripe 和 Braintree 的客户 ID?所有支持这种支付方式的网关都支持这个功能吗?

【问题讨论】:

    标签: ruby sinatra stripe-payments activemerchant braintree


    【解决方案1】:

    我在布伦特里工作。如果您还有其他问题,可以随时get in touch with our support team

    在 Braintree 保险库中创建或更新客户/信用卡的各种方法在响应中返回 :customer_vault_idfor example

    Response.new(result.success?, message_from_result(result),
      {
        :braintree_customer => (
          customer_hash(result.customer, :include_credit_cards) if result.success?
        ),
        :customer_vault_id => (
          result.customer.id if result.success?
        ),
        :credit_card_token => (
          result.customer.credit_cards[0].token if result.success?
        )
      },
      :authorization => (result.customer.id if result.success?)
    )
    

    您可以存储该 ID 并在以后调用 purchase 时使用它。

    【讨论】:

      猜你喜欢
      • 2013-12-03
      • 2015-06-13
      • 2019-07-05
      • 2017-03-25
      • 2010-11-06
      • 2021-09-02
      • 2021-07-04
      • 2014-01-15
      • 2019-02-23
      相关资源
      最近更新 更多