Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 08-11-2003 17:52:35

gaz
Member
Registered: 08-11-2003
Posts: 4

Displaying a text error message from the payment processor


I've been looking at getting the response result text out of Authorize.net (AIM) to be displayed on the error page.  I understand the very generic way that the system is working, but a generic message is just poor when the payment gateways usually have a text based response message that comes back.

In looking to see if I can get this information displayed, I can parse out the error in ste_olp.pl, but then there is a redirect and I can not figure out how to get the information passed into the error page.  Somehow the redirect gets into ste_order.pl but I can't figure out how it got there. I think there is also a second redirect, so the CGI parameters are reset.

I also discovered that @r = split(/$delim/, $reply); 
doesn't work with a "|" as a delimiter.  I was able to change the x_delim_char in the payment mention form to use "#" and got the right results. 

If I can get some direction on how to do this, I'll gladly contribute it back to the distribution.

Thanks,
Randall Gaz
Gaz Consulting Inc.

Offline

 

#2 08-13-2003 11:09:54

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Displaying a text error message from the payment processor

Here goes...

In the file ./cgi-bin/library/modules/ste_olp.pl in the routine 'ste_olp_authnetaim_proc' look for:

###

print <<ENDOFTEXT;

<HTML>
<META HTTP-EQUIV="refresh" CONTENT="0; URL=$gateway_returl?$gateway_rcfield=$r_response_code&$gateway_trfield=$x_invoice_num">
</HTML>

ENDOFTEXT

###

And change to:

###

$fd_ref = "$r_response_reason_text";

$fd_ref = vars_urlencode($fd_ref);

print <<ENDOFTEXT;

<HTML>
<META HTTP-EQUIV="refresh" CONTENT="0; URL=$gateway_returl?$gateway_rcfield=$r_response_code&$gateway_trfield=$x_invoice_num&ref=$fd_ref">
</HTML>

ENDOFTEXT

###

Then, in admin go to HTML Pages & Elements | Manage HTML Pages (System) and update the page 'Online Store - Order Failure Redirection' so it reads:

###

<HTML>
<META HTTP-EQUIV="refresh" CONTENT="0; URL=(CGIVAR)common_url(/CGIVAR)&pg=(CGIVAR)fd_pg_redir(/CGIVAR)&ref=(CGIVAR)fd_ref(/CGIVAR)">
</HTML>

###

Then in admin go to HTML Pages & Elements | Manage HTML Pages (System) and update the page 'Online Store - Order Failure - Processor' so it contains:

###

Our processor reported the following error:<BR><BR>

(CGIVAR)fd_ref(/CGIVAR)

###

This should work like a charm.

___________________________

Nick Hendler
Webmaster, Kryptronic, Inc.


Nick Hendler

Offline

 

#3 08-13-2003 19:43:22

gaz
Member
Registered: 08-11-2003
Posts: 4

Re: Displaying a text error message from the payment processor

Hi Nick,

That worked great! 

Your support definitely is great.  The new features in 5.1 are well worth the minor upgrade cost.

Randall Gaz
Gaz Consulting Inc.

Offline

 

#4 05-21-2004 13:40:22

prescott
Member
Registered: 03-26-2004
Posts: 94

Re: Displaying a text error message from the payment processor

Beautiful! This makes the cart just that much more professional.

OT: this forum is an invaluable resource, and greatly appreciated since most other companies would want you to pay through the nose for them to write what might result in two lines of code.

Truly a "value added" for CCP -- I'm extremely happy with this software so far.

Thanks, Nick!


My little attempt with CCP:

Offline

 

#5 08-27-2004 00:13:34

kaz
Member
Registered: 05-19-2004
Posts: 583

Re: Displaying a text error message from the payment processor

After I implemented the mods above, I got...

Our credit card processor reported the following error:

|

You can attempt to process your order again, or contact us to discuss other payment options.

I looked into how it was splitting the reply into the component fields and found that it was splitting one character into each field (not using '|' as the field separator).
Perhaps my version of Perl (v5.6.0) has a different order of evaluation for '$' and  '\'?

I needed to make this change ("$x_delim_char" to "\|") before $r_response_reason_text was populated with the error text ($x_delim_char was set to '|', but "\$x_delim_char" did not work).

Change:

Code:

($r_response_code,$r_response_subcode,$r_response_reason_code,
$r_response_reason_text,$r_approval_code,$r_avs_code,$r_trans_id,
$r_invoice_num,$r_description,$r_amount,$r_method,$r_type,$r_cust_id,
$r_first_name,$r_last_name,$r_company,$r_address,$r_city,$r_state,$r_zip,
$r_country,$r_phone,$r_fax,$r_email,$r_ship_to_first_name,
$r_ship_to_last_name,$r_ship_to_company,$r_ship_to_address,$r_ship_to_city,
$r_ship_to_state,$r_ship_to_zip,$r_ship_to_country,$r_tax,$r_duty,$r_freight,
$r_tax_exempt,$r_po_num,$r_md5_hash,$r_cvv2_resp_code,$r_future) 
= split(/$x_delim_char/,$reply);

to:

Code:

