POST /transactionRules

Creates a transaction rule. When your user makes a transaction with their Adyen-issued card, the transaction is allowed or declined based on the conditions and outcome defined in the transaction rule. You can apply the transaction rule to several cards, such as all the cards in your platform, or to a specific card. For use cases, see examples.

Servers

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
ruleRestrictions Object Yes

Contains one or more objects that define the rule conditions. Each object must have a value and an operation which determines how the values must be evaluated.

For example, a countries object can have a list of country codes ["US", "CA"] in the value field and anyMatch in the operation field.

ruleRestrictions.merchantNames Object No

List of names that will be compared to the merchant name according to the matching type.

Supported operations: anyMatch, noneMatch.

ruleRestrictions.merchantNames.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.merchantNames.value[] Array No
ruleRestrictions.merchantNames.value[].operation String No

The type of string matching operation. Possible values: startsWith, endsWith, isEqualTo, contains,

Possible values:

  • "isEqualTo"
  • "startsWith"
  • "contains"
  • "endsWith"
ruleRestrictions.merchantNames.value[].value String No

The string to be matched.

ruleRestrictions.processingTypes Object No

List of processing types and the operation.

Supported operations: anyMatch, noneMatch.

ruleRestrictions.processingTypes.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.processingTypes.value[] Array No

List of processing types.

Possible values: atmWithdraw, balanceInquiry, ecommerce, moto, pos, recurring, token.

ruleRestrictions.dayOfWeek Object No

List of week days and the operation. Supported operations: anyMatch, noneMatch.

ruleRestrictions.dayOfWeek.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.dayOfWeek.value[] Array No

List of days of the week.

Possible values: monday, tuesday, wednesday, thursday, friday, saturday, sunday.

ruleRestrictions.entryModes Object No

List of point-of-sale entry modes and the operation..

Supported operations: anyMatch, noneMatch.

ruleRestrictions.entryModes.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.entryModes.value[] Array No

List of point-of-sale entry modes.

Possible values: barcode, chip, cof, contactless, magstripe, manual, ocr, server.

ruleRestrictions.mccs Object No

List of merchant category codes (MCCs) and the operation.

Supported operations: anyMatch, noneMatch.

ruleRestrictions.mccs.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.mccs.value[] Array No

List of merchant category codes (MCCs).

ruleRestrictions.timeOfDay Object No

A start and end time in a time-only ISO-8601 extended offset format. Supported operations: equals, notEquals.

ruleRestrictions.timeOfDay.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.timeOfDay.value Object No
ruleRestrictions.timeOfDay.value.startTime String No

The start time in a time-only ISO-8601 extended offset format. For example: 08:00:00+02:00, 22:30:00-03:00.

ruleRestrictions.timeOfDay.value.endTime String No

The end time in a time-only ISO-8601 extended offset format. For example: 08:00:00+02:00, 22:30:00-03:00.

ruleRestrictions.matchingTransactions Object No

The number of transactions and the operation.

Supported operations: equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan.

ruleRestrictions.matchingTransactions.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.matchingTransactions.value Integer No

The number of transactions.

ruleRestrictions.sameAmountRestriction Object No

Checks if a user has recently sent the same amount of funds in multiple transfers.

To use this restriction, you must:

  • Set the rule type to velocity.

  • Specify a time interval.

  • Specify a number of matchingTransactions.

Supported operation: equals.

ruleRestrictions.sameAmountRestriction.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.sameAmountRestriction.value Boolean No
ruleRestrictions.matchingValues Object No

Checks if a user has recently made multiple transfers with the specified values.

To use this restriction, you must:

  • Set the rule type to velocity.

  • Specify a time interval.

  • Specify a number of matchingTransactions.

Supported operation: allMatch.

Supported value inputs:

  • merchantId and acquirerId
  • amount and currency
  • merchantName.
ruleRestrictions.matchingValues.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.matchingValues.value[] Array No
ruleRestrictions.differentCurrencies Object No

Compares the currency of the payment against the currency of the payment instrument, and specifies the operation.

Supported operations: equals, notEquals.

ruleRestrictions.differentCurrencies.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.differentCurrencies.value Boolean No

Checks the currency of the payment against the currency of the payment instrument.

Possible values:

  • true: The currency of the payment is different from the currency of the payment instrument.

  • false: The currencies are the same.

ruleRestrictions.internationalTransaction Object No

Indicates whether transaction is an international transaction and specifies the operation.

Supported operations: equals, notEquals.

