Using CIM, I created a new customer with payment profile (createCustomerProfile), but then when I called getValidationResponse() to check if the credit card has been approved, I got an error "Error connecting to AuthorizeNet". Here's code:
$rsp = $req->createcustomerProfile($customer, 'liveMode');
if ($rsp->isError()) exit($rsp->getErrorMessage());
$vr = $rsp->getValidationResponse();
if (!$vr->approved) exit($vr->error_message); // failed!!
The new credit card was actually approved as shown in the response message:
This is the the response message:
<?xml version="1.0" encoding="utf-8"?><createCustomerProfileResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><customerProfileId>56445628</customerProfileId><customerPaymentProfileIdList><numericString>53269289</numericString></customerPaymentProfileIdList><customerShippingAddressIdList /><validationDirectResponseList><string>1,1,1,This transaction has been approved.,000000,Y,4971091200,none,Test transaction for ValidateCustomerPaymentProfile.,0.00,CC,auth_only,75,Nancy,Egan,,2223 E Baseline Rd, #B,Gilbert,AZ,85234,,,,ellen.donegan@tawinc.com,,,,,,,,,0.00,0.00,0.00,FALSE,none,E3F1D3A77402420EA216123F5CA83DEE,U,,,,,,,,,,,,XXXX2033,American Express,,,,,,,,,,,,,,,,</string></validationDirectResponseList></createCustomerProfileResponse>
So why did $vr->approved return false?
โ01-31-2013 02:06 PM
Look like you should be using getValidationResponses not getValidationResponse There is a "s"
โ01-31-2013 02:16 PM
what's the difference between getValidationResponse() and getValidationResponses()? When should I use which? Where can I find some document on these functions?
In my case, I only added one payment profile, so I thought I should use the singular version. I'll try the plural version.
โ01-31-2013 02:32 PM
There isn't much documentation other the readme and the "doc" directory. But you could looking thru the source code.
โ01-31-2013 04:43 PM