($r_response_code,$r_response_subcode,$r_response_reason_code,
$r_response_reason_text,$r_approval_code,$r_avs_code,$r_trans_id,
$r_invoice_num,$r_description,$r_amount,$r_method,$r_type,$r_cust_id,
$r_first_name,$r_last_name,$r_company,$r_address,$r_city,$r_state,$r_zip,
$r_country,$r_phone,$r_fax,$r_email,$r_ship_to_first_name,
$r_ship_to_last_name,$r_ship_to_company,$r_ship_to_address,$r_ship_to_city,
$r_ship_to_state,$r_ship_to_zip,$r_ship_to_country,$r_tax,$r_duty,$r_freight,
$r_tax_exempt,$r_po_num,$r_md5_hash,$r_cvv2_resp_code,$r_future) 
= split(/\|/,$reply);

Kevin Zaleski -  -

Offline

 

#6 11-20-2004 11:48:34

microlinx
Member
Registered: 10-11-2004
Posts: 8

Re: Displaying a text error message from the payment processor

I made this change and I do NOT get an error returned when using the SIM method.
AIM does not work either...I have spent WEEKS trying to get this to work properly with Authorize.net and it is extremely frustrating.

I tried to set up a hosting account on equivity.com but to pour salt in the wound, they all went on "retreat" for 3 days right when I signed up...so now it's back to this endless loop of troubleshooting.

What other methods of payment through authorize.net DO NOT require the special perl modules to work? I have SSL and a certificate installed, but I'll be damned if I can get this to work...

VERY frunstrated!

:-( 

Offline

 

#7 11-20-2004 12:02:04

kaz
Member
Registered: 05-19-2004
Posts: 583

Re: Displaying a text error message from the payment processor

it worked right away at Hosting Masters (http://hostings.com), first try

i can send you the modified version of that module (if Nick does not object)


Kevin Zaleski -  -

Offline

 

#8 11-24-2004 13:25:00

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Displaying a text error message from the payment processor

No objection here.  Thanks, Kaz.


Nick Hendler

Offline

 

#9 04-10-2005 02:39:59

MBM
Member
Registered: 04-08-2005
Posts: 24

Re: Displaying a text error message from the payment processor

This isn't working for me. We use Authorize.net AIM and all I get is (and I did implement Kaz's fix as well):

Our processor reported the following error:

|


Any ideas?

Offline

 

#10 04-25-2005 10:54:43

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Displaying a text error message from the payment processor

Did you try implementing the mod posted by kaz above?  Some Perl versions interperet variables in splits differently (literally versus as a pointer).


Nick Hendler

Offline

 

#11 04-25-2005 15:34:02

altmedic
Member
Registered: 11-07-2002
Posts: 346

Re: Displaying a text error message from the payment processor

If anyone finds the answer to this problem, I hope you will put your results on this post.  We use AIM and I've tried everything suggested over the months(this is not new), but nothing works.

Thanks! smile 

Offline

 

#12 04-25-2005 15:47:39

kaz
Member
Registered: 05-19-2004
Posts: 583

Re: Displaying a text error message from the payment processor

Not sure why the code i posted above does not work for you, it works for me.
If you want, PM me and I'll email you a copy of the modified module so you can compare or swap it in.

I expect that your problem is related to not setting the delimiter character correctly, see above re:

I needed to make this change ("$x_delim_char" to "\|") before $r_response_reason_text was populated with the error text ($x_delim_char was set to '|', but "\$x_delim_char" did not work).

Where I changed

Code:

split(/$x_delim_char/,$reply)

to

Code:

split(/\|/,$reply)

Another thing you might want to try that I found in another post is to have the reply string from AIM emailed to you... perhaps it will be obvious why yours is not parsing the same.

After

Code:

my $reply = $response->content;

add

Code:

&vars_mailer($site_owner_email_address,$site_owner_email_address,$x_invoice_num,$reply);

Mine looks like this, my mod is based on extracting what it finds between the 3rd and 4th pipe (assuming you have set your field delimiter to be a pipe) ...

1|1|1|This transaction has been approved.|203200|Y|815462021|CG2005042591||808.73|CC|auth_capture|51F1308313|Fred|Flintstone||801 Bedrock Dr|Madison Heights|Virginia|24572|United States|555-383-2508||xxxxxx@msn.com||||||||||||||7887799C909CE688524365C35B83607E|||||||||||||||||||||||||||||||AMEX


Kevin Zaleski -  -

Offline

 

#13 09-20-2005 22:15:21

craggyoaks
Member
Registered: 09-20-2005
Posts: 5

Re: Displaying a text error message from the payment processor

Hi,

I was experiencing similar problems with Authorize.net.   It turns out my problems consisted of the following issues:

1.  authorize.net account set to live (when using test credit card #)
2.  The \$x_delim_char variable on line 402 of ste_olp.pl not parsing the string.


I am running Perl 5.8.7.   The solution ended up consisting of the following:

1.  Putting Authorize.net in test mode
2.  changing $x_delim_char by hard-coding "\|" on line 402.


Tom

Offline

 

#14 12-07-2005 11:07:12

willp
Member
Registered: 07-14-2003
Posts: 48
Website

Re: Displaying a text error message from the payment processor

I had used this method to get the error displayed back when we used Authorize.net. Now I'm using PayPal Pro and don't get any specific error messages when the transactions fails. Any way to make this work with PayPal?

Offline

 

#15 04-10-2006 23:32:56

Iceit88
Member
From: Fairview, PA
Registered: 11-19-2003
Posts: 549
Website

Re: Displaying a text error message from the payment processor

I had used this method to get the error displayed back when we used Authorize.net. Now I'm using PayPal Pro and don't get any specific error messages when the transactions fails. Any way to make this work with PayPal?

BUMP*


Bryan

Hat Trick Sports, LLC

Offline

 

Board footer