←Back/Product/Stripe Radar/Codex
IntermediateProduct

Use an AI Assistant to Create Payment Fraud Rules

Use a coding assistant like Codex to draft complex Stripe Radar rules, then review their impact in the Stripe dashboard before activating them to block payment fraud.

Use an AI Assistant to Create Payment Fraud Rules

I use Codex to drive Stripe Radar to implement these, like, complex rules, right, these complex rules, and implement them so then I can review them in Stripe and turn them on.

Before you start

About 20 minutes

What you need

  • A defined fraud pattern (e.g., mismatched card and IP countries, use of prepaid cards)

What you’ll make

A reviewed Stripe Radar rule, with its estimated impact assessed before activation.

Tools used

  • Stripe Radar

    Stripe Radar provides fraud detection and configurable rules for payments.

    VisitStripe Radar
  • Codex

    OpenAI's cloud-based AI software engineering agent that can execute code, run tests, and handle complex multi-file tasks autonomously.

    VisitCodex

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

5 steps

Step 01

Define the Pattern

Define the payment pattern you want to investigate, such as a mismatch between card issuing country and IP location. Consider legitimate explanations before proposing a block.

A country mismatch alone does not establish fraud.

Step 02

Prompt the Coding Assistant

Ask a coding assistant such as Codex to draft a Stripe Radar rule using your defined conditions. Check the suggested attributes and syntax against Stripe’s documentation.

Example prompt
Write a Stripe Radar rule to block payments if the card's issuing country is '[Country A]' but the user's IP address is geolocated in '[Country B]'.

Do not share card numbers or other sensitive payment data with the assistant.

Step 03

Review the Rule in Stripe

Copy the generated rule from the coding assistant and paste it into your Stripe Radar rules dashboard. The dashboard provides a more human-readable interpretation of the rule's logic.

The source notes that rules are easier to understand in the Stripe dashboard than as raw code, making this a critical verification step.

Step 04

Review the Estimated Impact

Before activation, use Radar’s rule testing feature to estimate how the rule would have affected historical payments. Examine the matching payments and any available risk or dispute information.

Historical estimates and labels are imperfect; consider the cost of blocking legitimate customers.

Step 05

Activate and Monitor the Rule

If the rule and its estimated impact are acceptable, save and activate it. The rule will apply according to Stripe’s rule evaluation and the conditions you configured.

Monitor matching and blocked payments after activation and revise or disable the rule if it harms legitimate customers.

What good looks like

  • The rule expresses the intended pattern in the Stripe Radar dashboard.
  • Historical impact estimates have been reviewed for potential false positives.
  • If activated, matching payments are monitored for unintended effects.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

Runbook notes

How to recover when the loop fails and where human judgment helps.

If it goes sideways

The AI-generated rule is syntactically incorrect or logically flawed, blocking legitimate customers or failing to stop fraud.
Do not activate the rule. Refine the prompt to the coding assistant with more specific logic. Always use the Stripe Radar review feature to estimate impact before enabling any rule.

Human checkpoints

Let routine work keep moving.

  1. Review the AI-generated rule's logic and syntax in the Stripe dashboard.
  2. Analyze Stripe Radar's estimated impact on both fraudulent and legitimate payments before activating the rule.

Start shipping better products.

Join 250,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start · 14-day Pro trial · SOC 2 Type II