Search the blog

Most Stripe errors should not be shown to the user. However, card errors are different. If your site is English-only then you can display these as is but if you’re doing a multi-lingual site you will need to translate them.

When an error is returned from the API the object has both a message and code attribute. The code can be used to determine which of your translated messages to use.

Here are the errors that are suitable for the user to see. For each language you wish to use on your site you will need an object for each language as below with the attribute names kept as is.

    "invalid_number": "The card number is not a valid credit card number",
    "invalid_expiry_month": "The card’s expiration month is invalid",
    "invalid_expiry_year": "The card’s expiration year is invalid",
    "invalid_cvc": "The card’s security code is invalid",
    "incorrect_number": "The card number is incorrect",
    "incomplete_number": "The card number is incomplete",
    "incomplete_cvc": "The card’s security code is incomplete",
    "incomplete_expiry": "The card’s expiration date is incomplete",
    "expired_card": "The card has expired",
    "incorrect_cvc": "The card’s security code is incorrect",
    "incorrect_zip": "The card’s zip code failed validation",
    "invalid_expiry_year_past": "The card’s expiration year is in the past",
    "card_declined": "The card was declined",
    "missing": "There is no card on a customer that is being charged",
    "processing_error": "An error occurred while processing the card"
Tim Bennett is a freelance web designer from Leeds. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.