← All examples

Transaction Limits

Compliance

Clear a payment when it stays under the reporting threshold, avoids blocked corridors, and keeps the day's cumulative total in range.

Policy rule

A **transaction** clears limit_checks
  if the __amount__ of the **transaction** is less than 10000
  and the __destination_country__ of the **transaction** is not in ["IR", "KP", "SY"]
  and the __cumulative_amount_today__ of the **account** + the __amount__ of the **transaction** is less than 50000.

Run it

Change the policy or the input and evaluate it here — no account needed.

Policy

Input

{ "transaction": { "amount": 2500, "destination_country": "GB" }, "account": { "cumulative_amount_today": 8000 } }
Try:

Input schema

{
"properties": {
"transaction": {
"properties": {
"amount": {
"type": "number"
},
"destination_country": {
"type": "string"
}
},
"required": [
"amount",
"destination_country"
],
"type": "object"
},
"account": {
"properties": {
"cumulative_amount_today": {
"type": "number"
}
},
"required": [
"cumulative_amount_today"
],
"type": "object"
}
},
"required": [
"transaction",
"account"
],
"title": "Transaction Limit Model",
"type": "object"
}

Test cases

Ordinary payment

Expect pass
{
"transaction": {
"amount": 2500,
"destination_country": "GB"
},
"account": {
"cumulative_amount_today": 8000
}
}

Over reporting threshold

Expect fail
{
"transaction": {
"amount": 12000,
"destination_country": "GB"
},
"account": {
"cumulative_amount_today": 8000
}
}

Integration

Execute this policy from your app using one of the official SDKs.

import { ExecutionClient } from "@policies2/sdk";

const client = new ExecutionClient({
	apiKey: process.env.POLICY_API_KEY!,
	transport: { kind: "rest", baseUrl: "https://api.policy2.net" },
});

const result = await client.executePolicy({
	id: "your-policy-id", // replace with your published policy ID
	reference: "base",
	data: {
		"transaction": {
			"amount": 2500,
			"destination_country": "GB"
		},
		"account": {
			"cumulative_amount_today": 8000
		}
	},
});

if (result.result) {
	console.log("policy matched");
} else {
	console.log("policy did not match");
}

Ready to version this policy and wire it into a flow?

Open in editor