> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fraudeg.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Card testing

> Detect when someone uses your checkout to test which stolen cards work

In a card-testing attack, someone uses your checkout as a test bench: they send many
small charges with stolen or generated cards to find out which ones are still live. Every
approved attempt is a card that will later be used somewhere else, and every declined attempt raises your
costs and muddies your authorization rate. Fraudeg **recognizes** the pattern in the transaction and
returns a **decision** before you charge.

**Who it's for:** merchants with a card checkout, gateways that process for many
merchants, and issuers that want to see attacks on their BINs.

## Signals that matter

These are the [public codes](https://docs.fraudeg.com/en/referencia/flags.md) that appear in `flags[].code` and in
`decision.reason` during this kind of attack. The last column says what to send so
that the signal's category gets evaluated (see [Fields](https://docs.fraudeg.com/en/integrar/campos.md)).

| Code | Category | What it tells you | What to send to enable it |
| - | - | - | - |
| `CARD_TESTING_PATTERN` | `payment` | Card-testing behavior on this card, BIN, or checkout | `card_hash`, `expanded_bin`, `merchant_id`, `cards_tried_count`, `payment_attempts_count`, `declined_before_approved` |
| `AUTH_CVV_MISMATCH` | `authentication` | The CVV failed or wasn't sent | `cvv_result`, `auth_response_code` |
| `VELOCITY_DEVICE_BURST` | `velocity` | Unusual burst of transactions | There's no single field: it relies on `device_id`, `ip_address`, and `user_id` |
| `DEVICE_SHARED_BY_MANY_USERS` | `device` | A device used by several unrelated accounts | `device_id`, `device_fingerprint` |
| `NETWORK_SHARED_ORIGIN` | `network` | Network origin shared by unrelated users | `ip_address` |
| `NETWORK_ANONYMIZED_ORIGIN` | `network` | Connection through an anonymizing network | `ip_address` |
| `CARD_REPORTED_COMPROMISED` | `core` | The issuer flagged the card as lost, stolen, or compromised | — |

Always send `payment_method` with a value from the `card` rail (see
[Payment methods](https://docs.fraudeg.com/en/referencia/metodos-de-pago.md)). Without a recognizable rail, the evaluation falls
back to `unknown` and card signals don't fire.

## How Fraudeg solves it

Your system acts on [`decision.type`](https://docs.fraudeg.com/en/conceptos/decisiones), never on the score. When
your team blocks an entity, subsequent attempts with that entity carry
`entity_block:<kind>:<value>` in `decision.reason`.

## Implementation

**1. Send every payment attempt**

Call [`POST /analyze`](https://docs.fraudeg.com/en/integrar/primera-transaccion) before charging, with one
`X-Idempotency-Key` per attempt (see [Idempotency](https://docs.fraudeg.com/en/integrar/idempotencia.md)). Include the
fields from the table above: without `card_hash`, `device_id`, or `ip_address` the engine can't
relate an attempt to the previous ones.

**2. Act on the decision**

`BLOCK`: don't charge. `STEP_UP_AUTH`: request the verification that comes in `conditions`.
`HOLD`: don't ship until it's reviewed. If the attack volume doesn't let you wait for the
response, use [asynchronous analysis](https://docs.fraudeg.com/en/integrar/analisis-asincrono.md).

**3. Tune rules, thresholds, and lists**

In **Decision Engine**, check which rules are active in [Rules](https://docs.fraudeg.com/en/manual/reglas.md) and create
a [custom rule](https://docs.fraudeg.com/en/manual/reglas-personalizadas.md) for your case, for example: if
`is_guest_checkout` is true **AND** `cc_is_foreign_bin` is true, **Step-up**.
Leave it in **shadow mode** before activating it. The
[decision bands](https://docs.fraudeg.com/en/manual/umbrales.md) are tuned per payment method.

**4. Work alerts and blocks**

In [Alerts](https://docs.fraudeg.com/en/manual/alertas.md), when you **Close** an alert as **Confirmed fraud** you can
block the entity in the same step. The entries land in
[Entity lists](https://docs.fraudeg.com/en/manual/listas-de-entidades.md), where you also see **Fraud
rings**: groups of cards, devices, and IPs that transact together.

**5. Measure and watch**

Create a [monitor](https://docs.fraudeg.com/en/manual/monitores.md) on **% blocked** or **Transactions per hour** scoped
to your merchant or BIN, so you find out when an attack starts.

## What to measure

| Metric | Where you see it |
| - | - |
| **Authorization rate** and its trend by BIN | **Dashboards › Business analysis** ([Dashboards](https://docs.fraudeg.com/en/manual/dashboards.md)) |
| **Rejection analysis** by response code, reason, and country | **Dashboards › Business analysis** |
| **Card testing** detected in your history | **Dashboards › Fraud analysis**, **Pattern detection and rule generation** tab |
| **% blocked** and **Transactions per hour** | [Monitors](https://docs.fraudeg.com/en/manual/monitores.md) |
| Precision of your alerts: how many you closed as **Confirmed fraud** versus **False positive** | [Alerts](https://docs.fraudeg.com/en/manual/alertas.md) |

## Go-live checklist

* [ ] You send `card_hash`, `device_id`, and `ip_address` on every attempt, not just the approved ones.
* [ ] Your code branches on `decision.type` and treats an unknown reason code as a generic signal.
* [ ] Every retry uses the same `X-Idempotency-Key`.
* [ ] Your custom rules went through **shadow mode** and a backtest before being activated.
* [ ] Someone on your team has `CASE_RESOLVE` and `ENTITY_LISTS_MANAGE` to close alerts and block.
* [ ] You have a monitor on **% blocked** that notifies by **Email** or **Webhook**.
* [ ] You reviewed [Going to production](https://docs.fraudeg.com/en/integrar/produccion.md).

## Next steps

> [card] [Account takeover](https://docs.fraudeg.com/en/casos-de-uso/toma-de-cuenta.md)
>
> When the attacker isn't testing cards, but getting into a real account.

> [card] [Entity lists](https://docs.fraudeg.com/en/manual/listas-de-entidades.md)
>
> Block cards, devices, and IPs, and review fraud rings.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.