Integration and Testing

Authorize.Net API questions and help with your payment integration.

Posts: 11
Registered: ‎09-28-2016

Re: Are there ever multiple error messages in API responses?

1. There are very few cases when multiple messages are passed in the API response. I am not sure if those cases would come under the APIs used by Accept hosted. Ususally, there is only error message code. And usually, you would want to resolve that error first (by checking the Response Code Tool ), before moving on to investigating any subsequent errors. So, checking/handling only the first error message is a common approach in our sample codes.


2. Another thing I wanted to point out was that in case of transactions, errors are returned in <errors> element inside the <transactionResponse> field. If you are using transaction APIs (including charge a customer profile) at any point, make sure to handle the error cases returned in the errors element as well. 

Example: Sample code - Charge a customer profile . The errors element will have all the errors in validation, so it's better to consider all the errors here, not just the first one.


3. One more point you would notice in the example above is that a transaction can have errors, even when the general result code "Ok" : Lines 68-69

Posts: 1
Registered: ‎06-18-2018

Are there ever multiple error messages in API responses?

I'm integrating the Accept hosted form, so using the API for the first time. The API seems to usually come back with a success message or single error message:

    "customerPaymentProfileIdList": [],
    "customerShippingAddressIdList": [],
    "validationDirectResponseList": [],
    "messages": {
        "resultCode": "Error",
        "message": [
                "code": "E00039",
                "text": "A duplicate record with ID **** already exists."

I notices "messages" is plural, and "message" is an array. I'm wondering whether this means there are sometimes multiple errors, or whether it's just an artifact of the underlying XML format.


This has implications for how I write my handling code. Are there ever multiple elements in the "message" array?