<?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 Re: Adding a new line item - SDK - PHP in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/59143#M33741</link>
    <description>&lt;P&gt;My script worked as per &lt;SPAN class="UserName lia-user-name lia-user-rank-Member"&gt;&lt;A href="https://community.developer.authorize.net/t5/user/viewprofilepage/user-id/20033" target="_self"&gt;&lt;SPAN class=""&gt;Providencray&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;'s solution from the above comments, but just only with a single change:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//$lineItem-&amp;gt;setUnitPrice("$50.00")&lt;/PRE&gt;&lt;P&gt;To&lt;/P&gt;&lt;PRE&gt;$lineItem-&amp;gt;setUnitPrice(50.00); //Allowed only a decimal value upto 2 decimal points.&lt;/PRE&gt;</description>
    <pubDate>Thu, 03 Aug 2017 06:06:52 GMT</pubDate>
    <dc:creator>Reza-Mamun</dc:creator>
    <dc:date>2017-08-03T06:06:52Z</dc:date>
    <item>
      <title>Adding a new line item - SDK - PHP</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/53807#M28888</link>
      <description>&lt;P&gt;I'm having a hard time adding a new line item using the SDK (PHP). An error gets generated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;?php&lt;/P&gt;&lt;P&gt;require 'apps/authorizenet/sdk/vendor/autoload.php';&lt;/P&gt;&lt;P&gt;use net\authorize\api\contract\v1 as AnetAPI;&lt;BR /&gt;use net\authorize\api\controller as AnetController;&lt;/P&gt;&lt;P&gt;define("AUTHORIZENET_LOG_FILE","phplog");&lt;/P&gt;&lt;P&gt;// Common setup for API credentials&lt;BR /&gt;$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();&lt;BR /&gt;$merchantAuthentication-&amp;gt;setName("********");&lt;BR /&gt;$merchantAuthentication-&amp;gt;setTransactionKey("**************");&lt;BR /&gt;$refId = 'ref' . time();&lt;/P&gt;&lt;P&gt;// Create the payment data for a credit card&lt;BR /&gt;$creditCard = new AnetAPI\CreditCardType();&lt;BR /&gt;$creditCard-&amp;gt;setCardNumber("4111111111111111");&lt;BR /&gt;$creditCard-&amp;gt;setExpirationDate( "2038-12");&lt;BR /&gt;$creditCard-&amp;gt;setCardCode("513");&lt;BR /&gt;$paymentCreditCard = new AnetAPI\PaymentType();&lt;BR /&gt;$paymentCreditCard-&amp;gt;setCreditCard($creditCard);&lt;/P&gt;&lt;P&gt;// Create the Bill To info&lt;BR /&gt;$billto = new AnetAPI\CustomerAddressType();&lt;BR /&gt;$billto-&amp;gt;setFirstName("Ellen");&lt;BR /&gt;$billto-&amp;gt;setLastName("Johnson");&lt;BR /&gt;$billto-&amp;gt;setCompany("Souveniropolis");&lt;BR /&gt;$billto-&amp;gt;setAddress("14 Main Street");&lt;BR /&gt;$billto-&amp;gt;setCity("Pecan Springs");&lt;BR /&gt;$billto-&amp;gt;setState("TX");&lt;BR /&gt;$billto-&amp;gt;setZip("44628");&lt;BR /&gt;$billto-&amp;gt;setCountry("USA");&lt;BR /&gt;$billto-&amp;gt;setPhoneNumber("310-867-5309");&lt;BR /&gt;//$billto-&amp;gt;setEmail("chingone@wtf.com");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// LineItem - NOT WORKING&lt;BR /&gt;$lineItem = new AnetAPI\LineItemType();&lt;BR /&gt;$lineItem-&amp;gt;setItemId("123");&lt;BR /&gt;$lineItem-&amp;gt;setName("Donation");&lt;BR /&gt;$lineItem-&amp;gt;setDescription("Ellen Johnson donated $50.00");&lt;BR /&gt;$lineItem_Array[] = $lineItem;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Create a transaction&lt;BR /&gt;$transactionRequestType = new AnetAPI\TransactionRequestType();&lt;BR /&gt;$transactionRequestType-&amp;gt;setTransactionType("authCaptureTransaction");&lt;BR /&gt;$transactionRequestType-&amp;gt;setAmount(187.66);&lt;BR /&gt;$transactionRequestType-&amp;gt;setBillTo($billto);&lt;BR /&gt;$transactionRequestType-&amp;gt;setPayment($paymentCreditCard);&lt;BR /&gt;$transactionRequestType-&amp;gt;setLineItems($lineItem_Array);&lt;BR /&gt;&lt;BR /&gt;$request = new AnetAPI\CreateTransactionRequest();&lt;BR /&gt;$request-&amp;gt;setMerchantAuthentication($merchantAuthentication);&lt;BR /&gt;$request-&amp;gt;setRefId( $refId);&lt;BR /&gt;$request-&amp;gt;setTransactionRequest($transactionRequestType);&lt;BR /&gt;$controller = new AnetController\CreateTransactionController($request);&lt;BR /&gt;$response = $controller-&amp;gt;executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);&lt;BR /&gt;//$response = $controller-&amp;gt;executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);&lt;/P&gt;&lt;P&gt;if ($response != null)&lt;BR /&gt;{&lt;BR /&gt;$tresponse = $response-&amp;gt;getTransactionResponse();&lt;BR /&gt;if (($tresponse != null) &amp;amp;&amp;amp; ($tresponse-&amp;gt;getResponseCode()=="1"))&lt;BR /&gt;{&lt;BR /&gt;echo "Charge Credit Card AUTH CODE : " . $tresponse-&amp;gt;getAuthCode() . "\n";&lt;BR /&gt;echo "Charge Credit Card TRANS ID : " . $tresponse-&amp;gt;getTransId() . "\n";&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;echo "Charge Credit Card ERROR : Invalid response :\n";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;echo "Charge Credit Card Null response returned";&lt;BR /&gt;}&lt;BR /&gt;?&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appriciated.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 11:09:07 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/53807#M28888</guid>
      <dc:creator>Bandsaw000o0</dc:creator>
      <dc:date>2016-02-22T11:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a new line item - SDK - PHP</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/53809#M28890</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/19686"&gt;@Bandsaw000o0﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I suggest opening an issue in GitHub for our &lt;A href="https://github.com/AuthorizeNet/sample-code-php" target="_self"&gt;PHP Sample Code&lt;/A&gt;. &amp;nbsp;This will notify the developers working on this directly so they can address.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 17:25:09 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/53809#M28890</guid>
      <dc:creator>RichardH</dc:creator>
      <dc:date>2016-02-22T17:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a new line item - SDK - PHP</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/54558#M29536</link>
      <description>&lt;P&gt;Not sure if you figured it out but I also had the same issue today. I was able to figure it out by dumping the $lineItem_Array. If you look it is passing all this info&lt;/P&gt;&lt;PRE&gt;array(1) { [0]=&amp;gt; object(net\authorize\api\contract\v1\LineItemType)#8 (6) { ["itemId":"net\authorize\api\contract\v1\LineItemType":private]=&amp;gt; string(3) "123" ["name":"net\authorize\api\contract\v1\LineItemType":private]=&amp;gt; string(8) "Donation" ["description":"net\authorize\api\contract\v1\LineItemType":private]=&amp;gt; string(28) "Ellen Johnson donated $50.00" ["quantity":"net\authorize\api\contract\v1\LineItemType":private]=&amp;gt; NULL ["unitPrice":"net\authorize\api\contract\v1\LineItemType":private]=&amp;gt; NULL ["taxable":"net\authorize\api\contract\v1\LineItemType":private]=&amp;gt; NULL } }&lt;/PRE&gt;&lt;P&gt;If you set those variables it should will work. After making the following changes it processed the transaction.&lt;/P&gt;&lt;PRE&gt;$lineItem = new AnetAPI\LineItemType();
$lineItem-&amp;gt;setItemId("123");
$lineItem-&amp;gt;setName("Donation");
$lineItem-&amp;gt;setDescription("Ellen Johnson donated $50.00");
$lineItem-&amp;gt;setQuantity(1);
$lineItem-&amp;gt;setUnitPrice("$50.00");
$lineItem-&amp;gt;setTaxable(0); // 1 Yes 0 for no
$lineItem_Array[] = $lineItem;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 May 2016 21:22:04 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/54558#M29536</guid>
      <dc:creator>providencray</dc:creator>
      <dc:date>2016-05-05T21:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a new line item - SDK - PHP</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/59143#M33741</link>
      <description>&lt;P&gt;My script worked as per &lt;SPAN class="UserName lia-user-name lia-user-rank-Member"&gt;&lt;A href="https://community.developer.authorize.net/t5/user/viewprofilepage/user-id/20033" target="_self"&gt;&lt;SPAN class=""&gt;Providencray&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;'s solution from the above comments, but just only with a single change:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//$lineItem-&amp;gt;setUnitPrice("$50.00")&lt;/PRE&gt;&lt;P&gt;To&lt;/P&gt;&lt;PRE&gt;$lineItem-&amp;gt;setUnitPrice(50.00); //Allowed only a decimal value upto 2 decimal points.&lt;/PRE&gt;</description>
      <pubDate>Thu, 03 Aug 2017 06:06:52 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Adding-a-new-line-item-SDK-PHP/m-p/59143#M33741</guid>
      <dc:creator>Reza-Mamun</dc:creator>
      <dc:date>2017-08-03T06:06:52Z</dc:date>
    </item>
  </channel>
</rss>