ruleRestrictions.internationalTransaction.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.internationalTransaction.value Boolean No

Boolean indicating whether transaction is an international transaction.

Possible values:

  • true: The transaction is an international transaction.

  • false: The transaction is a domestic transaction.

ruleRestrictions.riskScores Object No

Risk scores provided by specific sources. The same operation applies to all scores.

Current sources available: visa, mastercard

Supported operations: equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan.

ruleRestrictions.riskScores.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.riskScores.value Object No
ruleRestrictions.riskScores.value.visa Integer No

Transaction risk score provided by Visa. Values provided by Visa range between 01 (lowest risk) to 99 (highest risk).

ruleRestrictions.riskScores.value.mastercard Integer No

Transaction risk score provided by Mastercard. Values provided by Mastercard range between 0 (lowest risk) to 998 (highest risk).

ruleRestrictions.activeNetworkTokens Object No

The total number of tokens that a card can have across different kinds of digital wallets on the user's phones, watches, or other wearables.

Supported operations: equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan.

ruleRestrictions.activeNetworkTokens.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.activeNetworkTokens.value Integer No

The number of tokens.

ruleRestrictions.countries Object No

List of countries and the operation.

Supported operations: anyMatch, noneMatch.

ruleRestrictions.countries.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.countries.value[] Array No

List of two-character ISO 3166-1 alpha-2 country codes.

ruleRestrictions.merchants Object No

List of merchant ID and acquirer ID pairs, and the operation.

Supported operations: anyMatch, noneMatch.

ruleRestrictions.merchants.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.merchants.value[] Array No

List of merchant ID and acquirer ID pairs.

ruleRestrictions.merchants.value[].acquirerId String No

The acquirer ID.

ruleRestrictions.merchants.value[].merchantId String No

The merchant identification number (MID).

ruleRestrictions.counterpartyBank Object No

List of counterparty Institutions and the operation. Supported operations: anyMatch, noneMatch.

ruleRestrictions.counterpartyBank.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.counterpartyBank.value[] Array No

List of counterparty Bank Institutions and the operation.

ruleRestrictions.counterpartyBank.value[].country String No

Two-character ISO 3166-1 alpha-2 country code.

ruleRestrictions.counterpartyBank.value[].identification String No

The bank identification code.

ruleRestrictions.counterpartyBank.value[].identificationType String No

The type of the identification.

Possible values: iban, routingNumber, sortCode.

Possible values:

  • "iban"
  • "routingNumber"
  • "sortCode"
ruleRestrictions.sameCounterpartyRestriction Object No

Checks if a user has recently made multiple transfers to the same counterparty.

To use this restriction, you must:

  • Set the rule type to velocity.

  • Specify a time interval.

  • Specify a number of matchingTransactions.

Supported operations: equals.

ruleRestrictions.sameCounterpartyRestriction.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.sameCounterpartyRestriction.value Boolean No
ruleRestrictions.totalAmount Object No

The total amount and the operation.

Supported operations: equals, notEquals, greaterThanOrEqualTo, greaterThan, lessThanOrEqualTo, lessThan.

ruleRestrictions.totalAmount.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.totalAmount.value Object No

The amount value and currency.

ruleRestrictions.totalAmount.value.value Integer Yes

The amount of the transaction, in minor units.

ruleRestrictions.totalAmount.value.currency String Yes

The three-character ISO currency code.

ruleRestrictions.brandVariants Object No

List of card brand variants and the operation.

Supported operations: anyMatch, noneMatch.

ruleRestrictions.brandVariants.operation String Yes

Defines how the condition must be evaluated.

ruleRestrictions.brandVariants.value[] Array No

List of card brand variants.

Possible values:

  • mc, mccredit, mccommercialcredit_b2b, mcdebit, mcbusinessdebit, mcbusinessworlddebit, mcprepaid, mcmaestro

  • visa, visacredit, visadebit, visaprepaid.

You can specify a rule for a generic variant. For example, to create a rule for all Mastercard payment instruments, use mc. The rule is applied to all payment instruments under mc, such as mcbusinessdebit and mcdebit.

aggregationLevel String No

The level at which data must be accumulated, used in rules with type velocity or maxUsage. The level must be the same or lower in hierarchy than the entityKey.

If not provided, by default, the rule will accumulate data at the paymentInstrument level.

Possible values: paymentInstrument, paymentInstrumentGroup, balanceAccount, accountHolder, balancePlatform.

description String Yes

Your description for the transaction rule.

score Integer No

