Hello guys,
I am struggling with my form not telling me if a transaction was declined or accepted at Authorize.net.
Also, my response email gets sent out whether or not authorize.net accepts the transaction??
Is there a way to use the "Global Variables" in my template ??
Thanks,
I am struggling with my form not telling me if a transaction was declined or accepted at Authorize.net.
Also, my response email gets sent out whether or not authorize.net accepts the transaction??
Is there a way to use the "Global Variables" in my template ??
Thanks,
Hi samoht,
first turn Authorize.net plugin debugging ON to be able to see the message back from Authorize
first turn Authorize.net plugin debugging ON to be able to see the message back from Authorize
after submitting the form assuming you have no redirect URL!
to see the debug messages yes
Hi Max,
I have some code that works around this - when there is a ReDirect link it shows the debug output with a 'Continue' button that implements the Redirect. Perhaps this could go in a future version.
Bob
I have some code that works around this - when there is a ReDirect link it shows the debug output with a 'Continue' button that implements the Redirect. Perhaps this could go in a future version.
Bob
Hi Bob,
Sure, add it here or PM please, also, how can we move posts in this forums!! I couldn't find how to move a post to the Bugs category yesterday!!! 😀
Thank you!
Max
Sure, add it here or PM please, also, how can we move posts in this forums!! I couldn't find how to move a post to the Bugs category yesterday!!! 😀
Thank you!
Max
Bob,
please post your code here because I would be very interested in doing something similar
Thanks,
please post your code here because I would be very interested in doing something similar
Thanks,
Also,
I took away the redirect and turned on the debug in the plugin but I still saw nothing after I submitted my form. I assume I need to have the global variables somewhere in my code? - Do I also need to have the form debug on as well as the plugin?
Thanks,
I took away the redirect and turned on the debug in the plugin but I still saw nothing after I submitted my form. I assume I need to have the global variables somewhere in my code? - Do I also need to have the form debug on as well as the plugin?
Thanks,
Hi Max,
Not sure about the plugin debug, this code was devised to work with ChronoForms. I'll add a couple of other useful debug additions here too.
1) The RedirectURL
2) Debugging SQL
The Autogenerated code needs to be written in a slightly different syntax to make this easier. Here's an example from a form I debugged today:
3) $_FILES
The $_POST debug message around line 194 of the old chronocontact.php should also include $_FILES if it's in use.
Bob
Not sure about the plugin debug, this code was devised to work with ChronoForms. I'll add a couple of other useful debug additions here too.
1) The RedirectURL
<?php
if ( $debug && isset($rows[0]->redirecturl ) ) {
echo "Redirect url: ".print_r($rows[0]->redirecturl, true)."<br />";
echo "<a href='$rows[0]->redirecturl'>Click to continue</a><br />";
// prevent the redirect
$rows[0]->redirecturl = "";
}
I had this at the end of the Autogenerated code box but it would be better in the main code. (Note I've amended this a bit to post it here so it may need de-bugging but the principle works OK.)2) Debugging SQL
The Autogenerated code needs to be written in a slightly different syntax to make this easier. Here's an example from a form I debugged today:
<?php
$database =& JFactory::getDBO();
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
// show $sql as a separate variable and use the SET syntax
// to make clear the variable + values combinations in the debug
$sql = "
INSERT
INTO #__chronoforms_4
SET uid = '$inum',
recordtime = '". date('Y-m-d')." - ".date("H:i:s")."',
ipaddress = '".$_SERVER['REMOTE_ADDR']."' ,
entryname = '".JRequest::getVar('entryname','', 'post', 'string', '' )."' ,
email = '".JRequest::getVar('email','', 'post', 'string', '' )."' ,
joinmailinglist = '".JRequest::getVar('joinmailinglist','', 'post', 'string', '' )."' ,
submit = '".JRequest::getVar('submit','', 'post', 'string', '' )."';";
if ( $debug ) {
echo "sql: ".print_r($sql, true)."<br />";
}
$database->setQuery( $sql );
if ( !$database->query() ) {
// I think this might be better for displaying these messages in Joomla 1.5
$mainframe->enqueuemessage($database->getErrorMsg(), 'error');
}
?>
3) $_FILES
The $_POST debug message around line 194 of the old chronocontact.php should also include $_FILES if it's in use.
<?php
/**
* if $debug is true then ChronoForms will show diagnostic output
*/
$debug = $paramsvalues->debug;
if ( $debug ) {
echo "_POST: ".print_r( $_POST, true )."<br />";
if ( isset( $_FILES ) {
echo "_FILES: ".print_r( $_FILES, true )."<br />";
}
}
?>
Bob
Thanks so much Bob, regarding the autogenerated code, this part will be completely redone, I found a better way to do this and to allow insert/update/delete records easily and quickly and cleanly🙂
I also found how to move posts!!😉
Best regards,
Max
I also found how to move posts!!😉
Best regards,
Max
Hi Max,
Bob
I also found how to move posts!!
Good, it was late last night, I was going to pm you this morning.Bob
Bob or admin,
I still am not sure how to use the authorise.net variables? (they are not showing up anywhere even though I have no redirect and the debug is on)
like "transaction id"; results; and approval codes. Basically - I need to be able to tell the end client if authorize.net approved the transaction or not. If not I would like to tell them why or ask them to use another card etc. Currently the form just goes through, wether or not the transaction was approved. An email is sent to my client requesting the purchased gift card. Since my client has no indication if they got the money or not, they might go ahead and process the request, and someone could end up with a $1,000.00 gift card for free! (not good)
Please help me to understand this process better so I can avoid ripping off my client.
Thanks a million🙂
I still am not sure how to use the authorise.net variables? (they are not showing up anywhere even though I have no redirect and the debug is on)
like "transaction id"; results; and approval codes. Basically - I need to be able to tell the end client if authorize.net approved the transaction or not. If not I would like to tell them why or ask them to use another card etc. Currently the form just goes through, wether or not the transaction was approved. An email is sent to my client requesting the purchased gift card. Since my client has no indication if they got the money or not, they might go ahead and process the request, and someone could end up with a $1,000.00 gift card for free! (not good)
Please help me to understand this process better so I can avoid ripping off my client.
Thanks a million🙂
Hi Samoht,
One of the global variables tells you if the transaction was approved or not!
Cheers
Max
One of the global variables tells you if the transaction was approved or not!
Cheers
Max
can I get the page to not send the email and go to an error page if the transaction is declined?
If so, how?
If so, how?
yes, define global $the_approved_variable_here;
then check on its value and set $rows[0]->emailresults = 0 if it fails!
Cheers
Max
then check on its value and set $rows[0]->emailresults = 0 if it fails!
Cheers
Max
Max,
would this go in the "On Submit before email" block?
and when you say
I assume something like:
all though If $cf_AUTHNET_approval_code has a value I don't need the other variable do I?
would this go in the "On Submit before email" block?
and when you say
define global $the_approved_variable_here;
I assume something like:
$myglobalvar = $cf_AUTHNET_approval_code;
all though If $cf_AUTHNET_approval_code has a value I don't need the other variable do I?
here is a real example I had working somewhere :
this to go at the onsubmit after email and the plugin config must be set to run before email!
<?php
global $cf_AUTHNET_response_code;
if($cf_AUTHNET_response_code != 'Approved'){
$rows[0]->emailresults = 0;
?>
this to go at the onsubmit after email and the plugin config must be set to run before email!
Max,
Is the condition statement supposed to be open here? Or should it be closed
Is the condition statement supposed to be open here? Or should it be closed
<?php
global $cf_AUTHNET_response_code;
if($cf_AUTHNET_response_code != 'Approved'){
$rows[0]->emailresults = 0;
}
?>
Hi samoht,
It must be closed somewhere in the code or you will get a parsing error and probably see a blank screen.
Bob
It must be closed somewhere in the code or you will get a parsing error and probably see a blank screen.
Bob
yep, that is what I thought.
I was worried though that it was left open there on purpose and supposed to be closed later after some other code - like maybe the email template?
Anyway, now I closed it just as I showed in the post and after I submit my form an error shows on the screen simply saying "error"
the rest of the screen is blank. But for some reason the form is still emailed to me?
I suppose in that conditional if $cf_AUTHNET_response_code; is blank or null the email will still be sent - but why would it be blank?
if I just put:
in the On after submit - will that show me the global values?
I was worried though that it was left open there on purpose and supposed to be closed later after some other code - like maybe the email template?
Anyway, now I closed it just as I showed in the post and after I submit my form an error shows on the screen simply saying "error"
the rest of the screen is blank. But for some reason the form is still emailed to me?
I suppose in that conditional if $cf_AUTHNET_response_code; is blank or null the email will still be sent - but why would it be blank?
if I just put:
<?php
global $cf_AUTHNET_response_code, $cf_AUTHNET_response_subcode, $cf_AUTHNET_response_reason_code,
$cf_AUTHNET_response_reason_text,
$cf_AUTHNET_approval_code,
$cf_AUTHNET_avs_result_code,
$cf_AUTHNET_transaction_id;
echo $cf_AUTHNET_response_code;
echo $cf_AUTHNET_response_subcode;
echo $cf_AUTHNET_response_reason_code;
echo $cf_AUTHNET_response_reason_text;
echo $cf_AUTHNET_approval_code;
echo $cf_AUTHNET_avs_result_code;
echo $cf_AUTHNET_transaction_id;
?>
in the On after submit - will that show me the global values?
OK,
I made some progress. If I put this
in the extra after onsubmit of the plugin - then I finally can see the response from Authorize.net (unfortunately I see this resonse on the confirm page as well )
however, with this I still get the email sent even with a "Declined" from Authorize.net
my response looks like:
Response Code: Declined
Response Sub Code: 1
Reason Code: 2
Reason Text: This transaction has been declined.
Approval Code: NO VALUE RETURNED
Result Code: B
Trans Id: 1944974356
Case 2: Use template
E-mail: 'Yes' custom
Email sent
I made some progress. If I put this
<?php
global $cf_AUTHNET_response_code;
if($cf_AUTHNET_response_code != 'Approved'){
$rows[0]->emailresults = 0;
}
global $cf_AUTHNET_response_subcode, $cf_AUTHNET_response_reason_code,
$cf_AUTHNET_response_reason_text,
$cf_AUTHNET_approval_code,
$cf_AUTHNET_avs_result_code,
$cf_AUTHNET_transaction_id;
echo 'Response Code: '.$cf_AUTHNET_response_code.'<br>';
echo 'Response Sub Code: '.$cf_AUTHNET_response_subcode.'<br>';
echo 'Reason Code: '.$cf_AUTHNET_response_reason_code.'<br>';
echo 'Reason Text: '.$cf_AUTHNET_response_reason_text.'<br>';
echo 'Approval Code: '.$cf_AUTHNET_approval_code.'<br>';
echo 'Result Code: '.$cf_AUTHNET_avs_result_code.'<br>';
echo 'Trans Id: '.$cf_AUTHNET_transaction_id.'<br>';
?>
in the extra after onsubmit of the plugin - then I finally can see the response from Authorize.net (unfortunately I see this resonse on the confirm page as well )
however, with this I still get the email sent even with a "Declined" from Authorize.net
my response looks like:
Response Code: Declined
Response Sub Code: 1
Reason Code: 2
Reason Text: This transaction has been declined.
Approval Code: NO VALUE RETURNED
Result Code: B
Trans Id: 1944974356
Case 2: Use template
E-mail: 'Yes' custom
Email sent
Hi samoht,
add this code in the before email box in the form page, now in the plugin page, there is a drop down, before email or after email, make it before email!
Cheers
Max
add this code in the before email box in the form page, now in the plugin page, there is a drop down, before email or after email, make it before email!
Cheers
Max
When I move this code to the before email box my global variables are blank??
All I did was copy cut and paster from after to before?
All I did was copy cut and paster from after to before?
Well, If I can't get the email not to send how about getting the global vars to save into my table for the form?
i'd like to store the transaction id and the response code.
I at least was able to add the global vars to my email to the client - so they can see that the transaction was good or bad.
Thanks for the help,
i'd like to store the transaction id and the response code.
I at least was able to add the global vars to my email to the client - so they can see that the transaction was good or bad.
Thanks for the help,
When I move this code to the before email box my global variables are blank??
All I did was copy cut and paster from after to before?
Hi samoht, you do this and you also sure that the "Run Before/After the Email ?" is set to "Before Email" in the plugin config ?
Max,
yes, I set everything to before email (see attached)?[attachment=2]form1.jpg[/attachment][attachment=1]form2.jpg[/attachment][attachment=0]form3.jpg[/attachment]
yes, I set everything to before email (see attached)?[attachment=2]form1.jpg[/attachment][attachment=1]form2.jpg[/attachment][attachment=0]form3.jpg[/attachment]
Ok, take the extra before email code and use it directly in the before email box please!
great - I think that worked!
At least I think it worked, because no email was sent.
now, If I could only store the authnet responses in my table. I tried adding the var's to my Form HTML
but since I have a confirm page I just end up getting those values, which are no good.
Can I put a hidden input in the before or after email that would save the authnet responses??
Thanks again Max
At least I think it worked, because no email was sent.
now, If I could only store the authnet responses in my table. I tried adding the var's to my Form HTML
but since I have a confirm page I just end up getting those values, which are no good.
Can I put a hidden input in the before or after email that would save the authnet responses??
Thanks again Max
Hi Samoht,
put some hidden variables on your form, then on your onsubmit before email or at any of the extra boxes of the plugin add this per field :
and of course at the same place you will add the global variables list at the top as you always do!
Cheers
Max
put some hidden variables on your form, then on your onsubmit before email or at any of the extra boxes of the plugin add this per field :
$_POST['hidden_field_name'] = $global_var_here;
and of course at the same place you will add the global variables list at the top as you always do!
Cheers
Max
This topic is locked and no more replies can be posted.