Better errors for declined paymnts

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.

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.

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?

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.

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.