Hi all,
... Just getting started with DPM and found the 3 page process here..
checkout_form.php
relay_response.php
order_receipt.php
http://developer.authorize.net/guides/DPM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=Trans_response.html
and the - Fields in the Payment Gateway Response...
http://developer.authorize.net/guides/DPM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=Trans_response.html
SO - My question is it seems that the Fields in the Payment Gateway Response happen on the relay_response.php page - and my goal is to capture them and add to my database but....
1 - are they really on this page? - it is instantly redirected so it seems hard to display them here for the customer and/or add to the database...?
2 - can we get them to show on the final page = order_receipt.php?
3 - what is the best way to capture them to add to the database?
Thanks in advance
05-20-2013 08:00 PM
I see no sample code for DPM here...
http://developer.authorize.net/downloads/samplecode/
Can someone point a link to sample code for DPM?
05-21-2013 07:19 AM
Also I tried adding some session variables to capture the responses but they didn't seem to work...
Any Ideas how to capture the responses?
also - the example uses = $response = new AuthorizeNetSIM($api_login_id, $md5_setting);
is this SIM correct or should it be DPM?
---
<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$redirect_url = "http://111.com/order_receipt.php"; // Where the user will end up.
$api_login_id = '111';
$md5_setting = "111"; // Your MD5 Setting
$response = new AuthorizeNetSIM($api_login_id, $md5_setting);
if ($response->isAuthorizeNet())
{
if ($response->approved)
{
//test - these NOT WORKING
if(!session_id()) session_start();
$_SESSION['1'] = $response->transaction_id;
$_SESSION['2'] = $response->x_response_code;
$_SESSION['3'] = $response->x_amount;
// Do your processing here.
$redirect_url .= '?response_code=1&transaction_id=' .
$response->transaction_id.'&yum='.$response->x_response_code.'&amt='.$response->x_amount;
//$response->transaction_id; x_amount
}
else
{
$redirect_url .= '?response_code='.$response->response_code .
'&response_reason_text=' . $response->response_reason_text;
}
// Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
}
else
{
echo "Error. Check your MD5 Setting.";
}?>
05-21-2013 07:26 AM
The best examples of sample code for DPM are not on this site, they're in the DPM documentation PDF in the code sections at the end.
http://www.authorize.net/support/DirectPost_guide.pdf
To answer your question, Authorize.net is hitting your relay response page, not the customer, so setting session variables for Authorize.net won't cause the information to be saved for the customer. What you need to do is either put the bits you want to display at the end into the receipt URL, or save them to your database under some randomly generated ID and then pass the ID so you know what record to look up.
05-21-2013 10:49 AM
First, Thanks for your help TJPride!
Sorry for the newbie questions..
Q1 - so but what you are saying is: there are 3 pages and the important 2nd page = relay_response.php is going to Authorize.net and is not working on my servers so any vars - even session vars will not show up on MySite - correct?
Q2 - Also, at present the only field data is in the _GET url of the the order_receipt.php?response_code=1&transaction_id=xxxxx - correct?
Q3 : My Goal : is really to add a number of Response fields (page 43 and 44 of the DPM pdf you mentioned) to my database for further processing.... so how exactly can I get to them using DPM?
Q4 : Do I need to 'turn them on' in a control panel somewhere?
BTW: I tried adding them to redirect url on relay_response.php but they didn't come back like ...
$redirect_url .= '?response_code=1&transaction_id=' .$response->transaction_id.'&code='.$response->x_response_code.'&amt='.$response->x_amount; ---- and I want to add more...
Thanks for the help!
05-21-2013 04:00 PM - edited 05-21-2013 04:02 PM