in reply to Accepting Credit Cards

tachyon makes some great practical points. Personally, I've created many e-commerce sites and not experienced the problems mentioned. However, I have found that the authorization gateway (the entity that intercedes between your site and the merchant acct. to actually validate the card) can have various protocols, some of which can be tricky.

My favorite gateway provider allows a very easy to implement LWP:: UserAgent and HTTP::Request::Common interaction. You and your customer needs to decide what degree of validation is needed and just plug in the correct gateway codes.

Of course, you will need to purchase a secure certificate and have it installed on your server. Also, you will need to create and encrypt a key on the server, which you should store in a non-public area of your site. Here's a sample of a simple transaction in Perl:

use HTTP::Request::Common; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $req = POST 'https://secure.authorize.net/gateway/transact.dll', [ x_version => '3.1', x_delim_data => 'True', x_relay_response => 'False', x_login => 'somepassword', x_tran_key => $decrypted, x_amount => $totalamt, x_card_num => $ccnumber, x_exp_date => $month.$year, x_type => 'AUTH_CAPTURE', ]; my $reply; my $response = $ua->request($req); if ($response->is_success) { $reply = $response->content; } else { print STDERR $response->status_line, "\n"; } #parse $reply for authorized/decline codes and echo messages back to p +urchaser... my @replies = split(/,/, $reply); my $reason = $replies[3]; SWITCH: for ($replies[0]) { /2/ && do { &declined; last; }; /3/ && do { &error; last; }; $replies[0] = 0; }

Good luck!


—Brad
"Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton

Replies are listed 'Best First'.
Re^2: Accepting Credit Cards
by brian_d_foy (Abbot) on Nov 02, 2004 at 01:30 UTC

      just a little nit here: B:OP:AuthorizeNet is not maintained by Authorize.Net, but by an unaffiliated volunteer.

      for the record, the only vendor that maintains their own Business::OnlinePayment module is Trust Commerce.

      more info at Business::OnlinePayment homepage

      "But what fun is that?"

      Wow! There is a CPAN module for everything (except one that will clean my garage...oops, I just found Garage::Clean).

      I'd love to read more about it, but I have to admit, I like to program the stuff myself. Though, I'm sure it does a superior job. Thanks!


      —Brad
      "Don't ever take a fence down until you know the reason it was put up." G. K. Chesterton