Returning multiple errors through the api

michael's Avatar

michael

10 Dec, 2010 02:46 AM

Do you have any plans to return multiple errors at once through the API? For instance, if both the credit card number and the expiration date are blank, right now I only get one error back, saying the credit card number is blank.

<?xml version="1.0" encoding="UTF-8"?>
<error id="78386" code="412" auxCode="subscription[ccNumber]:isEmpty">
    A value is required
</error>

I know you recognize that both are blank, because both errors show up in the error reporting web interface. It would be nice if I got back both errors through the api as well, like the following:

<?xml version="1.0" encoding="UTF-8"?>
<errors>
    <error id="78386" code="412" auxCode="subscription[ccNumber]:isEmpty">
        A value is required
    </error>
    <error id="78389" code="412" auxCode="subscription[ccExpiration]:isEmpty">
        A value is required
    </error>
</errors>

Thanks!

  1. Support Staff 1 Posted by Marc Guyer on 10 Dec, 2010 03:42 PM

    Marc Guyer's Avatar

    This would be possible as you describe but would break backward compatibility. The API is not intended to be a complete error handler. It's best for that to occur in the client application with native validation and error handling. The API error response should just be relied upon as a "catch-all" for unexpected or rare errors.

    In the future, we might introduce a new API call to retrieve detailed information on an error by ID but it's not on the current roadmap.

  2. 2 Posted by michael on 10 Dec, 2010 07:27 PM

    michael's Avatar

    I would actually expect exactly the opposite - that the API should be a complete error handler. I would prefer to put the minimum amount of logic possible on my side - i.e., I don't want to write complicated checks for valid credit card numbers, expiration dates, zip codes, and ccv numbers - since you have already written them and probably written them to be much more comprehensive than I can. By only returning one error at a time, you make it quite difficult to give the user of an application using your API a good user experience.

    Most of your competitors return multiple errors at a time as well:
    Chargify: http://docs.chargify.com/api-subscriptions
    Recurly: http://docs.recurly.com/api/errors
    I'm pretty sure Spreedly does as well, although I couldn't find the relevant docs.

  3. Support Staff 3 Posted by Marc Guyer on 10 Dec, 2010 08:58 PM

    Marc Guyer's Avatar

    Thanks Michael -- we certainly appreciate your suggestion. Unfortunately it's not possible to change the existing error return format. As I mentioned, we could develop a method to retrieve the error detail. Can you wait for it for a day or two?

  4. 4 Posted by michael on 10 Dec, 2010 10:17 PM

    michael's Avatar

    Take your time! I just wanted to make sure it was on your roadmap and you were aware of it (and the reasons it was desirable).

  5. adam closed this discussion on 28 Sep, 2011 03:00 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM