<?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 Retrieving the subscription ID using the get Transaction Report API using the PHP Library in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Retrieving-the-subscription-ID-using-the-get-Transaction-Report/m-p/56561#M31345</link>
    <description>&lt;P&gt;Hi everyone!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got a site that's using the authorize.net ARB system. I'm trying to use the Transaction Reporting 'Get Unsettled Transactions List' function to detect when a payment has failed, and change the status of a user's subscription to cancelled. This will be done via the PHP library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm successfully retrieving the &amp;nbsp;failed payments using the library, but I'm not sure what function I need to use to retrieve the linked subscription ID from the transaction.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is based on the sample code here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/AuthorizeNet/sample-code-php/blob/master/TransactionReporting/get-transaction-details.php" target="_blank"&gt;https://github.com/AuthorizeNet/sample-code-php/blob/master/TransactionReporting/get-transaction-details.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the documentation (&lt;A href="http://developer.authorize.net/api/reference/#transaction-reporting-get-transaction-list" target="_blank"&gt;http://developer.authorize.net/api/reference/#transaction-reporting-get-transaction-list&lt;/A&gt;), I should be able to subscription ID from the subscription-&amp;gt;id object. So I'm using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; if (($response != null) &amp;amp;&amp;amp; ($response-&amp;gt;getMessages()-&amp;gt;getResultCode() == "Ok")) {
    if(null != $response-&amp;gt;getTransactions()){
      foreach($response-&amp;gt;getTransactions() as $key =&amp;gt; $tx) {
        $data[$key]['transaction_id']  = $tx-&amp;gt;getTransId();
&lt;FONT color="#FF0000"&gt;        $data[$key]['subscription_id'] = $tx-&amp;gt;getSubscription-&amp;gt;getId();&lt;/FONT&gt;      }
    }else{
      echo "No unsettled transactions for the merchant." . "\n";
    }
  }else{
    $errorsAndAlerts = "ERROR :  Invalid response\n";
    $errorMessages = $response-&amp;gt;getMessages()-&amp;gt;getMessage();
    $err&lt;/PRE&gt;&lt;P&gt;But this isn't working, and I get a 500 error from the server. Does anyone know what the correct function to get the subscription ID is? Is there any documentation for the PHP library that lists all of the functions to retrieve the different variables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2017 23:24:26 GMT</pubDate>
    <dc:creator>greg162</dc:creator>
    <dc:date>2017-01-04T23:24:26Z</dc:date>
    <item>
      <title>Retrieving the subscription ID using the get Transaction Report API using the PHP Library</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Retrieving-the-subscription-ID-using-the-get-Transaction-Report/m-p/56561#M31345</link>
      <description>&lt;P&gt;Hi everyone!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got a site that's using the authorize.net ARB system. I'm trying to use the Transaction Reporting 'Get Unsettled Transactions List' function to detect when a payment has failed, and change the status of a user's subscription to cancelled. This will be done via the PHP library.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm successfully retrieving the &amp;nbsp;failed payments using the library, but I'm not sure what function I need to use to retrieve the linked subscription ID from the transaction.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is based on the sample code here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/AuthorizeNet/sample-code-php/blob/master/TransactionReporting/get-transaction-details.php" target="_blank"&gt;https://github.com/AuthorizeNet/sample-code-php/blob/master/TransactionReporting/get-transaction-details.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at the documentation (&lt;A href="http://developer.authorize.net/api/reference/#transaction-reporting-get-transaction-list" target="_blank"&gt;http://developer.authorize.net/api/reference/#transaction-reporting-get-transaction-list&lt;/A&gt;), I should be able to subscription ID from the subscription-&amp;gt;id object. So I'm using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; if (($response != null) &amp;amp;&amp;amp; ($response-&amp;gt;getMessages()-&amp;gt;getResultCode() == "Ok")) {
    if(null != $response-&amp;gt;getTransactions()){
      foreach($response-&amp;gt;getTransactions() as $key =&amp;gt; $tx) {
        $data[$key]['transaction_id']  = $tx-&amp;gt;getTransId();
&lt;FONT color="#FF0000"&gt;        $data[$key]['subscription_id'] = $tx-&amp;gt;getSubscription-&amp;gt;getId();&lt;/FONT&gt;      }
    }else{
      echo "No unsettled transactions for the merchant." . "\n";
    }
  }else{
    $errorsAndAlerts = "ERROR :  Invalid response\n";
    $errorMessages = $response-&amp;gt;getMessages()-&amp;gt;getMessage();
    $err&lt;/PRE&gt;&lt;P&gt;But this isn't working, and I get a 500 error from the server. Does anyone know what the correct function to get the subscription ID is? Is there any documentation for the PHP library that lists all of the functions to retrieve the different variables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 23:24:26 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Retrieving-the-subscription-ID-using-the-get-Transaction-Report/m-p/56561#M31345</guid>
      <dc:creator>greg162</dc:creator>
      <dc:date>2017-01-04T23:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving the subscription ID using the get Transaction Report API using the PHP Library</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Retrieving-the-subscription-ID-using-the-get-Transaction-Report/m-p/56595#M31376</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_3" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/21054" target="_self"&gt;greg162&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Your code is correct but it will generate an error if the transaction was not made by a subscription because there will be no subscription node.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Joy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jan 2017 23:16:42 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Retrieving-the-subscription-ID-using-the-get-Transaction-Report/m-p/56595#M31376</guid>
      <dc:creator>Joy</dc:creator>
      <dc:date>2017-01-06T23:16:42Z</dc:date>
    </item>
  </channel>
</rss>

