Developer Docs

Get integrated in about 5 minutes.

MeraFraud scores the fraud risk of a transaction in real time and returns a decision: approve, review, or block. This page has everything a developer needs to hook it up.

Get your API key

Sign up at merafraud.com/dashboard/signup.html with your store name and email. You'll get an API key immediately (starts with sk_live_...). Keep it secret — treat it like a password.

Make your first request

Call this endpoint right before you accept a payment (e.g. when the customer clicks "Place Order"):

POST https://merafraud-apimerafraud-api-v2.onrender.com/api/predict
Headers:
  Content-Type: application/json
  X-API-Key: <your API key>

Body:
{
  "transaction_amount": 129.90,
  "amount_ratio_to_avg": 1.4,
  "account_age_days": 180,
  "customer_ltv": 240,
  "time_since_last_tx_min": 600,
  "num_tx_last_24h": 1,
  "hour_of_day": 15,
  "num_items_in_cart": 2,
  "num_failed_payments_7d": 0,
  "login_attempts_before_purchase": 1,
  "billing_shipping_mismatch": 0,
  "ip_billing_country_mismatch": 0,
  "new_device": 0,
  "new_payment_method": 0,
  "free_email_domain": 0,
  "express_shipping": 0
}

All 16 fields above are required — they're the signals the ML model was trained on. If your platform doesn't track one yet, send a reasonable default; accuracy improves as you fill in more real data over time.

Read the response

{
  "risk_score": 0.07,
  "risk_level": "approve",
  "reasons": ["No strong anomaly detected; score reflects overall pattern"],
  "thresholds": { "block": 0.75, "review": 0.35 },
  "tenant": "Your Store",
  "scored_at": 1753776000.0
}

approve → let the order go through. review → let it through but flag it for a human to double-check. block → don't process the payment.

Optional fields that make it smarter

None of these are required, but each one you add turns on an extra fraud-detection signal:

FieldWhat it unlocks
customer_idTracks repeat-cancellation behavior per customer over time
customer_nameShows a name (not just an ID) when you look up a customer's history in Settings
customer_ipDetects proxy/VPN/datacenter IPs and IP-vs-billing-country mismatches
customer_phoneFlags malformed/fake-looking phone numbers
card_binFirst 6–8 digits of the card only (never the full number) — flags card-country vs. billing-country mismatches
billing_countryISO 2-letter code (e.g. "TR", "DE") — required for the BIN and postal checks to work
postal_codeFlags postal codes that don't exist in the claimed country
billing_cityFlags a postal code that doesn't match the claimed city

Tell MeraFraud what actually happened

Optional but recommended: when an order is cancelled, fulfilled, or placed, report it so future scores for that same customer get smarter.

POST /api/orders/outcome
{
  "customer_id": "customer@example.com",
  "outcome": "fulfilled",
  "order_id": "1234",
  "customer_name": "Jane Doe",
  "billing_country": "TR",
  "billing_city": "Istanbul"
}

outcome is one of placed, cancelled, fulfilled.

Show customers you're protected

Add the MeraFraud trust badge to your checkout page footer — a small, honest signal that reduces cart-abandonment hesitation.

Protected by MeraFraud
<img src="merafraud-trust-badge.svg" alt="Protected by MeraFraud" width="240" height="64">

Full API reference

Every endpoint — scoring, custom rules, the fraud network, account management — in machine-readable form for your IDE, Postman, or codegen tool.

💡 Prefer a no-code setup instead? Check the Connect Your Store guides for WooCommerce, Shopify, and Shopier. Stuck on something? Email hello@merafraud.com.