I am using the following code
$customerProfile = new AuthorizeNetCustomer;
$customerProfile->description = "Description of customer";
$customerProfile->merchantCustomerId = "honululu27";
$customerProfile->email = "user2@domain.com";
// Add payment profile.
$paymentProfile = new AuthorizeNetPaymentProfile;
$paymentProfile->payment->creditCard->cardNumber = "4111111111111111";
$paymentProfile->payment->creditCard->expirationDate = "2015-10";
$customerProfile->paymentProfiles[] = $paymentProfile;
//Check customer
$request = new AuthorizeNetCIM;
$response = $request->createCustomerProfile($customerProfile);
echo $response->getCustomerProfileId(); //shows up only in case of success
echo $response->xml->resultCode; //never shows up
echo $response->xml->message->code; //never shows up
echo $response->xml->customerProfileId; //shows up only in case of success
// Confused about the portion below
if($response->isOk())
{
echo "Success";
echo $response->getCustomerProfileId();
}
else
{
echo "FAILED";
echo $response->xml->resultCode;
}
Now, as you can probably tell, i am a novice at this, so I can’t figure out how to display the message text and code. The only thing working is the customer id, which shows up in case of success, but what about all the other xml fields like messages?
That makes sense since you only get a profile ID if the API call is successful
Try
echo $response->xml->messages->resultCodeTry
echo $response->xml->messages->message->codeHere is a sample response which shows the XML structure of a CIM response. It should help you see why the code you have isn’t working.