Skip to main content

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
ActionDescription
REVIEWReview
BLOCKBlock

Rule Definition

In order to define rules, you can use Fraud Management > Rule Management > New Rule button to open up Rule Definition modal window.

Fraud Rule Definition

When defined rule action is 'Block', payment will be blocked by FRAUD_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

OperatorDescriptionExample
==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
inTests if condition variable exists list values.clientIp in @ipBlackList
not inTests if condition variable not exists list values.clientIp not @ipWhiteList

Variables

Variable NameData TypeDescription
cardNumbercardFingerprintCard Fingerprint
cardHolderNamestringCardholder Name
cardBrandstringCard Brand
isThreeDSbooleanIs payment operation 3D Secure
clientIpstringClient IP - clientIp field on payment request
buyerIdintegerMember ID - buyerMemberId field on payment request
buyerExternalIdstringBuyer External ID - buyerExternalId value of fraudParams field on payment request or buyerMember properties
buyerPhoneNumberstringBuyer Phone Number - buyerPhoneNumber value of fraudParams field on payment request or buyerMember properties
buyerEmailstringBuyer Email - buyerEmail value of fraudParams field on payment request or buyerMember properties
paidPricefloatPaid Price
currencystringCurrency - currency field on payment request - Default TRY - See: Currencies
paymentTypestringPayment Type - See: Payment Types
binNumberstringBin - First 8 digits of cardNumber field on payment request
isForeignCardbooleanIs payment operation requested with a foreign card
hasSuccessPaymentIn30MinutesbooleanHas any success payment before now in last 30 minutes
hasSuccessPaymentHourlybooleanHas any success payment before now in last 1 hour
hasSuccessPaymentDailybooleanHas any success payment before now in last 1 day
sameClientIpIn30MinutesintegerPrevious payment count with same ip in last 30 minutes
sameClientIpHourlyintegerPrevious payment count with same ip in last 1 hour
sameClientIpDailyintegerPrevious payment count with same ip in last 1 day
sameClientIpTotalPaidPriceIn30MinutesfloatTotal paid price of previous payments with same ip in last 30 minutes
sameClientIpTotalPaidPriceHourlyfloatTotal paid price of previous payments with same ip in last 1 hour
sameClientIpTotalPaidPriceDailyfloatTotal paid price of previous payments now with same ip in last 1 day
sameBuyerIdIn30MinutesintegerPrevious payment count with same member id in last 30 minutes
sameBuyerIdHourlyintegerPrevious payment count with same member id in last 1 hour
sameBuyerIdDailyintegerPrevious payment count with same member id in last 1 day
sameBuyerIdTotalPaidPriceIn30MinutesfloatTotal paid price of previous payments with same member id in last 30 minutes
sameBuyerIdTotalPaidPriceHourlyfloatTotal paid price of previous payments with same member id in last 1 hour
sameBuyerIdTotalPaidPriceDailyfloatTotal paid price of previous payments now with same member id in last 1 day
sameBuyerExternalIdIn30MinutesintegerPrevious payment count with same buyer external id in last 30 minutes
sameBuyerExternalIdHourlyintegerPrevious payment count with same buyer external id in last 1 hour
sameBuyerExternalIdDailyintegerPrevious payment count with same buyer external id in last 1 day
sameBuyerExternalIdTotalPaidPriceIn30MinutesfloatTotal paid price of previous payments with same buyer external id in last 30 minutes
sameBuyerExternalIdTotalPaidPriceHourlyfloatTotal paid price of previous payments with same buyer external id in last 1 hour
sameBuyerExternalIdTotalPaidPriceDailyfloatTotal paid price of previous payments now with same buyer external id in last 1 day
sameBuyerPhoneNumberIn30MinutesintegerPrevious payment count with same buyer phone number in last 30 minutes
sameBuyerPhoneNumberHourlyintegerPrevious payment count with same buyer phone number in last 1 hour
sameBuyerPhoneNumberDailyintegerPrevious payment count with same buyer phone number in last 1 day
sameBuyerPhoneNumberTotalPaidPriceIn30MinutesfloatTotal paid price of previous payments with same buyer phone number in last 30 minutes
sameBuyerPhoneNumberTotalPaidPriceHourlyfloatTotal paid price of previous payments with same buyer phone number in last 1 hour
sameBuyerPhoneNumberTotalPaidPriceDailyfloatTotal paid price of previous payments now with same buyer phone number in last 1 day
sameBuyerEmailIn30MinutesintegerPrevious payment count with same buyer email in last 30 minutes
sameBuyerEmailHourlyintegerPrevious payment count with same buyer email in last 1 hour
sameBuyerEmailDailyintegerPrevious payment count with same buyer email in last 1 day
sameBuyerEmailTotalPaidPriceIn30MinutesfloatTotal paid price of previous payments with same buyer email in last 30 minutes
sameBuyerEmailTotalPaidPriceHourlyfloatTotal paid price of previous payments with same buyer email in last 1 hour
sameBuyerEmailTotalPaidPriceDailyfloatTotal paid price of previous payments now with same buyer email in last 1 day
sameCardNumberIn30MinutesintegerPrevious payment count with same card number in last 30 minutes
sameCardNumberHourlyintegerPrevious payment count with same card number in last 1 hour
sameCardNumberTotalPaidPriceIn30MinutesfloatTotal paid price of previous payments with same card number in last 30 minutes
sameCardNumberTotalPaidPriceHourlyfloatTotal paid price of previous payments with same card number in last 1 hour
sameCardNumberHasFraudSuspectIn30MinutesbooleanHas any payment with FRAUD_SUSPECT error group before now with same card number in last 30 minutes
sameCardNumberHasFraudSuspectHourlybooleanHas any payment with FRAUD_SUSPECT error group before now with same card number in last 1 hour
sameClientIpDistinctCardIn30MinutesintegerPrevious payment count with different cards from the same ip in last 30 minutes
sameClientIpDistinctCardHourlyintegerPrevious payment count with different cards from the same ip in last 1 hour

Rule Examples

You can check out following examples to guide you for creating your own rules

Example RuleDescription
cardNumber in @blockedCardNumbersList usage example - Matches payments with card numbers in blockedCardList
sameClientIpHourly > 2 and sameClientIpTotalPaidPriceHourly >= 10000Previous payments velocity check example
Matches if total paid price of previous payments with same ip in last 1 hour equal to or greater than 10000
and previous payment count with same ip in last 1 hour greater than 2