1
我使用下面的代碼如何獲得authorize.NET CIM php sdk的resultCode和代碼/消息?
$customerProfile = new AuthorizeNetCustomer;
$customerProfile->description = "Description of customer";
$customerProfile->merchantCustomerId = "honululu27";
$customerProfile->email = "[email protected]";
// 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;
}
現在,你可能會說,我在這一個新手,所以我無法弄清楚如何以顯示消息文本和代碼。唯一能夠工作的就是客戶ID,在成功的情況下顯示,但是所有其他XML字段如消息呢?