Pages

Thursday, January 2, 2014

Authorize .Net-Reading Response of Authorize.net api

Reading Error Response
 
AuthorizeNetCIM_Response Object  
 (  
   [xml] => SimpleXMLElement Object  
     (  
       [messages] => SimpleXMLElement Object  
         (  
           [resultCode] => Error  
           [message] => SimpleXMLElement Object  
             (  
               [code] => E00003  
               [text] => The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardNumber' element is invalid - The value '668988888888177645' is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.  
             )  
         )  
     )  
   [response] => ErrorE00003The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardNumber' element is invalid - The value '668988888888177645' is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.  
   [xpath_xml] => SimpleXMLElement Object  
     (  
       [messages] => SimpleXMLElement Object  
         (  
           [resultCode] => Error  
           [message] => SimpleXMLElement Object  
             (  
               [code] => E00003  
               [text] => The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:cardNumber' element is invalid - The value '668988888888177645' is invalid according to its datatype 'String' - The actual length is greater than the MaxLength value.  
             )  
         )  
     )  
 ) 
 Reading Error Response
 $error = (string)array_pop($response->xpath('messages/message/text'));  

Reading Success Response
 AuthorizeNetCIM_Response Object  
 (  
   [xml] => SimpleXMLElement Object  
     (  
       [messages] => SimpleXMLElement Object  
         (  
           [resultCode] => Ok  
           [message] => SimpleXMLElement Object  
             (  
               [code] => I00001  
               [text] => Successful.  
             )  
         )  
       [customerPaymentProfileId] => 21000823
     )  
   [response] => OkI00001Successful.21000823 
   [xpath_xml] => SimpleXMLElement Object  
     (  
       [messages] => SimpleXMLElement Object  
         (  
           [resultCode] => Ok  
           [message] => SimpleXMLElement Object  
             (  
               [code] => I00001  
               [text] => Successful.  
             )  
         )  
       [customerPaymentProfileId] => 21000844  
     )  
 )
 Reading Authorize .Net Success Object
 if($response->isOk())  

No comments:

Post a Comment