> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# FraudLabs Pro plugin

> Fraud detection and SMS verification with FraudLabs Pro - screen orders and users for fraud, retrieve screening results, submit order, payment, and user feedback, and run SMS OTP verification.

Use **FraudLabs Pro** through Corsair: one client, typed API calls, and incoming webhooks.

Create an API license key in the FraudLabs Pro Merchant Area under Account, Licenses. The free Micro plan includes 500 monthly order checks with no credit card required.

* **Plan tiers.** The Micro plan includes order screening and supports sandbox SMS verification. FraudLabs Pro documents `orders.getResult` as paid (a free Micro key could read results in our December 2026 test) and `users.*` as Medium or higher. The plugin handles error code `10061` as an unsupported plan.
* **Order items.** Pass `items` on `orders.screen` as an array of item objects (`sku`, `quantity`, `price`, plus optional `type`, `name`, `purchase_type`). The plugin serializes the array to the JSON string format that FraudLabs Pro v2 requires. Free Micro plans support up to 3 items per order.
* **SMS verification.** `verification.send` sends a real SMS message, deducts SMS credits, and cannot be undone. Include the `<otp>` placeholder in `mesg` (up to 140 characters, no URLs). Use phone number `+11` with OTP `123456` to test in sandbox mode without spending credits.
* **Retries and replay safety.** HTTP 429 responses retry up to three times, honoring `Retry-After` when present and falling back to exponential backoff. HTTP 5xx, timeout, and network errors replay only on read endpoints (`orders.getResult`, `users.getResult`, `verification.getResult`) and never replay POST writes or SMS sends.
* **Inbound webhooks.** FraudLabs Pro posts order status changes without a signature. For a self-hosted receiver, configure a random secret with `webhookSecret` or `keys.set_webhook_signature` and add it to the merchant callback URL as `fraudlabspro_token`. Keep the URL private and redact the query string from access logs. Parse the provider's form-encoded POST body before passing it and the URL query to `processWebhook`. For multiple tenants, store distinct callback secrets and include `tenantId` in each callback URL.

**What you get:**

* 9 typed API operations
* 1 incoming webhook event types

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/fraudlabspro better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/fraudlabspro better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/fraudlabspro better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/fraudlabspro better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { fraudlabspro } from '@corsair-dev/fraudlabspro';

export const corsair = createCorsair({
	plugins: [
		fraudlabspro(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> Store the FraudLabs Pro API key before the first call: `pnpm corsair setup --plugin=fraudlabspro --tenant=acme api_key=<your-key>` (leave out `--tenant` without `multiTenancy`), or pass it as `key` in the plugin options. With Hub, each tenant enters their own key on the connect page. See [API key auth](https://docs.corsair.dev/concepts/api-key).
>
> ```ts theme={null}
> fraudlabspro()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'fraudlabspro',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**Retrieve an order screening result**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.fraudlabspro.api.orders.getResult({ id: '20261203-BCBQD4' });
```

**Screen an order for payment fraud**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.fraudlabspro.api.orders.screen({
	ip: '192.0.2.10',
	user_order_id: 'ORD-1001',
	amount: 79.89,
	quantity: 1,
	currency: 'USD',
	email: 'buyer@example.com',
});
```

See the full list on the [API](https://docs.corsair.dev/plugins/fraudlabspro/api.md) page.

## Webhooks

Fires when FraudLabs Pro changes an order decision to approve or reject.

```ts theme={null}
fraudlabspro({
    webhookHooks: {
        orders: {
            statusChanged: {
                after: async (ctx, result) => {
                    console.log('Order decision:', result.data?.fraudlabspro_status);
                }
            },
        },
    },
})
```

Mount your framework handler once (see [Frameworks](https://docs.corsair.dev/frameworks/next.md)), then point the provider at that URL. Full event list: [Webhooks](https://docs.corsair.dev/plugins/fraudlabspro/webhooks.md). Concepts: [Webhooks](https://docs.corsair.dev/concepts/webhooks.md), [Hooks](https://docs.corsair.dev/concepts/hooks.md).

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/fraudlabspro/api.md)
>
> Every `fraudlabspro.api.*` operation with input and output types.

> [card] [Webhooks](https://docs.corsair.dev/plugins/fraudlabspro/webhooks.md)
>
> Event paths, payloads, and `webhookHooks` examples.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.