Rules
Card payments are processed by fraud rules which are defined by the merchant. Fraud Rules are defined with a language called Fraud DSL which is developed by Craftgate.
When payment matches defined rule, action of the rule (see: Fraud Actions) will be applied.
Fraud Actions
| Action | Description |
|---|---|
REVIEW | Review |
BLOCK | Block |
Rule Definition
In order to define rules, you can use Fraud Management > Rule Management > New Rule button to open up Rule Definition modal window.
When defined rule action is 'Block', payment will be blocked by FRAUD_CHECK_BLOCK error group
When defined rule action is 'Review', payment will be allowed but a fraud check record will be created by system.
Rule Definition
Rule definition modal has a rule editor which configured to use Fraud DSL Language
Rule editor will help you to define rules with autocomplete features. Autocomplete will help create rules with rule
variables listed below, operators and lists can be used.
Fraud DSL
In order to detect fraud payments, Fraud DSL language has a special syntax. This syntax has very flexible content with numerous predefined variables and user defined list for you to create your own criteria.
A Fraud rule can be consists of one or more conditions. These conditions can be combined with an and operator.
Rule conditions can be created with variables listed below.
Rule Format:
[condition] and [condition] and ...
Condition Format:
[variable] [operator] [value/list]
Note: Variables with type boolean can be used without operator and value because it has value of true or false
.
For example sameCardNumberHasFraudSuspectHourly and ...
Rule Operators
| Operator | Description | Example |
|---|---|---|
== | Tests if condition variable is equal to value. | clientIp == "127.0.0.1 |
!= | Tests if condition variable is not equal to value. | clientIp != "127.0.0.1 |
< | Tests if condition variable is less than value. Can only be used with variables have numerical data types(integer ya da float). | sameClientIpIn30Minutes < 3 |
<= | Tests if condition variable is less than or equal to value. Can only be used with variables have numerical data types(integer ya da float). | sameClientIpIn30Minutes <= 3 |
> | Tests if condition variable is greater than value. Can only be used with variables have numerical data types(integer ya da float). | sameClientIpIn30Minutes > 3 |
>= | Tests if condition variable is greater than or equal to value. Can only be used with variables have numerical data types(integer ya da float). | sameClientIpIn30Minutes >= 3 |
in | Tests if condition variable exists list values. | clientIp in @ipBlackList |
not in | Tests if condition variable not exists list values. | clientIp not in @ipWhiteList |
Variables
| Variable Name | Data Type | Description |
|---|---|---|
cardNumber | cardFingerprint | Card Fingerprint |
cardHolderName | string | Cardholder Name |
cardBrand | string | Card Brand |
clientIp | string | Client IPv4 Address - clientIp sent in the request |
buyerId | integer | Buyer Member ID - buyerMemberId sent in the request |
buyerExternalId | string | Buyer External ID - buyerExternalId in fraudParams sent in the request or buyerMember.externalId |
buyerPhoneNumber | string | Buyer Phone Number - buyerPhoneNumber in fraudParams sent in the request or buyerMember.phoneNumber |
buyerEmail | string | Buyer Email - buyerEmail in fraudParams sent in the request or buyerMember.email |
buyerEmailDomain | string | Buyer Email Domain - email domain in fraudParams sent in the request or buyerMember email domain |
customFraudVariable | string | Custom Variable - customFraudVariable in fraudParams sent in the request |
currency | string | Currency - currency in the request - Default TRY |
paymentType | string | Payment Type - Possible values: CARD_PAYMENT WALLET_PAYMENT CARD_AND_WALLET_PAYMENT DEPOSIT_PAYMENT |
binNumber | string | BIN - first 8 digits of the card in the request |
conversationId | string | Conversation ID - conversationId sent in the request |
externalId | string | External ID - externalId sent in the request |
checkoutToken | string | Checkout Token - checkoutToken sent in the request |
paidPrice | float | Paid Amount (Collected Amount) |
isThreeDS | boolean | Was the payment processed with 3D Secure? |
isForeignCard | boolean | Was the transaction made with a foreign card? |
hasSuccessPaymentIn30Minutes | boolean | Any successful transaction in the last 30 minutes (historical)? |
hasSuccessPaymentHourly | boolean | Any successful transaction in the last 1 hour (historical)? |
hasSuccessPaymentDaily | boolean | Any successful transaction in the last 1 day (historical)? |
sameIPHasFraudSuspectHourly | boolean | Any transaction from the same IP in the last 1 hour with error group FRAUD_SUSPECT (historical)? |
sameClientIpIn30Minutes | integer | Total number of transactions from the same IP in the last 30 minutes (historical) |
sameClientIpHourly | integer | Total number of transactions from the same IP in the last 1 hour (historical) |
sameClientIpDaily | integer | Total number of transactions from the same IP in the last 1 day (historical) |
sameClientIpTotalPaidPriceIn30Minutes | float | Total transaction volume in the same currency from the same IP in the last 30 minutes (historical) |
sameClientIpTotalPaidPriceHourly | float | Total transaction volume in the same currency from the same IP in the last 1 hour (historical) |
sameClientIpTotalPaidPriceDaily | float | Total transaction volume in the same currency from the same IP in the last 1 day (historical) |
sameClientIpDistinctCardIn30Minutes | integer | Number of transactions with a different card from the same IP in the last 30 minutes (historical) |
sameClientIpDistinctCardHourly | integer | Number of transactions with a different card from the same IP in the last 1 hour (historical) |
sameClientIpDistinctCardDaily | integer | Number of transactions with a different card from the same IP in the last 1 day (historical) |
sameBuyerIdIn30Minutes | integer | Number of transactions for the same buyer in the last 30 minutes (historical) |
sameBuyerIdHourly | integer | Number of transactions for the same buyer in the last 1 hour (historical) |
sameBuyerIdDaily | integer | Number of transactions for the same buyer in the last 1 day (historical) |
sameBuyerIdTotalPaidPriceIn30Minutes | float | Total transaction volume in the same currency for the same buyer in the last 30 minutes (historical) |
sameBuyerIdTotalPaidPriceHourly | float | Total transaction volume in the same currency for the same buyer in the last 1 hour (historical) |
sameBuyerIdTotalPaidPriceDaily | float | Total transaction volume in the same currency for the same buyer in the last 1 day (historical) |
sameBuyerIdDistinctCardIn30Minutes | integer | Number of transactions made with a different card for the same buyer in the last 30 minutes (historical) |
sameBuyerIdDistinctCardHourly | integer | Number of transactions made with a different card for the same buyer in the last 1 hour (historical) |
sameBuyerIdDistinctCardDaily | integer | Number of transactions made with a different card for the same buyer in the last 1 day (historical) |
sameBuyerExternalIdIn30Minutes | integer | Number of transactions for the buyer with the same externalId in the last 30 minutes (historical) |
sameBuyerExternalIdHourly | integer | Number of transactions for the buyer with the same externalId in the last 1 hour (historical) |
sameBuyerExternalIdDaily | integer | Number of transactions for the buyer with the same externalId in the last 1 day (historical) |
sameBuyerExternalIdTotalPaidPriceIn30Minutes | float | Total transaction volume for the buyer with the same externalId in the last 30 minutes (historical) |
sameBuyerExternalIdTotalPaidPriceHourly | float | Total transaction volume for the buyer with the same externalId in the last 1 hour (historical) |
sameBuyerExternalIdTotalPaidPriceDaily | float | Total transaction volume for the buyer with the same externalId in the last 1 day (historical) |
sameBuyerExternalIdDistinctCardIn30Minutes | integer | Number of transactions made with a different card by the buyer with the same externalId in the last 30 minutes (historical) |
sameBuyerExternalIdDistinctCardHourly | integer | Number of transactions made with a different card by the buyer with the same externalId in the last 1 hour (historical) |
sameBuyerExternalIdDistinctCardDaily | integer | Number of transactions made with a different card by the buyer with the same externalId in the last 1 day (historical) |
sameBuyerPhoneNumberIn30Minutes | integer | Number of transactions for the buyer with the same phone number in the last 30 minutes (historical) |
sameBuyerPhoneNumberHourly | integer | Number of transactions for the buyer with the same phone number in the last 1 hour (historical) |
sameBuyerPhoneNumberDaily | integer | Number of transactions for the buyer with the same phone number in the last 1 day (historical) |
sameBuyerPhoneNumberTotalPaidPriceIn30Minutes | float | Total transaction volume for the buyer with the same phone number in the last 30 minutes (historical) |
sameBuyerPhoneNumberTotalPaidPriceHourly | float | Total transaction volume for the buyer with the same phone number in the last 1 hour (historical) |
sameBuyerPhoneNumberTotalPaidPriceDaily | float | Total transaction volume for the buyer with the same phone number in the last 1 day (historical) |
sameBuyerPhoneNumberDistinctCardIn30Minutes | integer | Number of transactions made with a different card by the buyer with the same phone number in the last 30 minutes (historical) |
sameBuyerPhoneNumberDistinctCardHourly | integer | Number of transactions made with a different card by the buyer with the same phone number in the last 1 hour (historical) |
sameBuyerPhoneNumberDistinctCardDaily | integer | Number of transactions made with a different card by the buyer with the same phone number in the last 1 day (historical) |
sameBuyerEmailIn30Minutes | integer | Number of transactions for the buyer with the same email in the last 30 minutes (historical) |
sameBuyerEmailHourly | integer | Number of transactions for the buyer with the same email in the last 1 hour (historical) |
sameBuyerEmailDaily | integer | Number of transactions for the buyer with the same email in the last 1 day (historical) |
sameBuyerEmailTotalPaidPriceIn30Minutes | float | Total transaction volume for the buyer with the same email in the last 30 minutes (historical) |
sameBuyerEmailTotalPaidPriceHourly | float | Total transaction volume for the buyer with the same email in the last 1 hour (historical) |
sameBuyerEmailTotalPaidPriceDaily | float | Total transaction volume for the buyer with the same email in the last 1 day (historical) |
sameBuyerEmailDistinctCardIn30Minutes | integer | Number of transactions made with a different card by the buyer with the same email in the last 30 minutes (historical) |
sameBuyerEmailDistinctCardHourly | integer | Number of transactions made with a different card by the buyer with the same email in the last 1 hour (historical) |
sameBuyerEmailDistinctCardDaily | integer | Number of transactions made with a different card by the buyer with the same email in the last 1 day (historical) |
sameCardNumberIn30Minutes | integer | Number of transactions with the same card in the last 30 minutes (historical) |
sameCardNumberHourly | integer | Number of transactions with the same card in the last 1 hour (historical) |
sameCardNumberDaily | integer | Number of transactions with the same card in the last 1 day (historical) |
sameCardNumberTotalPaidPriceIn30Minutes | float | Total transaction volume in the same currency with the same card in the last 30 minutes (historical) |
sameCardNumberTotalPaidPriceHourly | float | Total transaction volume in the same currency with the same card in the last 1 hour (historical) |
sameCardNumberTotalPaidPriceDaily | float | Total transaction volume in the same currency with the same card in the last 1 day (historical) |
sameCardNumberHasFraudSuspectIn30Minutes | boolean | Any transaction with the same card in the last 30 minutes with error group FRAUD_SUSPECT (historical)? |
sameCardNumberHasFraudSuspectHourly | boolean | Any transaction with the same card in the last 1 hour with error group FRAUD_SUSPECT (historical)? |
sameCardNumberHasFraudSuspectDaily | boolean | Any transaction with the same card in the last 1 day with error group FRAUD_SUSPECT (historical)? |
sameCardNumberInvalidCvvIn30Minutes | integer | Number of transactions with INVALID_CVC2 error using the same card in the last 30 minutes (historical) |
sameCardNumberInvalidCvvHourly | integer | Number of transactions with INVALID_CVC2 error using the same card in the last 1 hour (historical) |
sameCardNumberInvalidCvvDaily | integer | Number of transactions with INVALID_CVC2 error using the same card in the last 1 day (historical) |
sameCardNumberInvalidExpireDateIn30Minutes | integer | Number of transactions with INVALID_EXPIRE_YEAR_MONTH error using the same card in the last 30 minutes (historical) |
sameCardNumberInvalidExpireDateHourly | integer | Number of transactions with INVALID_EXPIRE_YEAR_MONTH error using the same card in the last 1 hour (historical) |
sameCardNumberInvalidExpireDateDaily | integer | Number of transactions with INVALID_EXPIRE_YEAR_MONTH error using the same card in the last 1 day (historical) |
sameCustomFraudVariableIn30Minutes | integer | Number of transactions with the same custom variable value in the last 30 minutes (historical) |
sameCustomFraudVariableHourly | integer | Number of transactions with the same custom variable value in the last 1 hour (historical) |
sameCustomFraudVariableDaily | integer | Number of transactions with the same custom variable value in the last 1 day (historical) |
sameCustomFraudVariableTotalPaidPriceIn30Minutes | float | Total transaction volume with the same custom variable value in the last 30 minutes (historical) |
sameCustomFraudVariableTotalPaidPriceHourly | float | Total transaction volume with the same custom variable value in the last 1 hour (historical) |
sameCustomFraudVariableTotalPaidPriceDaily | float | Total transaction volume with the same custom variable value in the last 1 day (historical) |
sameCustomFraudVariableDistinctCardIn30Minutes | integer | Number of transactions with a different card and the same custom variable value in the last 30 minutes (historical) |
sameCustomFraudVariableDistinctCardHourly | integer | Number of transactions with a different card and the same custom variable value in the last 1 hour (historical) |
sameCustomFraudVariableDistinctCardDaily | integer | Number of transactions with a different card and the same custom variable value in the last 1 day (historical) |
sameConversationIdIn30Minutes | integer | Number of transactions with the same conversationId in the last 30 minutes (historical) |
sameConversationIdHourly | integer | Number of transactions with the same conversationId in the last 1 hour (historical) |
sameConversationIdDaily | integer | Number of transactions with the same conversationId in the last 1 day (historical) |
sameConversationIdTotalPaidPriceIn30Minutes | float | Total transaction volume in the same currency with the same conversationId in the last 30 minutes (historical) |
sameConversationIdTotalPaidPriceHourly | float | Total transaction volume in the same currency with the same conversationId in the last 1 hour (historical) |
sameConversationIdTotalPaidPriceDaily | float | Total transaction volume in the same currency with the same conversationId in the last 1 day (historical) |
sameConversationIdDistinctCardIn30Minutes | integer | Number of transactions made with a different card and the same conversationId in the last 30 minutes (historical) |
sameConversationIdDistinctCardHourly | integer | Number of transactions made with a different card and the same conversationId in the last 1 hour (historical) |
sameConversationIdDistinctCardDaily | integer | Number of transactions made with a different card and the same conversationId in the last 1 day (historical) |
sameExternalIdIn30Minutes | integer | Number of transactions with the same externalId in the last 30 minutes (historical) |
sameExternalIdHourly | integer | Number of transactions with the same externalId in the last 1 hour (historical) |
sameExternalIdDaily | integer | Number of transactions with the same externalId in the last 1 day (historical) |
sameExternalIdTotalPaidPriceIn30Minutes | float | Total transaction volume in the same currency with the same externalId in the last 30 minutes (historical) |
sameExternalIdTotalPaidPriceHourly | float | Total transaction volume in the same currency with the same externalId in the last 1 hour (historical) |
sameExternalIdTotalPaidPriceDaily | float | Total transaction volume in the same currency with the same externalId in the last 1 day (historical) |
sameExternalIdDistinctCardIn30Minutes | integer | Number of transactions made with a different card and the same externalId in the last 30 minutes (historical) |
sameExternalIdDistinctCardHourly | integer | Number of transactions made with a different card and the same externalId in the last 1 hour (historical) |
sameExternalIdDistinctCardDaily | integer | Number of transactions made with a different card and the same externalId in the last 1 day (historical) |
sameCheckoutTokenIn30Minutes | integer | Number of transactions with the same checkoutToken in the last 30 minutes (historical) |
sameCheckoutTokenHourly | integer | Number of transactions with the same checkoutToken in the last 1 hour (historical) |
sameCheckoutTokenDaily | integer | Number of transactions with the same checkoutToken in the last 1 day (historical) |
sameCheckoutTokenTotalPaidPriceIn30Minutes | float | Total transaction volume in the same currency with the same checkoutToken in the last 30 minutes (historical) |
sameCheckoutTokenTotalPaidPriceHourly | float | Total transaction volume in the same currency with the same checkoutToken in the last 1 hour (historical) |
sameCheckoutTokenTotalPaidPriceDaily | float | Total transaction volume in the same currency with the same checkoutToken in the last 1 day (historical) |
sameCheckoutTokenDistinctCardIn30Minutes | integer | Number of transactions made with a different card and the same checkoutToken in the last 30 minutes (historical) |
sameCheckoutTokenDistinctCardHourly | integer | Number of transactions made with a different card and the same checkoutToken in the last 1 hour (historical) |
sameCheckoutTokenDistinctCardDaily | integer | Number of transactions made with a different card and the same checkoutToken in the last 1 day (historical) |
Rule Examples
You can check out following examples to guide you for creating your own rules
| Example Rule | Description |
|---|---|
cardNumber in @blockedCardNumbers | List usage example - Matches payments with card numbers in blockedCardList |
sameClientIpHourly > 2 and sameClientIpTotalPaidPriceHourly >= 10000 | Previous payments velocity check example Matches if total paid price of previous payments with same IPv4 in last 1 hour equal to or greater than 10000 and previous payment count with same IPv4 in last 1 hour greater than 2 |