<?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: Updating a CIM payment profile CC expiration fails in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Updating-a-CIM-payment-profile-CC-expiration-fails/m-p/56941#M31687</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/1928"&gt;@wdbaker54&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The setPayment() function takes an instance of PaymentType, but what's returned by&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;$response-&amp;gt;getPaymentProfile()-&amp;gt;getPayment(); is an instance of PaymentMaskedType. So, i&lt;/SPAN&gt;t's not quite as simple as getting the response and feeding it right back in. You'll probably have to be more explicit about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you replaced your $controller section with the following, it should work:&lt;/P&gt;&lt;PRE&gt;$controller = new AnetController\GetCustomerPaymentProfileController($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") ) {
	  $payCard = new AnetAPI\CreditCardType();
	  $payCard-&amp;gt;setCardNumber($response-&amp;gt;getPaymentProfile()-&amp;gt;getPayment()-&amp;gt;getCreditCard()-&amp;gt;getCardNumber());
	  $payCard-&amp;gt;setExpirationDate($expDate);
	  $payment = new AnetAPI\PaymentType();
	  $payment-&amp;gt;setCreditCard($payCard);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2017 22:34:12 GMT</pubDate>
    <dc:creator>Aaron</dc:creator>
    <dc:date>2017-02-15T22:34:12Z</dc:date>
    <item>
      <title>Updating a CIM payment profile CC expiration fails</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Updating-a-CIM-payment-profile-CC-expiration-fails/m-p/56939#M31686</link>
      <description>&lt;P&gt;I am trying to follow the PHP example found in&amp;nbsp;&lt;A href="https://github.com/AuthorizeNet/sample-code-php.git" target="_self"&gt;https://github.com/AuthorizeNet/sample-code-php.git&lt;/A&gt;&amp;nbsp;example update-customer-payment-profile.php to update an existing payment profile's credit card expiration but the example is not clear on how to do it. The best it says is:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	  // For card information you can pass exactly what comes back from an GetCustomerPaymentProfile
	  // if you don't need to update that info&lt;/PRE&gt;&lt;P&gt;Since I need to modify the card information I thought it would be a simple case of doing a&amp;nbsp;getCreditCard()-&amp;gt;setExpirationDate() on the payment information returned from the getCustomerPaymentProfile(). The editing appears to work but I cannot add the payment back to a new customerPaymentProfile without failing. Here is my code snippet:&lt;/P&gt;&lt;PRE&gt;// getting the existing PaymentProfile
$request = new AnetAPI\GetCustomerPaymentProfileRequest();
$request-&amp;gt;setMerchantAuthentication($merchantAuthentication)
	-&amp;gt;setRefId($refId)
	-&amp;gt;setCustomerProfileId($cpid)
	-&amp;gt;setCustomerPaymentProfileId($ppid);

$controller = new AnetController\GetCustomerPaymentProfileController($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") ) {
	$payment = $response-&amp;gt;getPaymentProfile()-&amp;gt;getPayment();
	$payment-&amp;gt;getCreditCard()-&amp;gt;setExpirationDate($expDate);
}
else {
    errorReturn($response);
}

$paymentprofile = new AnetAPI\CustomerPaymentProfileExType();
$paymentprofile-&amp;gt;setCustomerPaymentProfileId($ppid)
	-&amp;gt;setBillTo($billto)
	-&amp;gt;setPayment($payment);&lt;BR /&gt;
&lt;/PRE&gt;&lt;P&gt;The format of the $expDate is 'MMYY'. When I remove the setPayment() -no problems. Any thoughts?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 18:37:51 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Updating-a-CIM-payment-profile-CC-expiration-fails/m-p/56939#M31686</guid>
      <dc:creator>wdbaker54</dc:creator>
      <dc:date>2017-02-15T18:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a CIM payment profile CC expiration fails</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Updating-a-CIM-payment-profile-CC-expiration-fails/m-p/56941#M31687</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/1928"&gt;@wdbaker54&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The setPayment() function takes an instance of PaymentType, but what's returned by&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;$response-&amp;gt;getPaymentProfile()-&amp;gt;getPayment(); is an instance of PaymentMaskedType. So, i&lt;/SPAN&gt;t's not quite as simple as getting the response and feeding it right back in. You'll probably have to be more explicit about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you replaced your $controller section with the following, it should work:&lt;/P&gt;&lt;PRE&gt;$controller = new AnetController\GetCustomerPaymentProfileController($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") ) {
	  $payCard = new AnetAPI\CreditCardType();
	  $payCard-&amp;gt;setCardNumber($response-&amp;gt;getPaymentProfile()-&amp;gt;getPayment()-&amp;gt;getCreditCard()-&amp;gt;getCardNumber());
	  $payCard-&amp;gt;setExpirationDate($expDate);
	  $payment = new AnetAPI\PaymentType();
	  $payment-&amp;gt;setCreditCard($payCard);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 22:34:12 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Updating-a-CIM-payment-profile-CC-expiration-fails/m-p/56941#M31687</guid>
      <dc:creator>Aaron</dc:creator>
      <dc:date>2017-02-15T22:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a CIM payment profile CC expiration fails</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Updating-a-CIM-payment-profile-CC-expiration-fails/m-p/56942#M31688</link>
      <description>&lt;P&gt;I appreciate the help, Aaron. I was chasing my tail something fierce and couldn't understand the documentation since PHP is something I picked up this last couple years and using the ANetAPI is something in the last month - still learning!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 23:19:10 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Updating-a-CIM-payment-profile-CC-expiration-fails/m-p/56942#M31688</guid>
      <dc:creator>wdbaker54</dc:creator>
      <dc:date>2017-02-15T23:19:10Z</dc:date>
    </item>
  </channel>
</rss>

