Create a transaction rule

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.

Endpoint destination URL

https://balanceplatform-api-test.adyen.com/bcl/v2/transactionRules
Click to copy

Request parameters

aggregationLevel string

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 Required
Max length: 300

Your description for the transaction rule, maximum 300 characters.

endDate string

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.

entityKey Required

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

interval Required

The time interval when the rule conditions apply.

outcomeType string

The outcome that will be applied when a transaction meets the conditions of the rule. If not provided, by default, this is set to hardBlock.

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.

reference string Required
Max length: 150

Your reference for the transaction rule, maximum 150 characters.

ruleRestrictions Required

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.

score integer

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.

startDate string

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.

status string

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.

type string Required

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.

Response parameters

After submitting a call, you receive a response message to inform you that your request was received and processed.

Depending on the HTTP status code of the response message, it is helpful to build some logic to handle any errors that a request or the system may return.

HTTP Responses

  • 200 - OK

    The request has succeeded.

    Show more Show less
  • 400 - Bad Request

    A problem reading or understanding the request.

    Show more Show less
  • 401 - Unauthorized

    Authentication required.

    Show more Show less
  • 403 - Forbidden

    Insufficient permissions to process the request.

    Show more Show less
  • 422 - Unprocessable Entity

    A request validation error.

    Show more Show less
  • 500 - Internal Server Error

    The server could not process the request.

    Show more Show less
  • Request
  • Click to copy
  • Response
  • Click to copy