Manage Rulesets
Use this page to create, update, list, and delete Spend Controls rulesets.
Create a ruleset
You can create a ruleset with our Create Ruleset API.
When creating a ruleset, each rule is based on a template_code. You provide:
template_code: which control logic to use;parameters: threshold/value list/time-window inputs for that template;violation_policy: usuallydecline(hard block) orreview(soft control).
The examples below show how each template category is configured.
Transaction amount templates
Use these templates to limit the value of a single transaction:
transaction_amount_limit: comparestransaction.amounttransaction_billing_limit: comparestransaction.billing_amount
Parameters:
limit_amountcurrency
Use transaction_billing_limit when you want consistent control in a single billing currency. transaction_amount_limit evaluates the transaction amount currency and may behave differently for cross-currency transactions.
- Transaction amount limit
- Transaction billing amount limit
{
"template_code": "transaction_amount_limit",
"description": "Limit each transaction to 250 USD",
"parameters": {
"limit_amount": 250.0,
"currency": "USD"
},
"violation_policy": "decline"
}
{
"template_code": "transaction_billing_limit",
"description": "Limit each transaction to 300 SGD",
"parameters": {
"limit_amount": 300.0,
"currency": "SGD"
},
"violation_policy": "decline"
}
Velocity templates (daily/weekly/monthly)
Use these templates to limit aggregate behavior over time:
account_billing_amount_limit: total billing amount by periodaccount_transaction_count_limit: total transaction count by period
Parameters:
limit_amount: required foraccount_billing_amount_limitcurrency: required foraccount_billing_amount_limitlimit_count: required foraccount_transaction_count_limitfrequency: can be set todaily,weeklyormonthly
- Account billing amount limit
- Account transaction count limit
{
"template_code": "account_billing_amount_limit",
"description": "Max 5,000 USD per day",
"parameters": {
"limit_amount": 5000.0,
"currency": "USD",
"frequency": "daily"
},
"violation_policy": "review"
}
{
"template_code": "account_transaction_count_limit",
"description": "Max 10 transactions per day",
"parameters": {
"limit_count": 10,
"frequency": "daily"
},
"violation_policy": "decline"
}
Currency control template
Use this template to control which transaction currencies are allowed or blocked:
currency_control: add a list of allowed or blocked currencies
Parameters (use one of the following):
allowed_currencies: list of allowed currency codes (ISO 4217). If provided, only these currencies are permittedblocked_currencies: list of blocked currency codes (ISO 4217). Transactions in these currencies are denied
- Currency allow List
- Currency block List
{
"template_code": "currency_control",
"description": "Only allow USD and EUR",
"parameters": {
"allowed_currencies": ["USD", "EUR"]
},
"violation_policy": "decline"
}
{
"template_code": "currency_control",
"description": "Reject all transactions in high-risk currencies",
"parameters": {
"blocked_currencies": ["LBP", "IRR", "VND", "LAK", "VES"]
},
"violation_policy": "decline"
}
Country control template
Use this template to control which merchant countries are allowed or blocked:
merchant_country_control: add a list of allowed or blocked merchant countries
Note that for online payments, the merchant's registered country will be used
Parameters (use one of the following):
allowed_countries: list of allowed country codes (ISO 3166-1 alpha-2). If provided, only these countries are permittedblocked_countries: list of blocked country codes (ISO 3166-1 alpha-2). Transactions in these countries are denied
- Country allow List
- Country block List
{
"template_code": "merchant_country_control",
"description": "Only allow merchants in Singapore and The Philippines",
"parameters": {
"allowed_countries": ["SG", "PH"]
},
"violation_policy": "decline"
}
{
"template_code": "merchant_country_control",
"description": "Reject all transactions from merchants in high-risk countries",
"parameters": {
"blocked_countries": ["KP", "IR", "MM", "CU", "SY", "RU"]
},
"violation_policy": "decline"
}
Merchant control templates
Use these templates to control where funds can be spent:
mcc_control: add a list of allowed or blocked merchant category codes (MCCs)mid_control: add a list of allowed or blocked specific merchant IDs (MIDs)
Parameters (use one of the following):
allowed_merchant_ids: list of allowed merchant IDs. If provided, only these merchant IDs are permittedblocked_merchant_ids: list of blocked merchant IDs. Transactions for these merchant IDs are deniedallowed_mcc_codes: list of allowed MCC codes (4-digit). If provided, only these MCCs are permittedblocked_mcc_codes: list of blocked MCC codes (4-digit). Transactions for these MCCs are denied
When blocking merchant IDs, keep in mind that one merchant ID may be used by multiple (online) merchants, and one merchant may also use multiple merchant IDs (for example, across branches or acquirers).
- MCC allow List
- MCC block List
- Merchant ID allow List
- Merchant ID block List
{
"template_code": "mcc_control",
"description": "Only allow Travel Agencies MCC",
"parameters": {
"allowed_mcc_codes": ["4722"]
},
"violation_policy": "decline"
}
{
"template_code": "mcc_control",
"description": "Block gambling MCC",
"parameters": {
"blocked_mcc_codes": ["7995"]
},
"violation_policy": "decline"
}
{
"template_code": "mid_control",
"description": "Only allow purchases at our franchises",
"parameters": {
"allowed_merchant_ids": ["100378498", "100378497", "100378496", "100378495"]
},
"violation_policy": "decline"
}
{
"template_code": "mid_control",
"description": "Block high-risk merchants",
"parameters": {
"blocked_merchant_ids": ["200303424", "200506426", "105814881", "201048878", "102274770"]
},
"violation_policy": "decline"
}
Time-window template
Use these templates to restrict transactions by day and time:
transaction_time_control: add a list of allowed or blocked times
Time windows are evaluated using the timezone configured in each rule.
Parameters:
allowed_windows: list of allowed time windows. If provided, transactions outside these windows are deniedblocked_windows: list of blocked time windows. Transactions within these windows are deniedtimezone: timezone for time evaluation (IANA timezone, for exampleAsia/Singapore)
A timezone is always required. One of allowed_windows or blocked_windows must be present and contain at least one time window. A time window contains:
from_time: in HH:MM format (24-hour)to_time: in HH:MM format (24-hour)weekdays: one or more values frommon,tue,wed,thu,fri,sat,sun
- Time-window allow List
- Time-window block List
{
"template_code": "transaction_time_control",
"description": "Only allow weekdays during lunch hours",
"parameters": {
"allowed_windows": [
{
"from_time": "11:00",
"to_time": "14:00",
"weekdays": ["mon", "tue", "wed", "thu", "fri"]
}
],
"timezone": "Asia/Singapore"
},
"violation_policy": "decline"
}
{
"template_code": "transaction_time_control",
"description": "Block overnight transactions",
"parameters": {
"blocked_windows": [
{
"from_time": "00:00",
"to_time": "06:00",
"weekdays": ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]
}
],
"timezone": "Asia/Singapore"
},
"violation_policy": "decline"
}
Example: full ruleset payload
{
"name": "standard-account-limits",
"description": "Default spending limits",
"is_active": true,
"is_default": true,
"rules": [
{
"template_code": "account_billing_amount_limit",
"parameters": {
"limit_amount": 1000.0,
"currency": "USD",
"frequency": "daily"
},
"violation_policy": "review"
},
{
"template_code": "currency_control",
"parameters": {
"allowed_currencies": ["USD", "EUR"]
},
"violation_policy": "decline"
}
]
}
Violation policy and authorization handling
Each rule must have a violation_policy set to either decline or review. If a rule is triggered, Open Fabric will act based on that policy:
- Decline the transaction: in this case, we will not send an authorization message to your system for approval, and we will decline the transaction directly. You will receive an authorization failed notification.
- Require transaction review: in this case, we will send the authorization message to your system for approval. The result of our rule evaluation is included in the
auth_policy_evaluation_resultfield, including which rules were violated. You can then approve or decline the transaction in your authorization response.
Custom rules
It is also possible to create a custom rule without using a template. You can do this by omitting template_code in the rule object and defining conditions instead.
The conditions object provides a flexible way to define custom rules using comparison operators, logical operators, and context variables available during payment authorization.
Comparison Operators:
eq(equals),ne(not equals)gt(greater than),gte(greater than or equal)lt(less than),lte(less than or equal)in(value in list),not_in(value not in list)matches(regex pattern match)contains(string/array contains)
Logical Operators:
and- All conditions must be trueor- At least one condition must be truenot- Negates a condition
Context Variables:
transaction.*- Transaction fields (amount, currency, billing_amount, billing_currency, merchant_mcc, merchant_id, merchant_country)account.*- Account fields (account_id, provision_id)time.*- Time-based fields (current_time, day_of_week)
See the example below for the condition expression syntax:
{
"description": "Block transactions above 500 USD outside of US, CA or GB",
"parameters": {},
"conditions": {
"operator": "and",
"expressions": [
{
"operator": "gt",
"left": "transaction.billing_amount",
"right": 500
},
{
"operator": "eq",
"left": "transaction.billing_currency",
"right": "USD"
},
{
"operator": "not_in",
"left": "transaction.merchant_country",
"right": ["US", "CA", "GB"]
}
]
},
"violation_policy": "decline"
}
Other operations
Our API Reference provides details and examples for:
- Use List Rulesets API to return all rulesets (without individual rules).
- Use Get Ruleset API to view the details of a specific ruleset, including all individual rules.
- Use Update Ruleset API to change the details of a ruleset; this can be used to add, update or remove rules within a ruleset, but also to change which ruleset is the default ruleset.
- Use Delete Ruleset API to delete a ruleset; this can only be done if this ruleset is not assigned to any account.