- Create a transaction rule
- View existing transaction rules
- Override existing transaction rules
- Update a transaction rule
- Deactivate or activate a transaction rule
Requirements
| Requirement | Description |
|---|---|
| Integration type | Adyen Issuing |
| API credential roles | Make sure that you have access to the Configuration API with following role: Bank Manage TransactionRules role |
| Webhooks | Subscribe to the following webhook(s): Transfer webhooks Transaction webhooks |
| Setup steps | Before you begin: Make sure you are familiar with how transaction rules work |
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 or by making an API request. The following tabs explain both procedures.- Customer Area
- API
- Customer Area
- API request
- Customer Area
- API request
To create a transaction rule in your Customer Area:
- Go to Financial products > Transaction rules.
- Select + Create new rule.
- Add the required rule details.
- Set the rule conditions.
- Review and test your rule.
Add details
Add the following rule details:- Entity type: The type of entity to which you want to apply the rule.
- Entity key: The ID of the selected entity.
- Aggregation level: The level at which the data is accumulated when selecting rule types that involve counting a number of transactions within a time interval.
-
Rule type: Specify when the outcome of the rule 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:- A parameter. For example: Total amount, Countries, Day of week.
- An operator. For example: equals, greater than, is in.
- A value. For example: 100, Netherlands, Monday.
Test rule
In the Review page, you can select Test rule. This enables you test the rule with previous transactions in your platform.-
Make a POST /transactionRules request, specifying the following parameters:
For example, consider the following rule requirements:
Parameter Required Description aggregationLevel The level at which the data is accumulated when selecting rule types that involve counting a number of transactions within a time interval. Default: paymentInstrument. description Your description for the rule. Maximum length: 300 characters. This description is displayed in the Customer Area. entityKey An object that contains the ID and type of resource to which you want to apply the rule. interval The time period or duration when you want to apply the rule. outcomeType 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 thescoreyou 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 Your reference for the rule. Maximum length: 150 characters. This description is displayed in the Customer Area. requestType The type of transfer to which you want to apply the rule. Set this to authorization, authentication, or tokenization. type 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 An object that contains all the conditions for a rule. For example: countries,mcc, ortimeOfDay. For each condition, you must specify theoperationand thevaluethat we must check. See how to combine rule restrictions with with specific types and intervals.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 statusset to active.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 statusis set to inactive.status Set to active if you want to start evaluating the rule. When you set the status to active, we automatically set the startDateto the current time.- Only allow payments from the Netherlands.
- Apply the rule to
paymentInstrumentIdPI00000000000000000000001. - Apply the rule starting from 2022-03-20 at 00:00 CET.
curl
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
// 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
// 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#
// 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)
// 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
// 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
# 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
# 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)
// 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); -
Note the response, which contains the new transactionRule resource, identified by its unique
id. The transaction rule is applied on the specifiedstartDatefor all payments made with payment instrument PI00000000000000000000001. If the location where the transaction is processed does not match any of the values inruleRestrictions.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{ "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 | blockList, velocity | equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan | perTransaction, daily, weekly, monthly, rolling, sliding |
| brandVariants | blockList, maxUsage, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding |
| countries | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding |
| differentCurrencies | blockList, velocity | equals, notEquals | perTransaction, daily, weekly, monthly, rolling, sliding |
| entryModes | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding |
| internationalTransaction | blockList, velocity | equals, notEquals | perTransaction, daily, weekly, monthly, rolling, sliding |
| matchingTransactions | maxUsage, velocity | equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan | daily, weekly, monthly, lifetime, rolling, sliding |
| mccs | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding |
| merchants | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding |
| processingTypes | blockList, velocity | anyMatch, noneMatch | perTransaction, daily, weekly, monthly, rolling, sliding |
| timeOfDay | blockList, velocity | equals, notEquals | perTransaction |
| 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 or by making API requests.To view the transaction rules:
- Log in to your Customer Area.
- Go to Financial products > Transaction rules.
- Select a specific rule ID to view the transaction rule details.
- Go to Financial products > Payment instruments.
- Select a specific payment instrument ID.
- Go to the Related transaction rules section.
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} | 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 | 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 | 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 | 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 | 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 | 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. 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:-
Make a POST /transactionRules request. In addition to other parameters required to create a rule, specify the following:
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
Parameter Required Description entityKey 
An object that contains the ID and type of entity for which you want to override a rule. ruleRestrictions 
The new rule restrictions you want to apply to the entity. overridesRule
The ID of the transaction rule you want to override for the entity. 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" }' -
Note the response, which contains the new transactionRule resource, identified by its unique
id. Response{ "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:-
Make a POST /transactionRules request. In addition to other parameters required to create a rule, specify the following:
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
Parameter Required Description entityKey 
An object that contains the ID and type of entity for which you want to skip a rule. ruleRestrictions 
Leave this empty. type 
The rule type. Set this to bypass. overridesRule
The ID of the transaction rule you want to skip for the entity. 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" }' -
Note the response, which contains the new transactionRule resource, identified by its unique
id. Response{ "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:-
Make a PATCH /transactionRules/{id} request, specifying the
idin the path. For example, to add the US to the previous transaction rule, send the request below: Update a transaction rulecurl
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
// 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
// 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#
// 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)
// 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
// 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
# 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
# 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)
// 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); - 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 or by making API requests.To deactivate a transaction rule:
- Log in to your Customer Area.
- Go to Transaction rules.
- Select the specific rule ID.
- Select the Deactivate button.
You can deactivate or activate transaction rules for transfers by making API requests.
To deactivate a transaction rule
-
Make a PATCH /transactionRules/{id} request and set the
statusto inactive. Deactivate a transaction rulecurl
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
// 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
// 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#
// 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)
// 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
// 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
# 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
# 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)
// 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); -
The
statusof the rule changes to inactive and the rule is no longer applied.
To activate an inactive transaction rule
-
Make a PATCH /transactionRules/{id} request and set the
statusto active. Activate a transaction rulecurl 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" }' -
The
statusof the rule changes to active and the rule is applied.