--- title: "Create and manage rules" description: "Use transaction rules to automatically approve or decline a transaction." url: "https://docs.adyen.com/issuing/authorisation/transaction-rules/create-and-manage" source_url: "https://docs.adyen.com/issuing/authorisation/transaction-rules/create-and-manage.md" canonical: "https://docs.adyen.com/issuing/authorisation/transaction-rules/create-and-manage" last_modified: "2025-01-07T15:06:00+01:00" language: "en" --- # Create and manage rules Use transaction rules to automatically approve or decline a transaction. [View source](/issuing/authorisation/transaction-rules/create-and-manage.md) After you determine your business' requirements for evaluating and declining suspicious payout requests, you can use the [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/latest/overview) to create and manage transaction rules that automatically evaluate every external payout. This page explains how to: * [Create a transaction rule](#create-a-transaction-rule) * [View existing transaction rules](#view-transaction-rules) * [Override existing transaction rules](#override-an-existing-transaction-rule) * [Update a transaction rule](#update-a-transaction-rule) * [Deactivate or activate a transaction rule](#deactivate-or-activate-a-transaction-rule) ## Requirements | Requirement | Description | | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **Integration type** | Adyen Issuing | | **[API credential roles](/development-resources/api-credentials/roles/)** | Make sure that you have access to the [Configuration API](https://docs.adyen.com/api-explorer/balanceplatform/latest/overview) with following role:- **Bank Manage TransactionRules role** | | **[Webhooks](/development-resources/webhooks)** | Subscribe to the following webhook(s):- [**Transfer webhooks**](/payouts/payout-service/pay-out-to-bank-accounts/payout-webhooks/) - [**Transaction webhooks**](/payouts/payout-service/transfer-transactions/transaction-webhooks/) | | **Setup steps** | Before you begin:- Make sure you are familiar with [how transaction rules work](/issuing/transaction-rules) | ## Create a transaction rule When you have defined your business logic and requirements, turn your requirements into a transaction rule. You can do this by using your [Customer Area](https://ca-test.adyen.com/) or by making an API request. The following tabs explain both procedures. ### Tab: Customer Area To create a transaction rule in your [Customer Area](https://ca-test.adyen.com/): 1. Go to **Financial products** > **Transaction rules**. 2. Select **+ Create new rule**. 3. [Add the required rule details](#add-details). 4. [Set the rule conditions](#set-conditions). 5. [Review and test your rule](#test-rule). ### Add details Add the following rule details: * **Entity type:** The type of [entity to which you want to apply the rule](/issuing/authorisation/transaction-rules/#entity). * **Entity key:** The ID of the selected entity. * **Aggregation level:** The [level at which the data is accumulated](/issuing/authorisation/transaction-rules#accumulate-data) when selecting rule types that involve counting a number of transactions within a time interval. * **Rule type:** Specify when the [outcome of the rule](/issuing/authorisation/transaction-rules#outcome) applies. In the Customer Area, you can use one of the following rule types: * **Per transaction:** The outcome applies to every transaction. * **Fixed time interval:** You specify a time interval. During the time interval, we aggregate any transaction data that you specify. The outcome applies when, cumulatively, all transactions that occur within the time interval surpass a specified limit. The aggregation is reset when a new interval begins.\ For example: you can specify that a cardholder cannot spend more than EUR 200 in a day, which starts daily at 9 AM. * **Moving time interval:** You specify the duration of a time interval. When a cardholder attempts a payment, we aggregate all transaction data before this payment attempt, for the duration that you specified. The outcome applies when, cumulatively, the transactions surpass a specified limit.\ For example: you can specify that a cardholder cannot spend more than EUR 200 in six hours. If the cardholder attempts a payment at 7 PM, we check that between 1 PM and 7 PM the cardholder hasn't spent more than EUR 200. * **Maximum usage:** We aggregate transaction data during the entire lifetime of a card. After the amount of transactions surpass a specified limit, the card is deactivated. * **Description:** Describe what the rule does so you identify it later.\ For example: Allow only point-of-sale transactions. * **Reference:** An internal identifier that helps you track the rule later.\ For example: RULE\_1234. ### Set conditions To set a condition, select: 1. A parameter. For example: **Total amount**, **Countries**, **Day of week**. 2. An operator. For example: **equals**, **greater than**, **is in**. 3. A value. For example: **100**, **Netherlands**, **Monday**. You can have up to five conditions per rule. If any of the specified conditions is met, Adyen applies the [rule outcome](/issuing/authorisation/transaction-rules#outcome) to the transaction. ### Test rule In the **Review** page, you can select **Test rule**. This enables you test the rule with previous transactions in your platform. ### Tab: API 1. Make a POST [/transactionRules](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/transactionRules) request, specifying the following parameters: | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [aggregationLevel](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-aggregationLevel) | | The [level at which the data is accumulated](/issuing/authorisation/transaction-rules#accumulate-data) when selecting rule types that involve counting a number of transactions within a time interval. Default: **paymentInstrument**. | | [description](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-description) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | Your description for the rule. Maximum length: 300 characters. This description is displayed in the [Customer Area](https://ca-test.adyen.com/). | | [entityKey](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-entityKey) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | An object that contains the ID and [type](/issuing/authorisation/transaction-rules#entity) of resource to which you want to apply the rule. | | [interval](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-interval) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The time period or duration when you want to apply the rule. | | [outcomeType](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-outcomeType) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The outcome that is applied if the transfer meets the conditions of the rule. Possible values:- **hardBlock**: the transaction is declined. - **scoreBased**: the transaction is assigned the `score` you specified. Adyen calculates the total score and if it exceeds 100, the transaction is declined. - **enforceSCA**: your user is prompted to verify their identity using Strong Customer Authentication (SCA). If they fail to do so, the transaction is declined. | | [reference](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-reference) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | Your reference for the rule. Maximum length: 150 characters. This description is displayed in the [Customer Area](https://ca-test.adyen.com/). | | [requestType](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-requestType) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The type of transfer to which you want to apply the rule. Set this to **authorization**, **authentication**, or **tokenization**. | | [type](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-type) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | The type of rule that determines what data to analyze. Possible values:- **blockList**: decline a transfer if it meets specific conditions. - **maxUsage**: add the total amount from each transaction or count the number of transactions for the lifetime of a payment instrument, and then decline a transaction when the specified limits are met. - **velocity**: decline a transaction if a set amount of accumulated previous transactions have met the specified conditions. Adyen only considers previous transactions within a specified time interval and aggregation level. | | [ruleRestrictions](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions) | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto) | An object that contains all the conditions for a rule. For example: `countries`, `mcc`, or `timeOfDay`. For each condition, you must specify the `operation` and the `value` that we must check. See how to [combine](#allowed-combinations) rule restrictions with with specific types and intervals. | | [startDate](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-startDate) | | Specifies a date and time in the future when the rule must be evaluated. For example, **2022-02-25T07:00:00+01:00**. When you specify a start date, the rule is created with a `status` set to **active**. | | [endDate](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-endDate) | | Specifies a date and time in the future when the rule evaluation must stop. For example, **2022-12-18T10:15:30+01:00**. If not provided, the rule is evaluated until the `status` is set to **inactive**. | | [status](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-status) | | Set to **active** if you want to start evaluating the rule. When you set the status to active, we automatically set the `startDate` to the current time. | For example, consider the following rule requirements: * Only allow payments from the Netherlands. * Apply the rule to `paymentInstrumentId` **PI00000000000000000000001**. * Apply the rule starting from 2022-03-20 at 00:00 CET. Here is an example of how to create a transaction rule for the requirements above. **Create transaction rule** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "description":"{hint:Human-readable rule description}Only allow NL transactions{/hint}", "entityKey": { "entityReference": "PI00000000000000000000001", "entityType": "PaymentInstrument" }, "interval": { "type": "perTransaction" }, "reference":"{hint:Your unique identifier for this resource}myRule12345{/hint}", "ruleRestrictions": { "countries" : { "operation": "noneMatch", "value": ["NL"] } }, "startDate": "2022-03-20T00:00:00+01:00", "type" : "blockList" }' ``` #### Java ```java // Adyen Java API Library v25.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.balancePlatform.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.balancePlatform.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) CountriesRestriction countriesRestriction = new CountriesRestriction() .operation("noneMatch") .value(Arrays.asList("NL")); TransactionRuleEntityKey transactionRuleEntityKey = new TransactionRuleEntityKey() .entityReference("PI00000000000000000000001") .entityType("PaymentInstrument"); TransactionRuleInterval transactionRuleInterval = new TransactionRuleInterval() .type(TransactionRuleInterval.TypeEnum.PERTRANSACTION); TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions() .countries(countriesRestriction); TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo() .reference("myRule12345") .entityKey(transactionRuleEntityKey) .description("Only allow NL transactions") .interval(transactionRuleInterval) .ruleRestrictions(transactionRuleRestrictions) .type(TransactionRuleInfo.TypeEnum.BLOCKLIST) .startDate("2022-03-20T00:00:00+01:00"); // Make the API call TransactionRulesApi service = new TransactionRulesApi(client); TransactionRule response = service.createTransactionRule(transactionRuleInfo, null); ``` #### PHP ```php // Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\BalancePlatform\TransactionRuleEntityKey; use Adyen\Model\BalancePlatform\TransactionRuleInterval; use Adyen\Model\BalancePlatform\TransactionRuleRestrictions; use Adyen\Model\BalancePlatform\CountriesRestriction; use Adyen\Model\BalancePlatform\TransactionRuleInfo; use Adyen\Service\BalancePlatform\TransactionRulesApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) $countriesRestriction = new CountriesRestriction(); $countriesRestriction ->setOperation("noneMatch") ->setValue(array("NL")); $transactionRuleEntityKey = new TransactionRuleEntityKey(); $transactionRuleEntityKey ->setEntityReference("PI00000000000000000000001") ->setEntityType("PaymentInstrument"); $transactionRuleInterval = new TransactionRuleInterval(); $transactionRuleInterval ->setType("perTransaction"); $transactionRuleRestrictions = new TransactionRuleRestrictions(); $transactionRuleRestrictions ->setCountries($countriesRestriction); $transactionRuleInfo = new TransactionRuleInfo(); $transactionRuleInfo ->setReference("myRule12345") ->setEntityKey($transactionRuleEntityKey) ->setDescription("Only allow NL transactions") ->setInterval($transactionRuleInterval) ->setRuleRestrictions($transactionRuleRestrictions) ->setType("blockList") ->setStartDate("2022-03-20T00:00:00+01:00"); // Make the API call $service = new TransactionRulesApi($client); $response = $service->createTransactionRule($transactionRuleInfo); ``` #### C\# ```cs // Adyen .net API Library v14.4.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.BalancePlatform; using Adyen.Service.BalancePlatform; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) CountriesRestriction countriesRestriction = new CountriesRestriction { Operation = "noneMatch", Value = { "NL" } }; TransactionRuleEntityKey transactionRuleEntityKey = new TransactionRuleEntityKey { EntityReference = "PI00000000000000000000001", EntityType = "PaymentInstrument" }; TransactionRuleInterval transactionRuleInterval = new TransactionRuleInterval { Type = TransactionRuleInterval.TypeEnum.PerTransaction }; TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions { Countries = countriesRestriction }; TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo { Reference = "myRule12345", EntityKey = transactionRuleEntityKey, Description = "Only allow NL transactions", Interval = transactionRuleInterval, RuleRestrictions = transactionRuleRestrictions, Type = TransactionRuleInfo.TypeEnum.BlockList, StartDate = "2022-03-20T00:00:00+01:00" }; // Make the API call var service = new TransactionRulesService(client); var response = service.CreateTransactionRule(transactionRuleInfo); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use const { Client, BalancePlatformAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const transactionRuleInfo = { description: "Only allow NL transactions", entityKey: { entityReference: "PI00000000000000000000001", entityType: "PaymentInstrument" }, interval: { type: "perTransaction" }, reference: "myRule12345", ruleRestrictions: { countries: { operation: "noneMatch", value: [ "NL" ] } }, startDate: new Date("2022-03-20T00:00:00+01:00"), type: "blockList" } // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.createTransactionRule(transactionRuleInfo); ``` #### Go ```go // Adyen Go API Library v9.3.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/balancePlatform" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) countriesRestriction := balancePlatform.CountriesRestriction{ Operation: "noneMatch", Value: []string{ "NL", }, } transactionRuleEntityKey := balancePlatform.TransactionRuleEntityKey{ EntityReference: common.PtrString("PI00000000000000000000001"), EntityType: common.PtrString("PaymentInstrument"), } transactionRuleInterval := balancePlatform.TransactionRuleInterval{ Type: "perTransaction", } transactionRuleRestrictions := balancePlatform.TransactionRuleRestrictions{ Countries: &countriesRestriction, } transactionRuleInfo := balancePlatform.TransactionRuleInfo{ Reference: "myRule12345", EntityKey: transactionRuleEntityKey, Description: "Only allow NL transactions", Interval: transactionRuleInterval, RuleRestrictions: transactionRuleRestrictions, Type: "blockList", StartDate: common.PtrString("2022-03-20T00:00:00+01:00"), } // Make the API call service := client.BalancePlatform() req := service.TransactionRulesApi.CreateTransactionRuleInput().TransactionRuleInfo(transactionRuleInfo) res, httpRes, err := service.TransactionRulesApi.CreateTransactionRule(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "description": "Only allow NL transactions", "entityKey": { "entityReference": "PI00000000000000000000001", "entityType": "PaymentInstrument" }, "interval": { "type": "perTransaction" }, "reference": "myRule12345", "ruleRestrictions": { "countries": { "operation": "noneMatch", "value": [ "NL" ] } }, "startDate": "2022-03-20T00:00:00+01:00", "type": "blockList" } # Make the API call result = adyen.balancePlatform.transaction_rules_api.create_transaction_rule(request=json_request) ``` #### Ruby ```rb # Adyen Ruby API Library v9.3.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :description => 'Only allow NL transactions', :entityKey => { :entityReference => 'PI00000000000000000000001', :entityType => 'PaymentInstrument' }, :interval => { :type => 'perTransaction' }, :reference => 'myRule12345', :ruleRestrictions => { :countries => { :operation => 'noneMatch', :value => [ 'NL' ] } }, :startDate => '2022-03-20T00:00:00+01:00', :type => 'blockList' } # Make the API call result = adyen.balancePlatform.transaction_rules_api.create_transaction_rule(request_body) ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, BalancePlatformAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const countriesRestriction: Types.balancePlatform.CountriesRestriction = { operation: "noneMatch", value: ["NL"] }; const transactionRuleEntityKey: Types.balancePlatform.TransactionRuleEntityKey = { entityReference: "PI00000000000000000000001", entityType: "PaymentInstrument" }; const transactionRuleInterval: Types.balancePlatform.TransactionRuleInterval = { type: Types.balancePlatform.TransactionRuleInterval.TypeEnum.PerTransaction }; const transactionRuleRestrictions: Types.balancePlatform.TransactionRuleRestrictions = { countries: countriesRestriction }; const transactionRuleInfo: Types.balancePlatform.TransactionRuleInfo = { reference: "myRule12345", entityKey: transactionRuleEntityKey, description: "Only allow NL transactions", interval: transactionRuleInterval, ruleRestrictions: transactionRuleRestrictions, type: Types.balancePlatform.TransactionRuleInfo.TypeEnum.BlockList, startDate: "2022-03-20T00:00:00+01:00" }; // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.createTransactionRule(transactionRuleInfo); ``` 2. Note the response, which contains the new **transactionRule** resource, identified by its unique `id`. The transaction rule is applied on the specified `startDate` for all payments made with payment instrument **PI00000000000000000000001**. If the location where the transaction is processed does not match any of the values in `ruleRestrictions.countries.value` (in this case, NL), then the transaction is blocked. The following code sample shows the response data you receive after creating a transaction rule. **Response** ```json { "description": "Only allow NL transactions", "entityKey": { "entityReference": "PI00000000000000000000001", "entityType": "PaymentInstrument" }, "interval": { "type": "perTransaction" }, "outcomeType": "hardBlock", "reference": "myRule12345", "ruleRestrictions": { "countries": { "operation": "noneMatch", "value": [ "NL" ] } }, "startDate": "2022-03-20T00:00:00+01:00", "status": "active", "type": "blockList", "id": "TR00000000000000000000001" } ``` ### Allowed combinations When creating a transaction rule, you must use a valid combination of rule restrictions, rule types, operations, and intervals. The following table shows a list of valid combinations. To learn about the specific rule restriction, select the link to see the objects on API Explorer. | Rule restrictions | Rule type | Operation | Interval type | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------ | | [activeNetworkTokens](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions-activeNetworkTokens) | blockList, velocity | equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan | perTransaction, daily, weekly, monthly, rolling, sliding | | [brandVariants](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/transactionRules__reqParam_ruleRestrictions-brandVariants) | blockList, maxUsage, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding | | [countries](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/transactionRules__reqParam_ruleRestrictions-countries) | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding | | [differentCurrencies](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions-differentCurrencies) | blockList, velocity | equals, notEquals | perTransaction, daily, weekly, monthly, rolling, sliding | | [entryModes](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/transactionRules__reqParam_ruleRestrictions-entryModes) | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding | | [internationalTransaction](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/transactionRules__reqParam_ruleRestrictions-internationalTransaction) | blockList, velocity | equals, notEquals | perTransaction, daily, weekly, monthly, rolling, sliding | | [matchingTransactions](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/transactionRules__reqParam_ruleRestrictions-matchingTransactions) | maxUsage, velocity | equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan | daily, weekly, monthly, lifetime, rolling, sliding | | [mccs](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions-mccs) | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding | | [merchants](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions-merchants) | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding | | [processingTypes](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/transactionRules__reqParam_ruleRestrictions-processingTypes) | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding | | [timeOfDay](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions-timeOfDay) | blockList, velocity | equals, notEquals | perTransaction | | [totalAmount](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions-totalAmount) | maxUsage, velocity | equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan | perTransaction, daily, weekly, monthly, lifetime, rolling, sliding | ## View transaction rules You can see the transaction rules that you created on the [Customer Area](https://ca-test.adyen.com/) or by making API requests. ### Tab: Customer Area To view the transaction rules: 1. Log in to your [Customer Area](https://ca-test.adyen.com/). 2. Go to **Financial products** > **Transaction rules**. 3. Select a specific rule ID to view the transaction rule details. To view which transaction rules apply to a payment instrument: 1. Go to **Financial products** > **Payment instruments**. 2. Select a specific payment instrument ID. 3. Go to the **Related transaction rules** section. ### Tab: API request To view the transaction rules you have created, use the following API requests: | Purpose | Endpoint | Path parameter | | | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | - | | Get the details of a specific rule | GET [/transactionRules/{id}](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/transactionRules/{transactionRuleId}) | Specify the `id` of the transaction rule in the path. | | | Get a list of all transaction rules configured on a balance account | GET  [/balanceAccounts/{id}/transactionRules](https://docs.adyen.com/api-explorer/balanceplatform/2/get/balanceAccounts/\(id\)/transactionRules) | Specify the `id` of the balance account in the path. | | | Get a list of all transaction rules configured for an account holder | GET  [/accountHolders/{id}/transactionRules](https://docs.adyen.com/api-explorer/balanceplatform/2/get/accountHolders/\(id\)/transactionRules) | Specify the `id` of the account holder in the path. | | | Get a list of all transaction rules configured on your balance platform | GET  [/balancePlatforms/{id}/transactionRules](https://docs.adyen.com/api-explorer/balanceplatform/2/get/balancePlatforms/\(id\)/transactionRules) | Specify the `id` of the balance platform in the path. | | | Get a list of all transaction rules configured for a payment instrument | GET [/paymentInstruments/{id}/transactionRules](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/paymentInstruments/{id}/transactionRules) | Specify the `id` of the payment instrument in the path. | | | Get a list of all transaction rules configured for a group of payment instruments | GET [/paymentInstrumentGroups/{id}/transactionRules](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/paymentInstrumentGroups/{id}/transactionRules) | Specify the `id` of the payment instrument group in the path. | | ## Override an existing transaction rule When you have multiple transaction rules, Adyen applies these rules based on the existing [rule hierarchy](/issuing/transaction-rules#hierarchy-for-transaction-rules). To override this hierarchy for a specific resource or entity, you can create a new rule for that entity that overrides an existing rule with a higher hierarchical ranking. To create a transaction rule that overrides an existing rule for a specific entity: 1. Make a POST [/transactionRules](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules) request. In addition to other parameters required to [create a rule](#create-a-transaction-rule), specify the following: | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | | [entityKey](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-entityKey) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object that contains the ID and [type](/issuing/authorisation/transaction-rules#entity) of entity for which you want to override a rule. | | [ruleRestrictions](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The new rule restrictions you want to apply to the entity. | | `overridesRule` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The ID of the transaction rule you want to override for the entity. | For example, you created a transaction rule to limit the number of transactions to a maximum of 50 transactions per month for all cards in your balance platform. Now, let's override this rule to allow a higher limit of 100 transactions per month for just one card. **Override a transaction rule** ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "description": "{hint:Human-readable rule description}Allow higher monthly transaction limit of 100 transactions for BA00000000000000000000001{/hint}", "entityKey": { "entityReference": "PI00000000000000000000001", "entityType": "paymentInstrument" }, "interval": { "type": "monthly" }, "outcomeType": "hardBlock", "reference": "{hint:Your unique identifier for this resource}YOUR_REFERENCE{/hint}", "requestType": "authorization", "ruleRestrictions": { "matchingTransactions": { "operation": "greaterThan", "value": 100 } }, "status": "active", "type": "velocity", "overridesRule": "TR00000000000000000000001" }' ``` 2. Note the response, which contains the new **transactionRule** resource, identified by its unique `id`. **Response** ```json { "description": "Allow higher monthly transaction limit of 100 transactions for PI00000000000000000000001", "entityKey": { "entityReference": "PI00000000000000000000001", "entityType": "paymentInstrument" }, "interval": { "type": "monthly" }, "outcomeType": "hardBlock", "reference": "YOUR_REFERENCE", "requestType": "authorization", "ruleRestrictions": { "matchingTransactions": { "operation": "greaterThan", "value": 100 } }, "startDate": "2023-09-20T00:00:00+01:00", "status": "active", "type": "velocity", "overridesRule": "TR00000000000000000000001", "id": "TR00000000000000000000002" } ``` ### Skip a transaction rule You can override a rule by skipping it entirely for specific entities. This means that the rule no longer applies to that entity. To skip a transaction rule for an entity: 1. Make a POST [/transactionRules](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules) request. In addition to other parameters required to [create a rule](#create-a-transaction-rule), specify the following: | Parameter | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | [entityKey](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-entityKey) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object that contains the ID and type of entity for which you want to skip a rule. | | [ruleRestrictions](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-ruleRestrictions) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Leave this empty. | | [type](https://docs.adyen.com/api-explorer/balanceplatform/latest/post/transactionRules#request-type) | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The rule type. Set this to **bypass**. | | `overridesRule` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The ID of the transaction rule you want to skip for the entity. | For example, you created a transaction rule to limit the number of transactions to a maximum of 50 transactions per month for all cards in your balance platform. Now, let's skip this rule for just one card, so that it has no maximum monthly transaction limit. **Skip a transaction rule** ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X POST \ -d '{ "description": "{hint:Human-readable rule description}Skip payout limit for BA00000000000000000000001{/hint}", "entityKey": { "entityReference": "BA00000000000000000000001", "entityType": "balanceAccount" }, "reference": "{hint:Your unique identifier for this resource}YOUR_REFERENCE{/hint}", "requestType": "bankTransfer", "ruleRestrictions": {}, "status": "active", "type": "bypass", "overridesRule": "TR00000000000000000000001" }' ``` 2. Note the response, which contains the new **transactionRule** resource, identified by its unique `id`. **Response** ```json { "description": "Skip payout limit of 50 transactions for PI00000000000000000000001", "entityKey": { "entityReference": "PI00000000000000000000001", "entityType": "paymentInstrument" }, "reference": "YOUR_REFERENCE", "requestType": "authorization", "ruleRestrictions": {}, "status": "active", "type": "bypass", "overridesRule": "TR00000000000000000000001", "id": "TR00000000000000000000002" } ``` ## Update a transaction rule To update a transaction rule: 1. Make a PATCH [/transactionRules/{id}](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/patch/transactionRules/{transactionRuleId}) request, specifying the `id` in the path. For example, to add the US to the [previous transaction rule](/issuing/authorisation/transaction-rules/create-and-manage#create-transaction-rule-response), send the request below: **Update a transaction rule** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules/TR3227C223222B5FCB756DV9H \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X PATCH \ -d '{ "ruleRestrictions": { "countries": { "operation": "noneMatch", "value": [ "NL", "US" ] } } }' ``` #### Java ```java // Adyen Java API Library v25.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.balancePlatform.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.balancePlatform.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) CountriesRestriction countriesRestriction = new CountriesRestriction() .operation("noneMatch") .value(Arrays.asList("NL", "US")); TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions() .countries(countriesRestriction); TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo() .ruleRestrictions(transactionRuleRestrictions); // Make the API call TransactionRulesApi service = new TransactionRulesApi(client); TransactionRule response = service.updateTransactionRule("transactionRuleId", transactionRuleInfo, null); ``` #### PHP ```php // Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\BalancePlatform\CountriesRestriction; use Adyen\Model\BalancePlatform\TransactionRuleRestrictions; use Adyen\Model\BalancePlatform\TransactionRuleInfo; use Adyen\Service\BalancePlatform\TransactionRulesApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) $countriesRestriction = new CountriesRestriction(); $countriesRestriction ->setOperation("noneMatch") ->setValue(array("NL", "US")); $transactionRuleRestrictions = new TransactionRuleRestrictions(); $transactionRuleRestrictions ->setCountries($countriesRestriction); $transactionRuleInfo = new TransactionRuleInfo(); $transactionRuleInfo ->setRuleRestrictions($transactionRuleRestrictions); // Make the API call $service = new TransactionRulesApi($client); $response = $service->updateTransactionRule('transactionRuleId', $transactionRuleInfo); ``` #### C\# ```cs // Adyen .net API Library v14.4.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.BalancePlatform; using Adyen.Service.BalancePlatform; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) CountriesRestriction countriesRestriction = new CountriesRestriction { Operation = "noneMatch", Value = { "NL", "US" } }; TransactionRuleRestrictions transactionRuleRestrictions = new TransactionRuleRestrictions { Countries = countriesRestriction }; TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo { RuleRestrictions = transactionRuleRestrictions }; // Make the API call var service = new TransactionRulesService(client); var response = service.UpdateTransactionRule("transactionRuleId", transactionRuleInfo); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use const { Client, BalancePlatformAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const transactionRuleInfo = { ruleRestrictions: { countries: { operation: "noneMatch", value: [ "NL", "US" ] } } } // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.updateTransactionRule("transactionRuleId", transactionRuleInfo); ``` #### Go ```go // Adyen Go API Library v9.3.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/balancePlatform" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) countriesRestriction := balancePlatform.CountriesRestriction{ Operation: "noneMatch", Value: []string{ "NL", "US", }, } transactionRuleRestrictions := balancePlatform.TransactionRuleRestrictions{ Countries: &countriesRestriction, } transactionRuleInfo := balancePlatform.TransactionRuleInfo{ RuleRestrictions: transactionRuleRestrictions, } // Make the API call service := client.BalancePlatform() req := service.TransactionRulesApi.UpdateTransactionRuleInput("transactionRuleId").TransactionRuleInfo(transactionRuleInfo) res, httpRes, err := service.TransactionRulesApi.UpdateTransactionRule(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "ruleRestrictions": { "countries": { "operation": "noneMatch", "value": [ "NL", "US" ] } } } # Make the API call result = adyen.balancePlatform.transaction_rules_api.update_transaction_rule(request=json_request, transactionRuleId="transactionRuleId") ``` #### Ruby ```rb # Adyen Ruby API Library v9.3.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :ruleRestrictions => { :countries => { :operation => 'noneMatch', :value => [ 'NL', 'US' ] } } } # Make the API call result = adyen.balancePlatform.transaction_rules_api.update_transaction_rule(request_body, 'transactionRuleId') ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, BalancePlatformAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const countriesRestriction: Types.balancePlatform.CountriesRestriction = { operation: "noneMatch", value: ["NL", "US"] }; const transactionRuleRestrictions: Types.balancePlatform.TransactionRuleRestrictions = { countries: countriesRestriction }; const transactionRuleInfo: Types.balancePlatform.TransactionRuleInfo = { ruleRestrictions: transactionRuleRestrictions }; // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.updateTransactionRule("transactionRuleId", transactionRuleInfo); ``` 2. The response returns the updated transaction rule, along with **NL** and **US** in the list of countries. If the location where the transaction is processed does not match either the NL or US, then the transaction is blocked. ## Activate or deactivate a transaction rule You can activate or deactivate transaction rules using the [Customer Area](https://ca-test.adyen.com/) or by making API requests. ### Tab: Customer Area To deactivate a transaction rule: 1. Log in to your [Customer Area](https://ca-test.adyen.com/). 2. Go to **Transaction rules**. 3. Select the specific rule ID. 4. Select the **Deactivate** button. ### Tab: API request You can deactivate or activate transaction rules for transfers by making API requests. ### To deactivate a transaction rule 1. Make a PATCH [/transactionRules/{id}](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/patch/transactionRules/{transactionRuleId}) request and set the `status` to **inactive**. **Deactivate a transaction rule** #### curl ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules/TR3227C223222B5FCB756DV9H \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X PATCH \ -d '{ "status" : "inactive" }' ``` #### Java ```java // Adyen Java API Library v25.0.0 import com.adyen.Client; import com.adyen.enums.Environment; import com.adyen.model.balancePlatform.*; import java.time.OffsetDateTime; import java.util.*; import com.adyen.service.balancePlatform.*; Client client = new Client("ADYEN_API_KEY", Environment.TEST); // Create the request object(s) TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo() .status(TransactionRuleInfo.StatusEnum.INACTIVE); // Make the API call TransactionRulesApi service = new TransactionRulesApi(client); TransactionRule response = service.updateTransactionRule("transactionRuleId", transactionRuleInfo, null); ``` #### PHP ```php // Adyen PHP API Library v17.4.0 use Adyen\Client; use Adyen\Environment; use Adyen\Model\BalancePlatform\TransactionRuleInfo; use Adyen\Service\BalancePlatform\TransactionRulesApi; $client = new Client(); $client->setXApiKey("ADYEN_API_KEY"); $client->setEnvironment(Environment::TEST); // Create the request object(s) $transactionRuleInfo = new TransactionRuleInfo(); $transactionRuleInfo ->setStatus("inactive"); // Make the API call $service = new TransactionRulesApi($client); $response = $service->updateTransactionRule('transactionRuleId', $transactionRuleInfo); ``` #### C\# ```cs // Adyen .net API Library v14.4.0 using Adyen; using Environment = Adyen.Model.Environment; using Adyen.Model; using Adyen.Model.BalancePlatform; using Adyen.Service.BalancePlatform; var config = new Config() { XApiKey = "ADYEN_API_KEY", Environment = Environment.Test }; var client = new Client(config); // Create the request object(s) TransactionRuleInfo transactionRuleInfo = new TransactionRuleInfo { Status = TransactionRuleInfo.StatusEnum.Inactive }; // Make the API call var service = new TransactionRulesService(client); var response = service.UpdateTransactionRule("transactionRuleId", transactionRuleInfo); ``` #### NodeJS (JavaScript) ```js // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use const { Client, BalancePlatformAPI } = require('@adyen/api-library'); // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const transactionRuleInfo = { status: "inactive" } // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.updateTransactionRule("transactionRuleId", transactionRuleInfo); ``` #### Go ```go // Adyen Go API Library v9.3.0 import ( "context" "github.com/adyen/adyen-go-api-library/v9/src/common" "github.com/adyen/adyen-go-api-library/v9/src/adyen" "github.com/adyen/adyen-go-api-library/v9/src/balancePlatform" ) client := adyen.NewClient(&common.Config{ ApiKey: "ADYEN_API_KEY", Environment: common.TestEnv, }) // Create the request object(s) transactionRuleInfo := balancePlatform.TransactionRuleInfo{ Status: common.PtrString("inactive"), } // Make the API call service := client.BalancePlatform() req := service.TransactionRulesApi.UpdateTransactionRuleInput("transactionRuleId").TransactionRuleInfo(transactionRuleInfo) res, httpRes, err := service.TransactionRulesApi.UpdateTransactionRule(context.Background(), req) ``` #### Python ```py # Adyen Python API Library v12.2.0 import Adyen adyen = Adyen.Adyen() adyen.client.xapikey = "ADYEN_API_KEY" adyen.client.platform = "test" # The environment to use library in. # Create the request object(s) json_request = { "status": "inactive" } # Make the API call result = adyen.balancePlatform.transaction_rules_api.update_transaction_rule(request=json_request, transactionRuleId="transactionRuleId") ``` #### Ruby ```rb # Adyen Ruby API Library v9.3.0 require "adyen-ruby-api-library" adyen = Adyen::Client.new adyen.api_key = 'ADYEN_API_KEY' adyen.env = :test # Set to "live" for live environment # Create the request object(s) request_body = { :status => 'inactive' } # Make the API call result = adyen.balancePlatform.transaction_rules_api.update_transaction_rule(request_body, 'transactionRuleId') ``` #### NodeJS (TypeScript) ```ts // Adyen Node API Library v16.2.0 // Require the parts of the module you want to use import { Client, BalancePlatformAPI, Types } from "@adyen/api-library"; // Initialize the client object const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"}); // Create the request object(s) const transactionRuleInfo: Types.balancePlatform.TransactionRuleInfo = { status: Types.balancePlatform.TransactionRuleInfo.StatusEnum.Inactive }; // Make the API call const balancePlatformAPI = new BalancePlatformAPI(client); const response = balancePlatformAPI.TransactionRulesApi.updateTransactionRule("transactionRuleId", transactionRuleInfo); ``` 2. The `status` of the rule changes to **inactive** and the rule is no longer applied. ### To activate an inactive transaction rule 1. Make a PATCH [/transactionRules/{id}](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/patch/transactionRules/{transactionRuleId}) request and set the `status` to **active**. **Activate a transaction rule** ```bash curl https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules/TR3227C223222B5FCB756DV9H \ -H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \ -H 'content-type: application/json' \ -X PATCH \ -d '{ "status" : "active" }' ``` 2. The `status` of the rule changes to **active** and the rule is applied. ## See also * [Track transactions](/issuing/transactions) * [Use relayed authorisation](/issuing/authorisation/relayed-authorisation) ## Next steps [Examples of transaction rules](/issuing/authorisation/transaction-rules/examples) [Find out how common use cases are defined as transaction rules.](/issuing/authorisation/transaction-rules/examples)