Definition
An acceptance rule is a logic condition. It enables to:
- authorise
- restrict
- and/or prohibit transactions
A rule is composed of 4 aspects:
- actions
- attributes
- operators
- values
The syntax of a rule is as follows:
“Action" "if" "Attribute” "Relational operators" "Comparison value"
Example:
REFUSE if card_country != 'FRA'
The previous example refuses payments if the country of the card is not France.
The syntax of the grammar selected by the platform for its acceptance engine is very similar to SQL syntax (used to converse with databasess).
Actions
All rules of acceptance must be related to an action.
Available actions are as follows:
ALLOW
Authorize the payment.
REFUSE
Refuses the payment.
OTP
OTP (One Time Password) asks the card holder to provide a confirmation code, the card security cipher or a single code sent by SMS or e-mail.
THREE_D_SECURE
Imposes a 3D Secure transaction.
OTP_AND_THREE_D_SECURE
Combines OTP and THREE_D_SECURE actions.
ALERT
Sends an "webhook" notification of the associated transaction.
If the transaction meets the conditions set out in the rule, the action will be executed and the following rules will not be processed.
If the action is THREE_D_SECURE or OTP, the following rules will be processed if the action is already performed (the transaction is already 3-D-SECURE or l'OTP already present in the transaction).
Attributes
The attributes (Cf. List of attributes) are comparison criteria related to the transaction admission data.
For example, the card amount or country.
An attribute always begins with the special character "#". This convention enables the rule engine to detect attributes in the rule captured. Moreover, when this character is captured in the form, the comprehensive list of self-completed attributes is available.
Attributes represent different types of values, for example:
- amount = whole type (a numerical value without a decimal),
- card country = string of characters that is 3 characters long Cf. list of attributes.
In a rule, an attribute is always followed by a comparison operator
Comparison operators
Comparison operators are mathematical operators that enable the rule engine to compare the value of the attribute and the comparison value captured.
Comparison operators are to be used according to the type of attribute selected.
Type | Operators |
---|---|
Integer (numeric value without decimal) | = | != | IN | NOT IN | < | > | <= | >= |
Double (numeric value with decimals) | = | != | IN | NOT IN | < | > | <= | >= |
String | = | != | IN | NOT IN |
Boolean (true, false) | = | != |
Operators = , != , > , < , >= et <= are followed by a single comparison value.
Operators IN and NOT IN are followed by a list of comparison values.
A list of values is surrounded by parentheses and values inside the list are separated by commas.
Example:
REFUSE if #currency NOT IN ('EUR', 'USD', 'GBP', 'CHF')
Explanation: The previous example refuses all payments whose currency is not the Euro, US dollar, Pound Sterling or Swiss franc.
This syntax avoids drawing up several rules or conditions in the same rule.
Example:
REFUSE if #card_country IN ('ITA', 'AFG')
is equivalent to:
REFUSE if #card_country = 'ITA' and #card_country = 'AFG'
Values
Values correspond to comparison aspects you define in relation to the attributes. The value is characterised according to the attribute and, therefore, the type of corresponding operator.
According to the type of operator, the syntax for defining the value will not be the same:
Type of values | Syntax |
---|---|
Integer | Example: [...] = 100 |
Double | The value is defined with a full stop before the decimal. Example: [...] = 12.32 |
String | The value is defined between simple quotation marks '. Example: [...] = 'FRA' |
Boolean | The value is true or false. Example: [...] = false |
For string-like values, according to the attribute selected, the syntax of the value must comply with specific standards.
For attributes such as countries (_country), values are strings of characters and must comply with the standard ISO 3166-1 alpha-3.
For monetary-like attributes (_currency), values are strings and must comply with standard ISO 4217.
Values for attributes such as card commercial brand or the IP region (ip_region), values are strings and correspond to values from a completed list, defined in the list of attributes.
The attribute #always
This attribute will never be followed by any operator or value. It is there to define the behaviour of the rule engine when the transaction has not fulfilled any of the conditions defined in the previous rules.
Example:
THREE_D_SECURE if #always
The previous example imposes a 3D SECURE transaction if the payment’s input data have not complied with any of the conditions defined in the previous rules.
Logic operators and parenthesis
Logic operators and and or
The syntax used to define rules makes it possible to create several conditions within the same rule. Conditions will remain defined in the same way with the only difference being that the keyword will be inserted between the conditions.
Keywords will be and and or. They make it possible to define how the rule engine will translate the succession of these rules. The and corresponds to inclusion and or exclusion.
Example:
ALLOW if #amount < 1000 and #card_country = 'FRA'
The previous example authorises payments whose amount is less than 10 AND and whose card is French. If one or other of the defined conditions is not compliant, the action will not be executed.
Example:
ALLOW if #amount < 1000 or #card_country = 'FRA'
The previous example authorises payments whose amount is less than 10 OR and whose card is French. If one or other of the defined conditions is not compliant, the action will not be executed.
Parenthesis
The use of parenthesis in the definition of a multi-condition rule enables to define units of conditions and priorities among these units. The principle is the same as the one of the priorities for mathematical operators.
Example:
ALLOW if #amount < 1000 and (#card_country = 'FRA' or #currency = 'EUR')
In the previous example, the rule engine will first interpret the unit (#card_country = 'FRA' or #currency = 'EUR'). That is, the payment will be authorised if “(the card is French or the currency is the euro) AND the amount is less than 10.