---
title: "Examples of transaction rules"
description: "See examples of use cases and how they are defined as transaction rules."
url: "https://docs.adyen.com/issuing/authorisation/transaction-rules/examples"
source_url: "https://docs.adyen.com/issuing/authorisation/transaction-rules/examples.md"
canonical: "https://docs.adyen.com/issuing/authorisation/transaction-rules/examples"
last_modified: "2022-04-04T15:21:00+02:00"
language: "en"
---

# Examples of transaction rules

See examples of use cases and how they are defined as transaction rules.

[View source](/issuing/authorisation/transaction-rules/examples.md)

On this page we show use cases and examples of how to create the corresponding transaction rules.

## Set processing types

Decline payments based on from which channel it is processed.

### Example

Only allow payments from a point-of-sale terminal.

**Only allow point-of-sale payments**

```json
{
  "interval": {
    "type": "perTransaction"
  },
  "ruleRestrictions": {
    "processingTypes" : {
      "operation": "noneMatch",
      "value": ["pos"]
    }
  },
  "type" : "blockList",
  "outcomeType": "hardBlock"
}
```

When an ecommerce payment is processed, the transaction meets the condition and is therefore declined.

If you want to do the opposite, which is to allow all transactions except for point-of-sale, change the `operation` to **anyMatch**. When a point-of-sale payment is processed, the transaction meets the condition and is therefore declined.

**Block point-of-sale payments**

```json
{
  "interval": {
    "type": "perTransaction"
  },
  "ruleRestrictions": {
    "processingTypes" : {
      "operation": "anyMatch",
      "value": ["pos"]
    }
  },
  "type" : "blockList",
  "outcomeType": "hardBlock"
}
```

## Set country and merchant category codes (MCC)

Decline transactions based on specific combinations of the country/region and merchant category codes (MCCs).

### Example

Decline payments in the US except for grocery stores (5411), restaurants (5812), and fast food (5814) purchases.

**Only allow transactions from specific MCCs in the US**

```json
{
  "interval": {
    "type": "perTransaction"
  },
  "ruleRestrictions": {
    "countries" : {
      "operation": "anyMatch",
      "value": ["US"]
    },
    "mccs" : {
      "operation": "noneMatch",
      "value": ["5411", "5812", "5814"]
    }
  },
  "type" : "blockList",
  "outcomeType": "hardBlock"
}
```

## Set a total amount or number of transactions

Decline transactions when the amount or number of transactions exceeds a certain value.

### Example

Decline transactions when the amount exceeds USD 100 per transaction.

**Set a limit of USD 100 per payment**

```json
{
  "interval": {
    "type": "perTransaction"
  },
  "ruleRestrictions": {
    "totalAmount" : {
      "operation": "greaterThan",
      "value": {
        "value": 10000,
        "currency": "USD"
      }
    }
  },
  "type" : "velocity",
  "outcomeType": "hardBlock"
}
```

Here is an example of setting a limit of up to 50 transactions per month, with the counter resetting on the 15th of every month.

**Up to 50 transactions per month**

```json
{
  "interval": {
    "type": "rolling",
    "dayOfMonth": 15,
    "duration" : {
        "unit" : "months",
        "value" : 1
    }
  },
  "ruleRestrictions": {
    "matchingTransactions" : {
      "operation": "greaterThan",
      "value": 50
    }
  },
  "type" : "velocity",
  "outcomeType": "hardBlock"
}
```

## Combine amount and number of transactions with the MCC and country

Decline transactions when the amount or number of transactions exceeds a certain value over a time period for the specific countries/regions or MCCs.

### Example

Decline gas or fuel refill-related payments in the US and Canada if they exceed 10 transactions per month or if the total amount exceeds USD 500.

To implement this use case, you need to create two rules: one for the maximum amount and another one for the maximum number of payments.

**Up to USD 500 per month for gas station purchases in US and CA**

```json
{
  "interval": {
    "type": "rolling",
    "dayOfMonth": 1,
    "duration" : {
      "unit" : "months",
      "value" : 1
    }
  },
  "ruleRestrictions": {
    "countries" : {
      "operation": "anyMatch",
      "value": ["US", "CA"]
    },
    "mccs": {
      "operation": "anyMatch",
      "value": ["5541","5542","7538"]
    },
    "totalAmount" : {
      "operation": "greaterThan",
      "value": {
        "value": 50000,
        "currency": "USD"
      }
    }
  },
  "type" : "velocity",
  "outcomeType": "hardBlock"
}
```

**Up to 10 transactions per month for gas station purchases in US and CA**

```json

{
 "interval": {
   "type": "rolling",
   "dayOfMonth": 1,
   "duration" : {
     "unit" : "months",
     "value" : 1
   }
 },
 "ruleRestrictions": {
   "countries" : {
     "operation": "anyMatch",
     "value": ["US", "CA"]
   },
   "mccs": {
     "operation": "anyMatch",
     "value": ["5541","5542","7538"]
   },
   "matchingTransactions" : {
     "operation": "greaterThan",
     "value": 10
   }
 },
 "type" : "velocity",
 "outcomeType": "hardBlock"
}
```

When a payment meets the conditions of either of the two rules, the payment is declined.

## Set limits for international transactions

Decline international transactions when the amount exceeds the specified limit.

### Example

