Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveMerchant: How to authorise cards when using gateways that do not support the void operation?

I am working on the billing component of a Ruby on Rails application using ActiveMerchant. The payment gateway we have chosen is PaymentExpress.

Code examples I am seeing such as the one below, use authorize() and void() to test the validity of a card:

def test_card!
  auth_response = gateway.authorize(100, card)
  gateway.void(auth_response.authorization) if auth_response.success?
  raise AuthorizationFailed.new(auth_response) unless auth_response.success?
end

However, PaymentExpress does not support the void action. Is there an alternate way to perform this authorisation action, or is it OK to leave out the void action, considering gateways such as PaymentExpress expire the authorisation request after 7 days?

I can find no mention of voiding an authorisation in the documentation or Google, nor can I find any indication of how important it is.

Some help?

like image 541
Bo Jeanes Avatar asked Jan 23 '09 06:01

Bo Jeanes


2 Answers

Some card processors will flag a transaction like this as potential fraud. They don't like to see small test transactions followed by larger transactions. American Express in particular is somewhat aggressive in this regard as they will tend to decline the transaction when you go back and try for the real amount.

If you plan on charging a customer for amount x, then you should authorize it for amount x to validate the card. Then you can use the previous authorization and do a capture or force-post to finalize the charge. This way, the customer will only ever see the right amount pending & settled on their statement.

like image 200
Matt Haley Avatar answered Oct 04 '22 17:10

Matt Haley


It turns out that at least with PaymentExpress, they automatically do an authorisation action as part of their card storing process. If the authorisation fails, it simply won't store the card, returning "INVALID CARD" instead. This is seen in their transaction search web app -- when storing cards, $1.00 is authorised on the card, and invalidated automatically a week later.

like image 30
Bo Jeanes Avatar answered Oct 04 '22 16:10

Bo Jeanes