Address Verification System (AVS)

AVS checks are used to verify that the address information provided matches the billing address on file with the card issuer.

Send billing address information from your Stax.js or API integration and read the Address Verification System (AVS) results to check whether it matches the billing address on file with the card issuer (the bank that issued the card).

This guide is for developers. AVS can check the ZIP code, street address, or both, depending on your account's AVS configuration.

  1. Confirm your account's AVS configuration with your account manager. AVS checks can only be tested on a live account; do not expect sandbox transactions to validate AVS behavior.
  2. When you create a payment method through Stax.js or a direct POST request, include the fields your configuration checks: address_zip for the billing ZIP code, address_1 for the billing street address, or both. Use the cardholder's billing address, not a shipping address.
  3. Read avs_message in the POST response to see the address-check result. Handle an unknown result separately from a match or mismatch.

The avs_message property contains a human-readable result and can have one of the following values:

  • Postcode and Address Matched
  • Postcode Matched; Address not Checked
  • Address Matched; Postcode not Checked
  • Postcode and Address not Supplied by Shopper/Merchant
  • Postcode and Address not Matched
  • AVS Service not Supported by User
  • null — the AVS check response is unknown; do not treat this as a match.

If you wish to add AVS support to your live account or for more information, please reach out to your account manager.

Note: AVS checks can only be tested on a live account.

AVS results on BlockChyp card-not-present transactions

For card-not-present transactions (payments made without presenting a physical card) processed on the BlockChyp gateway (the service that processes the payment), you can retrieve both the raw AVS result in avs_code and a human-readable description in avs_message. This applies to charges and pre-authorizations (temporary holds on funds before a charge), whether approved or declined. Transactions processed before support for these fields was introduced do not carry this detail.

To retrieve a transaction's AVS results:

  1. Copy your live merchant API key from Stax Pay > Apps > API Keys. Keep it out of client-side code and public repositories.
  2. Copy the transaction's id from an existing transaction response for the same merchant account. For example, "6f49149d-69a1-48e6-bec5-d63eb5816118" illustrates the ID format; use your own transaction's ID, not this example.
  3. Run the following read-only lookup in Bash with curl installed. Enter your API key and transaction ID at the prompts. This retrieves an existing transaction; it does not create a charge or run a new AVS check.
(
  # Find your live merchant key in Stax Pay > Apps > API Keys.
  if ! read -r -s -p "Live merchant API key: " STAX_API_KEY; then
    printf '\nCould not read the API key.\n' >&2
    exit 1
  fi
  printf '\n'

  # Copy the id from an existing transaction response for this merchant.
  if ! read -r -p "Transaction ID: " TRANSACTION_ID; then
    printf 'Could not read the transaction ID.\n' >&2
    exit 1
  fi
  if [[ -z "$STAX_API_KEY" || -z "$TRANSACTION_ID" ]]; then
    printf 'Provide both an API key and a transaction ID.\n' >&2
    exit 1
  fi
  if [[ "$TRANSACTION_ID" == *[!a-zA-Z0-9-]* ]]; then
    printf 'Use the transaction ID, not a URL or a path.\n' >&2
    exit 1
  fi

  if ! curl --fail-with-body --silent --show-error \
    --connect-timeout 10 --max-time 30 \
    --request GET "https://apiprod.fattlabs.com/transaction/${TRANSACTION_ID}" \
    --header "Authorization: Bearer ${STAX_API_KEY}" \
    --header "Accept: application/json" \
    --header "Content-Type: application/json" \
    --write-out '\nHTTP status: %{http_code}\n'; then
    printf 'Lookup failed. Check the response and HTTP status above, or the curl connection error.\n' >&2
    exit 1
  fi
)

A successful lookup prints the transaction JSON followed by:

HTTP status: 200

Check avs_code and avs_message against the table below. An HTTP 200 means the lookup succeeded, not that the payment was approved or the address matched; check the transaction's success field separately.

  • If the fields are absent or null, no AVS detail is available; do not treat this as a match.
  • If the API returns 401, check your merchant API key.
  • If the API returns 422 with "The selected id is invalid.", check the transaction ID and confirm that it belongs to the merchant associated with your key.
  • If curl reports a connection error or timeout, check your connection before retrying the lookup.
avs_codeavs_message
matchStreet address and ZIP code matched
zip_matchZIP code matched, but the street address did not match
address_matchStreet address matched, but the ZIP code did not match
no_matchNeither the street address nor the ZIP code matched the cardholder's billing address
not_supportedAddress verification is not supported for this card
retryAddress verification was temporarily unavailable
not_applicableAddress verification was not performed for this payment

The transaction message field is not changed. Other gateways keep returning the values listed above.


Did this page help you?