Block international transactions when the total amount exceeds EUR 50 per day for the payment instrument.

**Up to EUR 50 for international transactions per day**

```json
{
   "interval": {
    "type": "rolling",
    "timeZone": "Europe/Amsterdam",
    "timeOfDay": "00:00:00",
    "duration": {
        "unit": "days",
        "value": 1
    }
  },
  "entityKey": {
    "entityType": "PaymentInstrument",
    "entityReference": "PI322LZ2233WMJ5F6SDBS45FD"
  },
  "ruleRestrictions": {
    "totalAmount": {
      "operation": "greaterThan",
      "value": {
        "currency": "EUR",
        "value": 5000
      }
    },
    "internationalTransaction": {
      "operation": "equals",
      "value": true
    }
  },
  "type": "velocity",
  "outcomeType": "hardBlock"
}
```

## Set limits for a sliding time window

Decline transactions when the amount exceeds a certain value over a specified time window.

### Example

Decline a transaction if the total accumulated amount for the whole balance platform when the total amount exceeds EUR 2000 in the last 12 hours.

**Up to EUR 2000 in the last 12 hours**

```json
{
  "entityKey": {
    "entityReference": "YOUR_BALANCE_PLATFORM",
    "entityType": "BalancePlatform"
  },
  "aggregationLevel": "balancePlatform",
  "interval": {
    "type": "sliding",
     "duration":
     {
         "value": "12",
         "unit": "hours"
      }
  },
  "ruleRestrictions": {
    "totalAmount": {
      "operation": "greaterThan",
      "value": {
        "value": 200000,
        "currency": "EUR"
      }
    }
  },
  "type": "velocity",
  "outcomeType": "hardBlock"
}
```

## Set a daily limit for a balance account

Decline transactions when the total amount for all payment instruments in a balance account exceeds a specified limit.

### Example

Decline a transaction if the total accumulated amount for a balance account exceeds EUR 1000 within a day. Reset the counter daily at 00:00 Europe/Amsterdam time.

**Up to EUR 1000 per day for a balance account**

```json
{
  "type": "velocity",
  "interval": {
    "type": "rolling",
    "timeZone": "Europe/Amsterdam",
    "timeOfDay": "00:00:00",
    "duration":
    {
        "unit": "days",
        "value": 1
    }
  },
  "entityKey":
  {
    "entityType": "BalanceAccount",
    "entityReference": "BA3229G223222B59QDFRVGR3X"
  },
  "aggregationLevel": "balanceAccount",
  "ruleRestrictions":
    {
      "totalAmount":{
        "operation": "greaterThan",
        "value": {
          "value": 100000,
          "currency": "EUR"
        }
    },
 "outcomeType": "hardBlock"
}
```

## Set a weekly limit for ATM withdrawals

Decline ATM withdrawals when the total amount withdrawn from ATMs exceed the specified limit.

### Example

Decline an ATM withdrawal if the total amount withdrawn from an ATM exceeds EUR 2000 every two weeks for the whole balance platform. Reset the counter every Monday at 00:00 Europe/Amsterdam time.

**Up to EUR 2000 every two weeks for ATM withdrawals**

```json
{
  "entityKey": {
    "entityReference": "YOUR_BALANCE_PLATFORM",
    "entityType": "BalancePlatform"
  },
  "interval": {
    "type": "rolling",
    "timeZone": "Europe/Amsterdam",
    "dayOfWeek": "Monday",
    "timeOfDay": "00:00:00",
    "duration": {
        "unit": "weeks",
        "value": 2
    }
  },
  "ruleRestrictions": {
    "processingTypes": {
      "operation": "anyMatch",
      "value": ["atmWithdraw"]
    },
    "totalAmount": {
      "operation": "greaterThan",
      "value": {
        "value": 200000,
        "currency": "EUR"
      }
    }
  },
  "type": "velocity"
}
```

## Increase score of a payment instrument

Increase the score of a payment instrument when a payment meets the conditions.

### Example

Increase the score by 30 when a transaction happens between 11AM to 6PM Europe/Amsterdam time.

**Increase score by 30 for transactions between 11AM to 6PM**

```json
{
  "interval": {
    "type": "perTransaction"
  },
  "entityKey": {
    "entityType": "PaymentInstrument",
    "entityReference": "PI322VJ223222B5F8CRBP5MH3"
  },
  "ruleRestrictions": {
    "timeOfDay": {
      "operation": "equals",
       "value": {
         "startTime": "10:00:00+01:00",
         "endTime": "17:00:00+01:00"
       }
    }
  },
  "type": "blockList",
  "outcomeType": "scoreBased",
  "score": 30
}
```

## Decrease score of a payment instrument

Decrease the score of a payment instrument when a payment meets the conditions.

### Example

Decrease the score by 25 when a payment is made through a token.

**Decrease score by 25 for token transactions**

```json
{
  "interval": {
    "type": "perTransaction"
  },
  "entityKey": {
    "entityType": "PaymentInstrument",
    "entityReference": "PI322LZ2236D5J5F5SD5R2TRB"
  },
  "ruleRestrictions": {
    "processingTypes": {
      "operation": "anyMatch",
      "value": ["token"]
    }
  },
  "type": "blockList",
  "outcomeType": "scoreBased",
  "score": -25
}
```
