<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Return Order-&amp;gt;InvoiceNum (or refTransID) w/ Accept Hosted Payment form in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Return-Order-gt-InvoiceNum-or-refTransID-w-Accept-Hosted-Payment/m-p/63344#M37492</link>
    <description>&lt;P&gt;Problem:&amp;nbsp; Need guidance on returning the Order-&amp;gt;InvoiceNum (or refTransID) while using Accept Hosted Payment form.&amp;nbsp; My attempt (see code below) is not working.&amp;nbsp; Not sure if I'm setting it incorrectly or returning it incorrectly.&amp;nbsp; If there's a way to do this with refTransId, that would be even better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Background:&lt;/P&gt;&lt;P&gt;-I can successfully complete authcapture transactions using the Accept Hosted payment form.&amp;nbsp; I can also call the TransactionDetail and get a json payload.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sending my custom 'order id' (Session #) in the Order-&amp;gt;Invoice number field when I do the authCapture transaction .&amp;nbsp; I tried to put it in both the reference ID field and the refTransID field with no luck.&amp;nbsp; Then I stumbled across a forum post (see below) where the admin says there's a known bug with the Accept Hosted Payment form where the refTransID is not currently working.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This says to use transRefID:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.developer.authorize.net/t5/Integration-and-Testing/quot-Webhook-quot-VS-quot-Silent-Post-quot-and-custom-fields/m-p/61269#M35748" target="_blank"&gt;https://community.developer.authorize.net/t5/Integration-and-Testing/quot-Webhook-quot-VS-quot-Silent-Post-quot-and-custom-fields/m-p/61269#M35748&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This says transRefid has known bug.&amp;nbsp; Use Order-&amp;gt;Invoice Number instead&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.developer.authorize.net/t5/Integration-and-Testing/RefID-not-being-returned-in-get-transaction-detail/m-p/61406#M35858" target="_blank"&gt;https://community.developer.authorize.net/t5/Integration-and-Testing/RefID-not-being-returned-in-get-transaction-detail/m-p/61406#M35858&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;JJ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE TO SET THE ORDER&lt;/P&gt;&lt;PRE&gt;	$refId =  $_SESSION["SessionNumber"];  //Always unique - returned with the web hook
  //$refId =12345;
 $input_xml = '&amp;lt;getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;
 &amp;lt;merchantAuthentication&amp;gt;
 &amp;lt;name&amp;gt;MyLogin&amp;lt;/name&amp;gt;
 &amp;lt;transactionKey&amp;gt;MyTransKey&amp;lt;/transactionKey&amp;gt;
 &amp;lt;/merchantAuthentication&amp;gt;


 &amp;lt;transactionRequest&amp;gt;
 &amp;lt;transactionType&amp;gt;authCaptureTransaction&amp;lt;/transactionType&amp;gt;
 &amp;lt;amount&amp;gt;';

// $input_xml .=3.50  .'&amp;lt;/amount&amp;gt;

 $input_xml .= $_SESSION["ReceiptTotal"]  .'&amp;lt;/amount&amp;gt;
 &amp;lt;order&amp;gt;&amp;lt;invoiceNumber&amp;gt;';


 $input_xml .=  $refId  .'&amp;lt;/invoiceNumber&amp;gt;&amp;lt;/order&amp;gt;

 &amp;lt;/transactionRequest&amp;gt;
 
 &amp;lt;hostedPaymentSettings&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentBillingAddressOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{"show": false, "required":false}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentButtonOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{"text": "Pay"}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentReturnOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{ "showReceipt":true, "url":"https://xxxxx.org/IntCampReceiptSuccess.html","urlText":"Continue","cancelUrl":"https://xxxx.org/IntCampReceiptCancel.html","cancelUrlText":"Cancel"}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentPaymentOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{"cardCodeRequired": true, "showCreditCard": true, "showBankAccount": false}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentOrderOptions&amp;lt;/settingName&amp;gt;	
 &amp;lt;settingValue&amp;gt;{"show": true, "merchantName": "xxxxx"}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;/hostedPaymentSettings&amp;gt;
 &amp;lt;/getHostedPaymentPageRequest&amp;gt;';
 &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE TO RETRIEVE THE ORDER&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
  require 'vendor/autoload.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function getTransactionDetails($transactionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
 //   $merchantAuthentication-&amp;gt;setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
 //   $merchantAuthentication-&amp;gt;setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);

    $merchantAuthentication-&amp;gt;setName('Mylogin');
   $merchantAuthentication-&amp;gt;setTransactionKey('MyTranskey');	
	
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $request = new AnetAPI\GetTransactionDetailsRequest();
    $request-&amp;gt;setMerchantAuthentication($merchantAuthentication);
    $request-&amp;gt;setTransId($transactionId);
	$request-&amp;gt;setrefId($refId);
  
    $controller = new AnetController\GetTransactionDetailsController($request);

    $response = $controller-&amp;gt;executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) &amp;amp;&amp;amp; ($response-&amp;gt;getMessages()-&amp;gt;getResultCode() == "Ok"))
    {
        echo "SUCCESS: Transaction Status:" . $response-&amp;gt;getTransaction()-&amp;gt;getTransactionStatus() . "\n";
        echo "                Auth Amount:" . $response-&amp;gt;getTransaction()-&amp;gt;getAuthAmount() . "\n";
        echo "                   Trans ID:" . $response-&amp;gt;getTransaction()-&amp;gt;getTransId() . "\n";

NEXT LINE DOES NOT WORK
        echo "   Reference ID/Session Num:" . $response-&amp;gt;getTransaction()-&amp;gt;getOrder() . "\n";		
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response-&amp;gt;getMessages()-&amp;gt;getMessage();
        echo "Response : " . $errorMessages[0]-&amp;gt;getCode() . "  " .$errorMessages[0]-&amp;gt;getText() . "\n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
  
    getTransactionDetails("123456...");
?&amp;gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 08 Jun 2018 20:46:30 GMT</pubDate>
    <dc:creator>jjauthnet</dc:creator>
    <dc:date>2018-06-08T20:46:30Z</dc:date>
    <item>
      <title>Return Order-&gt;InvoiceNum (or refTransID) w/ Accept Hosted Payment form</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Return-Order-gt-InvoiceNum-or-refTransID-w-Accept-Hosted-Payment/m-p/63344#M37492</link>
      <description>&lt;P&gt;Problem:&amp;nbsp; Need guidance on returning the Order-&amp;gt;InvoiceNum (or refTransID) while using Accept Hosted Payment form.&amp;nbsp; My attempt (see code below) is not working.&amp;nbsp; Not sure if I'm setting it incorrectly or returning it incorrectly.&amp;nbsp; If there's a way to do this with refTransId, that would be even better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Background:&lt;/P&gt;&lt;P&gt;-I can successfully complete authcapture transactions using the Accept Hosted payment form.&amp;nbsp; I can also call the TransactionDetail and get a json payload.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sending my custom 'order id' (Session #) in the Order-&amp;gt;Invoice number field when I do the authCapture transaction .&amp;nbsp; I tried to put it in both the reference ID field and the refTransID field with no luck.&amp;nbsp; Then I stumbled across a forum post (see below) where the admin says there's a known bug with the Accept Hosted Payment form where the refTransID is not currently working.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This says to use transRefID:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.developer.authorize.net/t5/Integration-and-Testing/quot-Webhook-quot-VS-quot-Silent-Post-quot-and-custom-fields/m-p/61269#M35748" target="_blank"&gt;https://community.developer.authorize.net/t5/Integration-and-Testing/quot-Webhook-quot-VS-quot-Silent-Post-quot-and-custom-fields/m-p/61269#M35748&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This says transRefid has known bug.&amp;nbsp; Use Order-&amp;gt;Invoice Number instead&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.developer.authorize.net/t5/Integration-and-Testing/RefID-not-being-returned-in-get-transaction-detail/m-p/61406#M35858" target="_blank"&gt;https://community.developer.authorize.net/t5/Integration-and-Testing/RefID-not-being-returned-in-get-transaction-detail/m-p/61406#M35858&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;JJ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE TO SET THE ORDER&lt;/P&gt;&lt;PRE&gt;	$refId =  $_SESSION["SessionNumber"];  //Always unique - returned with the web hook
  //$refId =12345;
 $input_xml = '&amp;lt;getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;
 &amp;lt;merchantAuthentication&amp;gt;
 &amp;lt;name&amp;gt;MyLogin&amp;lt;/name&amp;gt;
 &amp;lt;transactionKey&amp;gt;MyTransKey&amp;lt;/transactionKey&amp;gt;
 &amp;lt;/merchantAuthentication&amp;gt;


 &amp;lt;transactionRequest&amp;gt;
 &amp;lt;transactionType&amp;gt;authCaptureTransaction&amp;lt;/transactionType&amp;gt;
 &amp;lt;amount&amp;gt;';

// $input_xml .=3.50  .'&amp;lt;/amount&amp;gt;

 $input_xml .= $_SESSION["ReceiptTotal"]  .'&amp;lt;/amount&amp;gt;
 &amp;lt;order&amp;gt;&amp;lt;invoiceNumber&amp;gt;';


 $input_xml .=  $refId  .'&amp;lt;/invoiceNumber&amp;gt;&amp;lt;/order&amp;gt;

 &amp;lt;/transactionRequest&amp;gt;
 
 &amp;lt;hostedPaymentSettings&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentBillingAddressOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{"show": false, "required":false}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentButtonOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{"text": "Pay"}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentReturnOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{ "showReceipt":true, "url":"https://xxxxx.org/IntCampReceiptSuccess.html","urlText":"Continue","cancelUrl":"https://xxxx.org/IntCampReceiptCancel.html","cancelUrlText":"Cancel"}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentPaymentOptions&amp;lt;/settingName&amp;gt;
 &amp;lt;settingValue&amp;gt;{"cardCodeRequired": true, "showCreditCard": true, "showBankAccount": false}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;setting&amp;gt;
 &amp;lt;settingName&amp;gt;hostedPaymentOrderOptions&amp;lt;/settingName&amp;gt;	
 &amp;lt;settingValue&amp;gt;{"show": true, "merchantName": "xxxxx"}&amp;lt;/settingValue&amp;gt;
 &amp;lt;/setting&amp;gt;
 
 &amp;lt;/hostedPaymentSettings&amp;gt;
 &amp;lt;/getHostedPaymentPageRequest&amp;gt;';
 &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CODE TO RETRIEVE THE ORDER&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
  require 'vendor/autoload.php';
  use net\authorize\api\contract\v1 as AnetAPI;
  use net\authorize\api\controller as AnetController;
  
  define("AUTHORIZENET_LOG_FILE", "phplog");

function getTransactionDetails($transactionId)
{
    /* Create a merchantAuthenticationType object with authentication details
       retrieved from the constants file */
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
 //   $merchantAuthentication-&amp;gt;setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
 //   $merchantAuthentication-&amp;gt;setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);

    $merchantAuthentication-&amp;gt;setName('Mylogin');
   $merchantAuthentication-&amp;gt;setTransactionKey('MyTranskey');	
	
    
    // Set the transaction's refId
    $refId = 'ref' . time();

    $request = new AnetAPI\GetTransactionDetailsRequest();
    $request-&amp;gt;setMerchantAuthentication($merchantAuthentication);
    $request-&amp;gt;setTransId($transactionId);
	$request-&amp;gt;setrefId($refId);
  
    $controller = new AnetController\GetTransactionDetailsController($request);

    $response = $controller-&amp;gt;executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if (($response != null) &amp;amp;&amp;amp; ($response-&amp;gt;getMessages()-&amp;gt;getResultCode() == "Ok"))
    {
        echo "SUCCESS: Transaction Status:" . $response-&amp;gt;getTransaction()-&amp;gt;getTransactionStatus() . "\n";
        echo "                Auth Amount:" . $response-&amp;gt;getTransaction()-&amp;gt;getAuthAmount() . "\n";
        echo "                   Trans ID:" . $response-&amp;gt;getTransaction()-&amp;gt;getTransId() . "\n";

NEXT LINE DOES NOT WORK
        echo "   Reference ID/Session Num:" . $response-&amp;gt;getTransaction()-&amp;gt;getOrder() . "\n";		
     }
    else
    {
        echo "ERROR :  Invalid response\n";
        $errorMessages = $response-&amp;gt;getMessages()-&amp;gt;getMessage();
        echo "Response : " . $errorMessages[0]-&amp;gt;getCode() . "  " .$errorMessages[0]-&amp;gt;getText() . "\n";
    }

    return $response;
  }

  if(!defined('DONT_RUN_SAMPLES'))
  
    getTransactionDetails("123456...");
?&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Jun 2018 20:46:30 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Return-Order-gt-InvoiceNum-or-refTransID-w-Accept-Hosted-Payment/m-p/63344#M37492</guid>
      <dc:creator>jjauthnet</dc:creator>
      <dc:date>2018-06-08T20:46:30Z</dc:date>
    </item>
  </channel>
</rss>

