<?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 Refund Amount using ONLY transaction ID in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Refund-Amount-using-ONLY-transaction-ID/m-p/64872#M38662</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to refund amount using &lt;STRONG&gt;ONLY&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;trasaction ID, but i unable to succeed.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me to resolve this issue? I have using following code Please clink on below link.&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/PaymentTransactions/refund-transaction.php " target="_self"&gt;https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/refund-transaction.php&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;</description>
    <pubDate>Fri, 26 Oct 2018 05:37:40 GMT</pubDate>
    <dc:creator>testing</dc:creator>
    <dc:date>2018-10-26T05:37:40Z</dc:date>
    <item>
      <title>Refund Amount using ONLY transaction ID</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Refund-Amount-using-ONLY-transaction-ID/m-p/64872#M38662</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to refund amount using &lt;STRONG&gt;ONLY&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;trasaction ID, but i unable to succeed.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me to resolve this issue? I have using following code Please clink on below link.&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/PaymentTransactions/refund-transaction.php " target="_self"&gt;https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/refund-transaction.php&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 05:37:40 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Refund-Amount-using-ONLY-transaction-ID/m-p/64872#M38662</guid>
      <dc:creator>testing</dc:creator>
      <dc:date>2018-10-26T05:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: Refund Amount using ONLY transaction ID</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Refund-Amount-using-ONLY-transaction-ID/m-p/64878#M38666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have own find a solution. I just post here so someone might be useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In following code refund to the card either system charged by CIM OR accept.js.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First Get the transaction detail to get the card number if refund to the card&amp;nbsp;whcih was charged by&amp;nbsp; accept.js.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;function getTransactionDetails($transactionId)
{
    $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication-&amp;gt;setName(AUTHORIZENET_API_LOGIN_ID);
    $merchantAuthentication-&amp;gt;setTransactionKey(AUTHORIZENET_TRANSACTION_KEY);
        
        // Set the transaction's refId
        $refId = 'ref' . time();
        $request = new AnetAPI\GetTransactionDetailsRequest();
        $request-&amp;gt;setMerchantAuthentication($merchantAuthentication);
        $request-&amp;gt;setTransId($transactionId);
        $controller = new AnetController\GetTransactionDetailsController($request);
        $response = $controller-&amp;gt;executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
  
        return $response;
}&lt;/PRE&gt;&lt;P&gt;Make a refund process by following function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;function refundTransaction($ary)
    {
        $customerProfileId=$ary['customerProfileId'];
        $customerPaymentProfileId=$ary['customerPaymentProfileId'];
        echo $customerProfileId."----&amp;gt;".$customerPaymentProfileId; 
        
        $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
        $merchantAuthentication-&amp;gt;setName(AUTHORIZENET_API_LOGIN_ID);
        $merchantAuthentication-&amp;gt;setTransactionKey(AUTHORIZENET_TRANSACTION_KEY);
        $refId = 'ref' . time(); // Set the transaction's refId

        // Create the payment data for a credit card
        if($ary['paymnetByAcceptJS']=="yes"){
            $creditCard = new AnetAPI\CreditCardType();
            $creditCard-&amp;gt;setCardNumber($ary['cardnumber']);
            $creditCard-&amp;gt;setExpirationDate("XXXX");
            $paymentOne = new AnetAPI\PaymentType();
            $paymentOne-&amp;gt;setCreditCard($creditCard);
        }else{
            $profileToCharge = new AnetAPI\CustomerProfilePaymentType();
            $profileToCharge-&amp;gt;setCustomerProfileId($customerProfileId);
            $paymentProfile = new AnetAPI\PaymentProfileType();
            $paymentProfile-&amp;gt;setPaymentProfileId($customerPaymentProfileId);
            $profileToCharge-&amp;gt;setPaymentProfile($paymentProfile);
        }

        //create a transaction
        $transactionRequest = new AnetAPI\TransactionRequestType();
        $transactionRequest-&amp;gt;setTransactionType("refundTransaction"); 
        $transactionRequest-&amp;gt;setAmount($ary['amount']);
        $transactionRequest-&amp;gt;setRefTransId($ary['refTransId']);
        if($ary['paymnetByAcceptJS']=="yes"){
            $transactionRequest-&amp;gt;setPayment($paymentOne);
        }else{
            $transactionRequest-&amp;gt;setProfile($profileToCharge);
        }
        
        $request = new AnetAPI\CreateTransactionRequest();
        $request-&amp;gt;setMerchantAuthentication($merchantAuthentication);

        $request-&amp;gt;setRefId($refId);
        $request-&amp;gt;setTransactionRequest($transactionRequest);
        if(isset($ary['isCancelEvent']) &amp;amp;&amp;amp; $ary['isCancelEvent']=="Yes"){
            $paymenLogRes = $this-&amp;gt;addPaymentLog(); 
        }else{
            $paymenLogRes="";
        }

        $controller = new AnetController\CreateTransactionController($request);
        $response = $controller-&amp;gt;executeWithApiResponse(AUTHORIZENET_ENVIRONMENT);
         
        return $response;
    }&lt;/PRE&gt;&lt;P&gt;Hope this might be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;</description>
      <pubDate>Fri, 26 Oct 2018 10:26:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Refund-Amount-using-ONLY-transaction-ID/m-p/64878#M38666</guid>
      <dc:creator>testing</dc:creator>
      <dc:date>2018-10-26T10:26:31Z</dc:date>
    </item>
  </channel>
</rss>

