Examples

Integration examples

Copy-paste examples for the most common integration patterns. All examples use Authorization: Bearer kc_live_YOUR_KEY.

Shopify

Block fraudulent orders (Shopify webhook)

Intercept orders before fulfilment. Check the customer email domain and cancel automatically if verdict is BLOCK.

// Shopify order webhook handler (Node.js)
app.post('/webhooks/orders/create', async (req, res) => {
  const order = req.body;
  const domain = order.email.split('@')[1];

  const { score, verdict } = await kc.check({ domain });

  if (verdict === 'BLOCK') {
    await shopify.cancelOrder(order.id, {
      reason: 'fraud',
      note: `Kairos score: ${score}`
    });
    return res.json({ cancelled: true, score });
  }

  res.json({ fulfilled: true, score });
});
Stripe

Pre-validate before Stripe charge

Run a check before calling stripe.paymentIntents.create. Avoid Stripe disputes from day one.

// Before creating a PaymentIntent
async function createPayment(email, amount) {
  const domain = email.split('@')[1];
  const { verdict, score } = await kc.check({ domain });

  if (verdict === 'BLOCK') {
    throw new Error(`Payment blocked (risk score: ${score})`);
  }

  return stripe.paymentIntents.create({
    amount,
    currency: 'eur',
    receipt_email: email,
    metadata: { kairos_score: score, kairos_verdict: verdict }
  });
}
Supabase

Guard Supabase auth signups

Use a Supabase Edge Function to reject fraudulent signups before they hit your database.

// supabase/functions/validate-signup/index.ts
import { serve } from 'https://deno.land/std/http/server.ts';

serve(async (req) => {
  const { email } = await req.json();
  const domain = email.split('@')[1];

  const res = await fetch('https://kairoscheck.net/api/check', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${Deno.env.get('KAIROS_KEY')}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ domain })
  });

  const { verdict } = await res.json();
  if (verdict === 'BLOCK') {
    return new Response(JSON.stringify({ error: 'Signup denied' }), {
      status: 400
    });
  }
  return new Response(JSON.stringify({ ok: true }));
});
Signup form

Validate email at form submission

Client-side check during signup. Show a warning before the user submits — no page reload.

// Vanilla JS — runs on form submit
document.getElementById('signup-form')
  .addEventListener('submit', async (e) => {
    e.preventDefault();
    const email = document.getElementById('email').value;

    const res = await fetch('/api/check-domain', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ domain: email.split('@')[1] })
    });
    const { verdict } = await res.json();

    if (verdict === 'BLOCK') {
      showError('This email address cannot be used.');
      return;
    }
    e.target.submit(); // proceed
  });
Cron

Nightly scan of your customer base

Run daily at 2am. Flag accounts that changed risk profile before they generate a chargeback.

// cron.js — schedule with node-cron or Railway cron
import cron from 'node-cron';
import { KairosCheck } from '@kairoscheck/sdk';

const kc = new KairosCheck({ apiKey: process.env.KAIROS_KEY });

cron.schedule('0 2 * * *', async () => {
  const customers = await db.getActiveCustomers();

  for (const c of customers) {
    const { score, verdict } = await kc.check({
      domain: c.email.split('@')[1]
    });

    if (verdict === 'BLOCK' && c.riskLevel !== 'high') {
      await db.setRiskLevel(c.id, 'high', score);
      await slack.alert(`⚠️ Customer ${c.id} flagged (score ${score})`);
    }
  }
});

Ready to integrate?

Get your API key and be in production in under 30 minutes.

Get API key — €29 →