cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the x_trans_id and x_method, when the transaction is complete?  I've tried capturing it with $_POST as with SIM or AIM, but it does not get either. 

joescarpetta
Member
1 REPLY 1

DPM does not work the same way. With DPM, only a response code and transaction ID is going to be passed to the receipt page via $_GET if you're using the sample code, and you have to use the Transaction Details API with the transaction ID if you want to look up the transaction info for output there. If, on the other hand, all you want to do is update your database on a successful transaction, the relay response page DOES receive everything. Here's the sample code from the DPM PDF, with the notes expanded to show where you'd add your code:

 

<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK 
$redirect_url = "http://YOUR_DOMAIN.com/receipt_page.php"; // 
Where the user 
will end up. 
$api_login_id = 'YOUR_API_LOGIN_ID'; 
$md5_setting = ""; // Your MD5 Setting 
$response = new AuthorizeNetSIM($api_login_id, $md5_setting); 
if ($response->isAuthorizeNet()) 
{ 
if ($response->approved) 
   { 
       // Update your database to store any transaction info you might want to access later
       // Or if you already have the transaction, mark the transaction as completed
       // All data is in $response
$redirect_url .= '?response_code=1&transaction_id=' . $response->transaction_id; } 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."; } ?>

 

TJPride
Expert