Gateway Response Codes - Part II: How to Handle Common Response Codes (2024)

January 22, 2021 by: Jeffrey Pauletto

Heads up! Before you dig into the most common response codes, we recommend taking a look at Part I of this article series. The first article goes into more detail on what these codes are and the five categories.

As we noted in part I, there are hundreds of gateway response codes. This article goes over the 10 most common response codes and how you can manage them.

Insufficient Funds (NSF)

An insufficient funds decline means just what it says – the customer doesn’t have enough money in their account to pay for the transaction. To get it to approve, you need to wait until they do have enough, so you should retry at some point in the future. Ideally, you can do this on days they’re most likely to have money again, like a payday Friday.

Generic Bank Decline

These are, as the description indicates, generic. There are many reasons why a bank could decline it under this reason, but ultimately, it’s a soft decline that will be best recovered by trying another. Unlike NSF declines, there’s no day that’s going to be better than others unless you have a lot of data and can analyze by day, by BIN, by day of the week, by MCC, by amount, to best determine when to retry. Just give it another try in a few days and see how it goes.

Do Not Honor

Very similar to Generic Bank Decline, a Do Not Honor implies the bank has rejected the transaction for some reason they’re not divulging. And just as the recovery strategy is for that, unless you have a vast swath of data to understand how to retry, your best bet is just to try again in a few days and see how it goes.

Transaction cannot be completed

This can be the result of a few different issues. It could be that the transaction had a timeout in-transit, that the merchant bank can’t (or doesn’t want) to make a decision at this time, or one of a myriad of other issues. It’s becoming a recurring theme, but unless you really know how to optimize these declines, just try again in a few days, and see how it goes.

You need to refer to the Card Issuer

This is sometimes the same as the declines listed above, one that can be recovered by simply retrying a few times, but it could be resolved by doing exactly what the message says – reach out to the card issuer. If you know the cardholder’s bank, you can call them as the merchant, and see if there’s anything you can do to resolve the issue.Sometimes it’s as simple as getting validation from the merchant that it’s a legitimate transaction, and sometimes they won’t be able to help you at all, but at least it gives you another avenue to explore.

Invalid card number

Invalid card number is a hard decline, and there isn’t much you can do with it. It means the card number simply won’t ever work again, regardless of how much you’d want to try.There are services available to some merchants, like Account Updater, that can give you updated credit card information if available, but that can be a very expensive service. You’ll have to see if the ROI makes sense for your business.Alternatively, most reputable recovery services (like FlexPay) offer this for free.

Transaction not permitted to that cardholder (or Cardholder transaction not permitted)

Think of this as the customer unsubscribing from your service the hard way.The most common way this can happen is because they’ve deactivated their subscription in some management system (generally PayPal), or their merchant bank has blocked the transaction on the customer’s behalf.In any case, the likelihood of a recovery on this is next to nil.

Restricted Card

These most often appear if a customer’s using a business card. Businesses can block transactions based on the MCC of the merchant.If you are a merchant with multiple merchant accounts under different MCCs, you may find success by moving the customer over to your other MIDs.

The bank has requested that you retrieve the card from the cardholder

The card has been flagged as lost or stolen.Don’t try to recover, but you can use Account Updater to try and get the customer’s new credit card details.Note that if you see a significant portion of your traffic (over 5%) with this response code, you’re likely getting bad traffic sent to your site and will want to do something to prevent scammers from using your site to try bad credit cards.

Risk Blocked Transaction refused due to risk model

The gateway generally returns this. If you see this often, you’ll want to reach out to the gateway to determine what’s causing this and what you can do to resolve this issue.

Now that you’ve had a chance to review the most common response codes, our hope is that you’ll feel more confident knowing how to handle them yourself. Please don’t be overwhelmed by all this information, there are great solutions available to help you manage response codes and recover declined transactions.

Contact our team to get a better understand of how we can help your business double your recovery!

Gateway Response Codes - Part II: How to Handle Common Response Codes (2024)

FAQs

How do you handle error responses and status codes in API automation testing? ›

  1. 1 Use consistent and meaningful error codes. ...
  2. 2 Provide clear and helpful error messages. ...
  3. 3 Implement error logging and monitoring. ...
  4. 4 Follow the fail-fast and fail-safe principles. ...
  5. 5 Communicate and collaborate with your stakeholders. ...
  6. 6 Learn from your errors and improve your API testing. ...
  7. 7 Here's what else to consider.
Mar 16, 2023

What are the most common HTTP response status codes? ›

Here are some of the most common HTTP status codes and their meanings: 1xx Informational: 100 Continue 2xx Success: 200 OK 201 Created 204 No Content 3xx Redirection: 301 Moved Permanently 302 Found 304 Not Modified 4xx Client Error: 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 5xx Server Error: 500 ...