A positive or negative score applied to the transaction if it meets the conditions of the rule. Required when outcomeType is scoreBased. The value must be between -100 and 100.

interval Object Yes

The time interval when the rule conditions apply.

interval.dayOfWeek String No

The day of week, used when the duration.unit is weeks. If not provided, by default, this is set to monday.

Possible values: sunday, monday, tuesday, wednesday, thursday, friday.

Possible values:

  • "tuesday"
  • "friday"
  • "thursday"
  • "monday"
  • "saturday"
  • "sunday"
  • "wednesday"
interval.type String Yes

The type of interval during which the rule conditions and limits apply, and how often counters are reset.

Possible values:

  • perTransaction: conditions are evaluated and the counters are reset for every transaction.
  • daily: the counters are reset daily at 00:00:00 CET.
  • weekly: the counters are reset every Monday at 00:00:00 CET.
  • monthly: the counters reset every first day of the month at 00:00:00 CET.
  • lifetime: conditions are applied to the lifetime of the payment instrument.
  • rolling: conditions are applied and the counters are reset based on a duration. If the reset date and time are not provided, Adyen applies the default reset time similar to fixed intervals. For example, if the duration is every two weeks, the counter resets every third Monday at 00:00:00 CET.
  • sliding: conditions are applied and the counters are reset based on the current time and a duration that you specify.

Possible values:

  • "rolling"
  • "lifetime"
  • "perTransaction"
  • "monthly"
  • "weekly"
  • "sliding"
  • "daily"
interval.dayOfMonth Integer No

The day of month, used when the duration.unit is months. If not provided, by default, this is set to 1, the first day of the month.

interval.timeOfDay String No

The time of day, in hh:mm:ss format, used when the duration.unit is hours. If not provided, by default, this is set to 00:00:00.

interval.duration Object No

The duration, which you can specify in hours, days, weeks, or months. The maximum duration is 90 days or an equivalent in other units. Required when the type is rolling or sliding.

interval.duration.value Integer No

The length of time by the unit. For example, 5 days.

The maximum duration is 90 days or an equivalent in other units. For example, 3 months.

interval.duration.unit String No

The unit of time. You can only use minutes and hours if the interval.type is sliding.

Possible values: minutes, hours, days, weeks, or months

Possible values:

  • "months"
  • "minutes"
  • "weeks"
  • "days"
  • "hours"
interval.timeZone String No

The time zone. For example, Europe/Amsterdam. By default, this is set to UTC.

entityKey Object Yes

The type and unique identifier of the resource to which the rule applies.

entityKey.entityReference String No

The unique identifier of the resource.

entityKey.entityType String No

The type of resource.

Possible values: balancePlatform, paymentInstrumentGroup, accountHolder, balanceAccount, or paymentInstrument.

status String No

The status of the transaction rule. If you provide a startDate in the request, the rule is automatically created with an active status.

Possible values: active, inactive.

Possible values:

  • "inactive"
  • "active"
startDate String No

The date when the rule will start to be evaluated, in ISO 8601 extended offset date-time format. For example, 2020-12-18T10:15:30+01:00.

If not provided when creating a transaction rule, the startDate is set to the date when the rule status is set to active.

endDate String No

The date when the rule will stop being evaluated, in ISO 8601 extended offset date-time format. For example, 2020-12-18T10:15:30+01:00.

If not provided, the rule will be evaluated until the rule status is set to inactive.

requestType String No

Indicates the type of request to which the rule applies. If not provided, by default, this is set to authorization.

Possible values: authorization, authentication, tokenization, bankTransfer.

Possible values:

  • "tokenization"
  • "authentication"
  • "authorization"
  • "bankTransfer"
type String Yes

The type of rule, which defines if a rule blocks transactions based on individual characteristics or accumulates data.

Possible values:

  • blockList: decline a transaction when the conditions are met.
  • maxUsage: add the amount or number of transactions for the lifetime of a payment instrument, and then decline a transaction when the specified limits are met.
  • velocity: add the amount or number of transactions based on a specified time interval, and then decline a transaction when the specified limits are met.

Possible values:

  • "velocity"
  • "maxUsage"
  • "blockList"
  • "allowList"
reference String Yes

Your reference for the transaction rule.

outcomeType String No

The outcome that will be applied when a transaction 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.

Default value: hardBlock.

scoreBased is not allowed when requestType is bankTransfer.

Possible values:

  • "scoreBased"
  • "enforceSCA"
  • "hardBlock"
  • "timedBlock"

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.