Skip to content
Tutorials Center
My learning

Topics

Lesson 31 of 38 ยท Testing and Fraud

Radar and Fraud Prevention

Understand common payment fraud such as card testing and stolen cards, how Stripe Radar scores risk, how rules and velocity limits work, and which signals your own code should check.

Fraud on a payment site is not rare, and it is expensive: the sale is reversed, you pay a dispute fee, and too many disputes can get your account restricted. Preventing it is about reducing risk without turning away good customers. This lesson explains the common attacks, what Stripe Radar does for you, and the simple checks you can add yourself.

Common attack patterns

  • Stolen card use: a criminal buys goods with a card they do not own. The real owner later disputes the charge.
  • Card testing: bots submit many small payments with lists of card numbers to find which are valid. You see a burst of failed charges, often tiny amounts, from a few IP addresses. Even failed attempts cost you fees and can harm your standing.
  • Account takeover: an attacker logs in as a customer and spends their saved cards.
  • Friendly fraud: a genuine customer disputes a legitimate purchase. This is a policy and evidence problem more than a technology one.
  • Refund and promo abuse: repeated sign-ups to exploit coupons.

What Radar does

Radar is Stripe's fraud tool, included with Stripe payments. It scores each payment's risk using machine learning trained on a huge volume of transactions across Stripe, and it can block or review payments. You see a risk_level (for example normal, elevated, highest) and a risk score on the charge. You decide what to do with it:

  • Block payments the model rates as highest risk (default behaviour).
  • Review suspicious payments manually before you ship.
  • Rules you write yourself, such as "block if the card country differs from the IP country and the amount is above 500". Rules use attributes like :card_country:, :ip_country:, :risk_score: and :amount_in_usd:. Verify the exact attribute names in the current Radar documentation before relying on a rule.
  • Allow and block lists for emails, cards and IP addresses.
flowchart TD
  P["Payment attempt"] --> R["Radar risk score"]
  R --> A{"Your rules"}
  A -->|"score too high"| B["Block"]
  A -->|"mid risk"| V["Manual review"]
  A -->|"low risk"| OK["Approve"]

Radar scores, your rules decide.

Rules are just conditions

A fraud rule is a function of the payment's attributes that returns an action. Here is a small engine that works in the same spirit as Radar rules, so you can see how precedence and thresholds behave.

Node.js A tiny risk rules engine

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Order matters: the first matching rule wins, so put the strictest rules first.

Card-testing defence: velocity limits

Bots try many cards quickly. Limit how many attempts one IP, one session or one account can make in a window. Combine this with a CAPTCHA on the payment form, and never expose an endpoint that lets anyone create unlimited PaymentIntents without a session.

Node.js Sliding-window attempt limiter

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

Signals you can pass to Stripe

Good data improves Radar. Send the customer's email, billing and shipping details, and your own account identifiers in metadata. Use Stripe.js and Elements so Stripe can collect device signals. Collecting the postal code and CVC checks lets issuers verify the card (address_postal_code_check, cvc_check on the charge).

Balance friction and approval

Every extra check can lose real customers. Measure two numbers: the fraud rate (disputes divided by payments) and the false-positive rate (good orders blocked). Tune rules with data, not fear. Start with Radar's defaults, review blocked payments weekly, and tighten only where you see a pattern.

Stripe's tools reduce but never remove fraud. You remain responsible for fulfilling only legitimate orders, so delay shipping of high-value, high-risk orders until they are reviewed.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is card testing?

    Attackers probe lists of stolen numbers with tiny charges, which shows up as bursts of failures.
  2. 2. What does a Radar risk score help you do?

    The score is an input to block, review or allow decisions.
  3. 3. Why order fraud rules from strictest to loosest?

    Rules are evaluated in order, so the strictest must come first to take effect.
  4. 4. Which measure helps you notice you are blocking too many good customers?

    Blocked-but-legitimate orders are false positives and cost revenue.

Summary

  • Common attacks: stolen cards, card testing, account takeover, friendly fraud.
  • Radar scores each payment; you add rules, review queues and lists.
  • Use velocity limits, CAPTCHAs and sessions to stop card testing.
  • Track fraud and false-positive rates and tune with data.

Next: Disputes and Chargebacks