# Better errors for declined paymnts

**URL:** <https://developer.squareup.com/forums/t/better-errors-for-declined-paymnts/1972>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [February 27, 2021, 4:42pm UTC](https://developer.squareup.com/forums/t/better-errors-for-declined-paymnts/1972 "2021-02-27T16:42:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![percussionoid](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@percussionoid](https://developer.squareup.com/forums/u/percussionoid)\
**Post date:** [February 27, 2021, 4:42pm UTC](https://developer.squareup.com/forums/t/better-errors-for-declined-paymnts/1972/1 "2021-02-27T16:42:51Z")

</div>

I’m trying to display useful errors for users whose cards were declined. I just tested a failed payment by entering an incorrect expiration date. I got two errors back:

`{"code":"GENERIC_DECLINE","detail":"Authorization error: 'GENERIC_DECLINE'","category":"PAYMENT_METHOD_ERROR"}`

`{"code":"CVV_FAILURE","detail":"Authorization error: 'CVV_FAILURE'","category":"PAYMENT_METHOD_ERROR"}`

This first one makes sense to me, but second one doesn’t. The CVV I entered was correct, and I was expecting the error to say something about the expiration date being incorrect. I tried this same test with a correct expiration date and incorrect CVV and got the CVV\_FAILURE error there as well, which makes sense in this case.

The above example is associated with this payment id: `7n7d1E8bqwBReqvK0vRt2iPy5NUZY`

Is there a way to get more detailed error for the user when their payments fail? The payment form does a fine job producing errors when card information is invalid, but the API returns very general errors when payments are declined by the bank.

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [March 1, 2021, 4:49pm UTC](https://developer.squareup.com/forums/t/better-errors-for-declined-paymnts/1972/2 "2021-03-01T16:49:35Z")

</div>

Those should be the actual errors for the payment. For the one you provided, it looks like that’s what we received from the bank’s side (CVV failure), so it sounds like they’re providing Square the incorrect information if it was truly an invalid expiration. To be clear, there is an expiration error called `EXPIRATION_FAILURE` that should occur if the date is invalid or if the card is expired.

---

<div class="post-metadata">

**Author:** ![percussionoid](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@percussionoid](https://developer.squareup.com/forums/u/percussionoid)\
**Post date:** [March 1, 2021, 5:10pm UTC](https://developer.squareup.com/forums/t/better-errors-for-declined-paymnts/1972/3 "2021-03-01T17:10:57Z")

</div>

It was definitely an invalid expiration, and I received the CVV\_FAILURE message. I’m not able to see what’s causing failures for live users, but I always get a CVV\_FAILURE message, even though I suspect that sometimes the failure is caused by incorrect zip code or invalid expiration dates. I’m not able to generate the `EXPIRATION_FAILURE` message when testing. Can you recommend a testing strategy for this?

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [March 1, 2021, 10:02pm UTC](https://developer.squareup.com/forums/t/better-errors-for-declined-paymnts/1972/4 "2021-03-01T22:02:58Z")

</div>

Thanks for clarifying. I checked in with our payments team, and they also confirmed this error is coming from the issuer/bank, so that’s what we’re reporting (re: the CVV error). In theory, an expired card or invalid expiration _should_ return an `EXPIRATION_FAILURE` message, however it ultimately is up to the bank to inform us of the issue. So, for instance, I just tested my own personal CC as well and only got a `GENERIC_DECLINE` when using an incorrect expiration date but correct card and CVV.

---

<div class="post-metadata">

**Author:** ![percussionoid](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@percussionoid](https://developer.squareup.com/forums/u/percussionoid)\
**Post date:** [March 1, 2021, 10:20pm UTC](https://developer.squareup.com/forums/t/better-errors-for-declined-paymnts/1972/5 "2021-03-01T22:20:40Z")

</div>

I see, thanks @sjosey. It’s too bad there aren’t more specific error messages, but I understand that this is a bank issue and not something Square can directly address.
