Account Updater Testing
Basis Theory provides an Account Updater sandbox environment that provides stubbed responses without forwarding your requests to the card networks for updates.
Once the feature is enabled, test tenants will be configured to use the Account Updater sandbox, and you can use the test cards defined below to simulate various scenarios.
Test Cards
You can use the following test cards within Account Updater enabled test tenants to simulate specific Account Updater Result Codes.
PAN | Exp. Month | Exp. Year | Result Code | Update Details |
---|---|---|---|---|
4111111111111111 | 12 | 2023 | UPD_PAN | 4166676667666746 |
5105105105105100 | 12 | 2023 | UPD_PAN | 5233580618829955 , 12/2026 |
6011690151507086 | 12 | 2023 | UPD_EXP_DATE | 12/2026 |
6011760519541711 | 12 | 2023 | UPD_BRAND_CONV | N/A |
6011490740263725 | 12 | 2023 | UPD_CORRECTED | N/A |
5461310156953048 | 12 | 2023 | WRN_CLOSED_ACCOUNT | N/A |
4929980395567582 | 12 | 2023 | WRN_CONTACT_CARDHOLDER | N/A |
4916725297925395 | 12 | 2023 | WRN_ISSUER_NO_DATA | N/A |
5580422612666704 | 12 | 2023 | WRN_ISSUER_NOT_ENROLLED | N/A |
4035501000000008 | 12 | 2023 | WRN_OPT_OUT | N/A |
122000000000003 | 12 | 2023 | WRN_UNSUPPORTED_NETWORK | N/A |
6011178332216017 | 12 | 2023 | ERR_UNDEFINED | N/A |
6011648103759866 | 12 | 2023 | ERR_INVALID_EXP_DATE | N/A |
378025849667382 | 12 | 2023 | ERR_INVALID_PAN | N/A |
370000000000002 | 12 | 2023 | ERR_INVALID_CONFIG | N/A |
4711358892785746 | 12 | 2023 | NO_UPDATE | N/A |
Generating Test Tokens
Since Account Updater Batch and Real-Time requests accept a card
token as input, you will first need to tokenize one or more of the Test Cards defined above.
To help you quickly get started, you can use the following script to generate card tokens for each of these test cards in your test tenant.
#!/bin/bash
# Set your Basis Theory API key with token:create permission
BT_API_KEY="<Enter Your BT-API-KEY>"
# Define the card data
cards=(
# Format: "PAN,ExpirationMonth,ExpirationYear,ResultCode"
"4111111111111111,12,2023,UPD_PAN"
"5105105105105100,12,2023,UPD_PAN"
"6011690151507086,12,2023,UPD_EXP_DATE"
"6011760519541711,12,2023,UPD_BRAND_CONV"
"6011490740263725,12,2023,UPD_CORRECTED"
"5461310156953048,12,2023,WRN_CLOSED_ACCOUNT"
"4929980395567582,12,2023,WRN_CONTACT_CARDHOLDER"
"4916725297925395,12,2023,WRN_ISSUER_NO_DATA"
"5580422612666704,12,2023,WRN_ISSUER_NOT_ENROLLED"
"4035501000000008,12,2023,WRN_OPT_OUT"
"122000000000003,12,2023,WRN_UNSUPPORTED_NETWORK"
"6011178332216017,12,2023,ERR_UNDEFINED"
"6011648103759866,12,2023,ERR_INVALID_EXP_DATE"
"378025849667382,12,2023,ERR_INVALID_PAN"
"370000000000002,12,2023,ERR_INVALID_CONFIG"
"4711358892785746,12,2023,NO_UPDATE"
)
# Batch size
batch_size=5 # default tokenization limit tenant setting
total_cards=${#cards[@]}
declare -a pan_array result_array token_array
for ((i=0; i<total_cards; i+=batch_size)); do
batch_json="["
for ((j=i; j<i+batch_size && j<total_cards; j++)); do
IFS=',' read -r pan exp_month exp_year result_code <<< "${cards[j]}"
pan_array+=("$pan")
result_array+=("$result_code")
token_json=$(cat <<EOF
{
"type": "card",
"data": {
"number": "$pan",
"expiration_month": "$exp_month",
"expiration_year": "$exp_year"
},
"metadata": {
"result_code": "$result_code"
}
}
EOF
)
batch_json+="$token_json"
if [[ $j -lt $((i + batch_size - 1)) && $j -lt $((total_cards - 1)) ]]; then
batch_json+=","
fi
done
batch_json+="]"
response=$(curl --silent --location 'https://api.basistheory.com/tokenize' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "BT-API-KEY: $BT_API_KEY" \
--data "$batch_json")
token_ids=($(echo "$response" | jq -r '.[].id'))
token_array+=("${token_ids[@]}")
done
printf "| %-36s | %-20s | %-25s |\n" "Token ID" "Test Card Number" "Result Code"
printf -- "|--------------------------------------|----------------------|---------------------------|\n"
for ((i = 0; i < ${#token_array[@]}; i++)); do
printf "| %-36s | %-20s | %-25s |\n" "${token_array[$i]}" "${pan_array[$i]}" "${result_array[$i]}"
done
Running this script with your API key should print the following output:
| Token ID | Test Card Number | Result Code |
|--------------------------------------|----------------------|---------------------------|
| <token id> | 4111111111111111 | UPD_PAN |
| <token id> | 5105105105105100 | UPD_PAN |
| <token id> | 6011690151507086 | UPD_EXP_DATE |
| <token id> | 6011760519541711 | UPD_BRAND_CONV |
| <token id> | 6011490740263725 | UPD_CORRECTED |
| <token id> | 5461310156953048 | WRN_CLOSED_ACCOUNT |
| <token id> | 4929980395567582 | WRN_CONTACT_CARDHOLDER |
| <token id> | 4916725297925395 | WRN_ISSUER_NO_DATA |
| <token id> | 5580422612666704 | WRN_ISSUER_NOT_ENROLLED |
| <token id> | 4035501000000008 | WRN_OPT_OUT |
| <token id> | 122000000000003 | WRN_UNSUPPORTED_NETWORK |
| <token id> | 6011178332216017 | ERR_UNDEFINED |
| <token id> | 6011648103759866 | ERR_INVALID_EXP_DATE |
| <token id> | 378025849667382 | ERR_INVALID_PAN |
| <token id> | 370000000000002 | ERR_INVALID_CONFIG |
| <token id> | 4711358892785746 | NO_UPDATE |