views:

354

answers:

2

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?

+1  A: 

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.

Matt Haley
I've considered this, the problem is that users will have a 30-day trial, and it is quite likely they will enter their credit card details at signup time or during the trial. PaymentExpress invalidates authorisations after 7 days, so capturing 30 days later won't work.
bjeanes
Then just run a checksum on the card when obtained. http://en.wikipedia.org/wiki/Luhn_algorithm
Matt Haley
There is a difference between "authorising" and "validating"
bjeanes
+2  A: 

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.

bjeanes