是否可以在 ActiveMerchant 中将授权金额更改为捕获金额?

Is it possible to change the amount from authorize to capture in ActiveMerchant?

我正在做一个功能,首先授权用户的信用卡信息。从那里我可以获得响应并能够保存 transaction_idauthorization 密钥 w/c 可用于 从信用卡中获取钱。

但我需要单独进行,只是先授权信用卡信息。 因为,授权卡需要初始金额,例如:

credit_card = ActiveMerchant::Billing::CreditCard.new(
 :number     => '4111111111111111',
 :month      => '8',
 :year       => '2009',
 :first_name => 'Tobias',
 :last_name  => 'Luetke',
 :verification_value  => '123'
)

# initial amount - 1000
response = gateway.authorize(1000, credit_card)

我的问题是,是否可以使用#capture:

不同数量,现在2000

gateway.capture(2000, response.authorization)

是的,我认为这是可能的,因为 captureauthorize 都是独立的服务器调用,

Authorization - You request an authorization when a customer makes a purchase. An authorization, provided by the customer’s card issuing bank, confirms the cardholder’s ability to pay, ensuring that the customer's credit card account is in good standing with sufficient funds to complete the purchase.

Capture - After providing a service/product to the customer, you ‘capture’ the relevant information from the authorization and submit it in a capture/settlement request that your processor uses to initiate a funds transfer between the customer's credit card account and your checking account.

Source

所以根据定义应该可以,但是你不知道用户是否能够支付 您打算捕获的金额(如果金额高于 authorize 调用中的金额)。