How to use AVS with Card Query

First, use the Card Query API to get the AVS Code. Depending on the response, you may elect to move forward with the transaction. For a full list of AVS Response Codes please use this link..



First you need to get network response code of 00 or 85 (this tells you card is live and can transact).

Example if you want both Zip and Address to match:

*NOTE: This is a pseudo-code example to provide the general idea of how to use AVS. This is not actual code that would run. This represent only a fraction of the AVS codes, please go to our AVS Response Codes page for all possible combinations

// Assuming you have retrieved the AVS response code via the Card Query API.
AVSResponseCode = queryCard();

// Both Zip and Address match. 
// Note Discover has a different response code than Visa, MC, or Amex.
if(AVSResponseCode == 'Y' && cardType == "Visa"){
} else if (AVSResponseCode == 'Y' && cardType == "MC"){

} else if (AVSResponseCode == 'Y' && cardType == "Amex"){

} else if (AVSResponseCode == 'A' && cardType == "Discover"){

} else {


function createTransaction(){
    // Call the create transaction API.

function queryCard(){
    // Call card query API, and return response code.

function rejectTransaction(){
    // Your process for rejecting a transaction.

Create Transaction


Almost done! Don't forget to create a transaction.

Once you have examined the AVS response code and have decided to move forward with the transaction, you have to call the Create Transaction API.

AVS Check allows you to check if the address you received from your customer matches what the issuer has on file. Once you receive this information, you may decide to move forward with the transaction. Your next step is to call the create transaction API.

Create Account

Please note that we recommend that you call Card Query + AVS before creating and account. Our createAccount API does not perform any additional validations on the card, so it is possible to create an account with a bad card.

The Card Query API provides additional information about the card that can help your team decide whether or not to create an account. Here is an example response to calling Card Query + AVS.

  "SC": 200,
  "EC": "0",
  "card": {
    "bin": "411111",
    "last4": "1111",
    "pull": {
      "enabled": true,
      "network": "Visa",
      "regulated": true,
      "currency": "840",
      "country": "840"
    "push": {
      "enabled": true,
      "network": "Visa",
      "type": "Debit",
      "regulated": true,
      "currency": "840",
      "country": "840",
      "availability": "Immediate"
  "AVS": {
    "networkRC": "85",
    "resultText": "NOT DECLINED",
    "codeAVS": "Z",
    "codeSecurityCode": "M",
    "EC": "0"

Did this page help you?