ipasis
Blog/Security Engineering

Reducing Chargebacks with Real-Time IP Reputation Analysis

February 20, 20266 min read

Chargebacks typically result from two vectors: friendly fraud and criminal fraud. While friendly fraud is a post-transaction dispute issue, criminal fraud—specifically Card-Not-Present (CNP) transactions using stolen credentials—is a technical failure at the gateway level.

The correlation between CNP fraud and anonymized connections is statistically significant. Fraudsters utilizing stolen PANs (Primary Account Numbers) invariably route traffic through Residential Proxies, VPNs, or Tor exit nodes to bypass geo-velocity checks and AVS (Address Verification Service) filters.

By integrating IP intelligence into the checkout state machine, engineers can identify high-risk connections and apply dynamic friction (3D Secure) or hard blocks before a transaction is authorized.

The Anonymity-Fraud Nexus

Standard fraud detection relies heavily on device fingerprinting and behavioral analytics. However, device fingerprints can be spoofed, and headless browsers can mimic human interaction.

The network layer provides immutable data. A legitimate customer buying shoes in Chicago rarely routes their traffic through a datacenter in Belarus or a known Tor exit node.

Key IP signals indicating high chargeback risk:

  • Datacenter Proxies: High likelihood of bot automation.
  • Residential Proxies: Often comprised of botnet-infected consumer devices used to mask the attacker's true origin.
  • Tor Exit Nodes: almost exclusively malicious in an e-commerce context.
  • Velocity Anomalies: Multiple unique payment methods from a single IP subnet.

Implementation Strategy

The IP analysis must occur synchronously during the checkout request, ideally before the payment processor tokenization call. This prevents the merchant from incurring authorization fees on fraudulent attempts.

Architectural Flow

  1. Ingress: API Gateway receives POST /checkout.
  2. Extraction: Backend parses the X-Forwarded-For header to get the true client IP.
  3. Intelligence Query: Service queries IPASIS for reputation data.
  4. Decision Engine:
    • Low Risk: Process payment.
    • Medium Risk: Enforce 3D Secure (3DS).
    • High Risk: Reject request (HTTP 403 or generic 400).

Code Implementation

Below is a Python implementation using requests to validate an IP against the IPASIS API before processing a transaction.

import requests
from flask import Flask, request, jsonify

app = Flask(__name__)

IPASIS_API_KEY = 'your_api_key'
IPASIS_ENDPOINT = 'https://api.ipasis.com/v1/lookup'

def get_ip_reputation(ip_address):
    try:
        response = requests.get(
            f"{IPASIS_ENDPOINT}/{ip_address}",
            headers={"x-api-key": IPASIS_API_KEY},
            timeout=0.5  # Strict timeout to prevent checkout latency
        )
        response.raise_for_status()
        return response.json()
    except Exception as e:
        # Fallback: Log error, fail open or closed depending on risk appetite
        print(f"IPASIS lookup failed: {e}")
        return None

def evaluate_risk(reputation_data):
    if not reputation_data:
        return "ALLOW" # Fail open default

    # Hard block criteria
    if reputation_data.get('is_tor'):
        return "BLOCK"
    
    # Check for high-risk proxies with poor reputation score
    # Score 0 (clean) to 100 (malicious)
    if reputation_data.get('is_proxy') and reputation_data.get('score', 0) > 75:
        return "BLOCK"
        
    # Dynamic friction for VPNs or moderate scores
    if reputation_data.get('is_vpn') or reputation_data.get('score', 0) > 50:
        return "3DS_CHALLENGE"
        
    return "ALLOW"

@app.route('/checkout', methods=['POST'])
def process_checkout():
    # Ensure you parse real IP from headers if behind a load balancer
    client_ip = request.headers.get('X-Forwarded-For', request.remote_addr)
    
    reputation = get_ip_reputation(client_ip)
    decision = evaluate_risk(reputation)
    
    if decision == "BLOCK":
        return jsonify({"error": "Transaction declined due to high risk network."}), 403
    
    if decision == "3DS_CHALLENGE":
        return jsonify({"status": "3ds_required", "redirect": "/3ds-verification"})
        
    # Process standard payment logic here...
    return jsonify({"status": "success"})

Handling Residential Proxies

Residential proxies are the most sophisticated vector for chargeback fraud. Attackers route traffic through legitimate residential ISPs (e.g., Comcast, Verizon) via infected devices.

Standard geo-ip lookups fail here because the IP belongs to a legitimate ISP. IPASIS detects these by analyzing traffic patterns and behavioral history associated with the specific IP, not just the ISP owner. If an IP has been associated with credential stuffing or card testing in the last 24 hours, the score field will reflect this risk.

FAQ

Q: Will blocking VPNs hurt legitimate conversion rates? A: It can. Privacy-conscious users utilize VPNs. Do not hard-block all VPNs. Instead, use the score metric. A VPN IP used solely for privacy will have a low risk score. A VPN IP used for carding will have a high score. Only block the latter, or force 3DS authentication for all VPN traffic.

Q: What is the latency impact on the checkout flow? A: IPASIS is architected for real-time decisioning with sub-50ms response times. Implementing a strict timeout (e.g., 200ms) in your HTTP client ensures that if a lookup hangs, your checkout flow fails open rather than stalling.

Q: How do we handle IPv6? A: Fraud rates on IPv6 are currently lower due to the complexity of rotating IPv6 subnets effectively, but they are rising. Ensure your IP extraction logic correctly handles IPv6 formats before sending them to the intelligence API.

Secure Your Gateway

Chargebacks are a lagging indicator of security failures. By the time you receive a dispute, the revenue is lost and the fees are assessed. Move your defense left by validating the network integrity of every request.

Get your API Key from IPASIS and start scoring traffic today.

Start detecting VPNs and Bots today.

Identify anonymized traffic instantly with IPASIS.

Get API Key