What is the common error response code? ›

Status Code 404 – The most common status code the average user will see. A status code 404 occurs when the request is valid, but the resource cannot be found on the server. Even though these are grouped in the Client Errors “bucket,” they are often due to improper URL redirection.

What is the best practice for API error response? ›

Provide a clear and consistent structure for your error response: When an error occurs, your API error response should follow an established structure that is consistent across all requests. Additionally, your API responses should be idempotent to make the structure and response more predictable.

How do you handle exceptions in REST API? ›

To handle a REST API error, do the following: Add an Exception Handler to the logic that uses the REST API method, and set the Exception property to All Exceptions so that the exception handler catches all exceptions.

What are the common error codes that we receive with push and patch requests? ›

The PATCH method could return a number of different status codes. For a successful PATCH, common status codes would likely be 200 (OK) or 204 (No Content). If the PATCH method was unsuccessful, status codes such as 304 (Not Modified), 400 (Bad Request), or 422 (Unprocessable Entity) may be seen.

What are the three most common message types used by HTTP? ›

There are THREE common HTTP message types: GET, POST and PUT. Match below functions to each message type Uploads resources or content to the web server.

What is a bad HTTP response code? ›

HTTP status codes the server can generate in response to HTTP requests: 200 OK : Successful request. 400 Bad Request : Invalid argument (invalid request payload).

Which HTTP status code is most frequently used for response when a resource is successfully created using REST endpoint? ›

HTTP 200 indicates that the client's request to the server has been answered successfully. Depending on the nature of the request, the server includes optional data in its response. The HTTP 201 status code is used when the server successfully responds to the client's request.

How do you resolve code errors? ›

  1. Understand the Error Message. When an error occurs, the first step is to carefully read and understand the error message. ...
  2. Use a Debugger. ...
  3. Write Test Cases. ...
  4. Use Static Code Analysis Tools. ...
  5. Perform Code Reviews. ...
  6. Break Down Complex Problems. ...
  7. Apply Fixes and Verify. ...
  8. Learn from Your Mistakes.
Jun 24, 2023

What is not acceptable response code? ›

A 406 Not Acceptable status code means that the server is unable to provide a response that matches the client's requested format, typically specified in the Accept header of the request.

What is the most common error correcting code? ›

The most well-known Hamming code is the (7,4) code which uses a 'generator matrix' to create three parity bits added to our four bits that make up the message, and is a code that can detect and correct single errors.

How do you handle error responses in your API tests? ›

Best Practices for API Responses Error Messages
  1. Use Standard HTTP Status Codes.
  2. Provide Additional Error Codes.
  3. Include Error Messages.
  4. Consistent Error Handling.
  5. Implementing Error Handling and Reporting.
  6. Apidog: A Powerful API Documentation Tool.

How do you handle large API responses? ›

REST API Pagination is a technique used to manage large data sets in API responses by breaking the data into smaller chunks, called pages. By doing so, it makes the API responses more manageable, efficient, and user-friendly, as it avoids overloading the client application with too much data at once.

How do you handle responses from API? ›

API responses use the following conventions:
  1. All response fields are in camelCase: userName , envelopeId .
  2. All values that represent constants or enumerations, except for errors, are given in lowercase: status: 'created' .
  3. Error constants are in uppercase.
  4. Fields with uri in their name are relative to the base URL.

How to handle status code in API? ›

HTTP status codes the server can generate in response to an HTTP POST or HTTP GET request:
  1. 200 OK : Successful request.
  2. 400 Bad Request : Invalid argument (invalid request payload).
  3. 403 Forbidden : Permission denied (e.g. invalid API key).
  4. 429 Resource Exhausted : Either out of resource quota or reaching rate limiting.
Feb 6, 2024

How do you validate responses in API automation? ›

First, create a schema representing the expected response format. Then, compare the received API response against this schema to ensure compliance. Tools like Postman or libraries such as Ajv (for JavaScript) validate the response based on defined schema rules, checking data types, formats, and required fields.

How do you handle errors in go API? ›

Best Practices for Error Handling in Golang:

Use Named Return Values: Declare the error as a named return value. This makes your code more readable and helps avoid shadowing variables. Custom Errors: You can create custom error types by implementing the method on your structs.

Top Articles
Latest Posts
Article information

Author: Aron Pacocha

Last Updated:

Views: 5669

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Aron Pacocha

Birthday: 1999-08-12

Address: 3808 Moen Corner, Gorczanyport, FL 67364-2074

Phone: +393457723392

Job: Retail Consultant

Hobby: Jewelry making, Cooking, Gaming, Reading, Juggling, Cabaret, Origami

Introduction: My name is Aron Pacocha, I am a happy, tasty, innocent, proud, talented, courageous, magnificent person who loves writing and wants to share my knowledge and understanding with you.