gpt4 book ai didi

ruby - 为以后使用 activemerchant 保存付款

转载 作者:数据小太阳 更新时间:2023-10-29 07:59:36 24 4
gpt4 key购买 nike

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

两者都是BraintreeStripe有一种方法可以通过给我一个客户 ID 来保存到我的数据库中。然后我会在某个日期使用此 ID 向客户收费。

我浏览了 Active Merchant Stripe code ,它的 purchase() 有注释:

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

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

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

最佳答案

我在布伦特里工作。如果有更多问题,可以随时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 时使用它。

关于ruby - 为以后使用 activemerchant 保存付款,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27697731/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com