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_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

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 in @ipWhiteList

Variables

Variable NameData TypeDescription
cardNumbercardFingerprintCard Fingerprint
cardHolderNamestringCardholder Name
cardBrandstringCard Brand
clientIpstringClient IPv4 Address - clientIp sent in the request
buyerIdintegerBuyer Member ID - buyerMemberId sent in the request
buyerExternalIdstringBuyer External ID - buyerExternalId in fraudParams sent in the request or buyerMember.externalId
buyerPhoneNumberstringBuyer Phone Number - buyerPhoneNumber in fraudParams sent in the request or buyerMember.phoneNumber
buyerEmailstringBuyer Email - buyerEmail in fraudParams sent in the request or buyerMember.email
buyerEmailDomainstringBuyer Email Domain - email domain in fraudParams sent in the request or buyerMember email domain
customFraudVariablestringCustom Variable - customFraudVariable in fraudParams sent in the request
currencystringCurrency - currency in the request - Default TRY
paymentTypestringPayment Type - Possible values: CARD_PAYMENT WALLET_PAYMENT CARD_AND_WALLET_PAYMENT DEPOSIT_PAYMENT
binNumberstringBIN - first 8 digits of the card in the request
conversationIdstringConversation ID - conversationId sent in the request
externalIdstringExternal ID - externalId sent in the request
checkoutTokenstringCheckout Token - checkoutToken sent in the request
paidPricefloatPaid Amount (Collected Amount)
isThreeDSbooleanWas the payment processed with 3D Secure?
isForeignCardbooleanWas the transaction made with a foreign card?
hasSuccessPaymentIn30MinutesbooleanAny successful transaction in the last 30 minutes (historical)?
hasSuccessPaymentHourlybooleanAny successful transaction in the last 1 hour (historical)?
hasSuccessPaymentDailybooleanAny successful transaction in the last 1 day (historical)?
sameIPHasFraudSuspectHourlybooleanAny transaction from the same IP in the last 1 hour with error group FRAUD_SUSPECT (historical)?
sameClientIpIn30MinutesintegerTotal number of transactions from the same IP in the last 30 minutes (historical)
sameClientIpHourlyintegerTotal number of transactions from the same IP in the last 1 hour (historical)
sameClientIpDailyintegerTotal number of transactions from the same IP in the last 1 day (historical)
sameClientIpTotalPaidPriceIn30MinutesfloatTotal transaction volume in the same currency from the same IP in the last 30 minutes (historical)
sameClientIpTotalPaidPriceHourlyfloatTotal transaction volume in the same currency from the same IP in the last 1 hour (historical)
sameClientIpTotalPaidPriceDailyfloatTotal transaction volume in the same currency from the same IP in the last 1 day (historical)
sameClientIpDistinctCardIn30MinutesintegerNumber of transactions with a different card from the same IP in the last 30 minutes (historical)
sameClientIpDistinctCardHourlyintegerNumber of transactions with a different card from the same IP in the last 1 hour (historical)
sameClientIpDistinctCardDailyintegerNumber of transactions with a different card from the same IP in the last 1 day (historical)
sameBuyerIdIn30MinutesintegerNumber of transactions for the same buyer in the last 30 minutes (historical)
sameBuyerIdHourlyintegerNumber of transactions for the same buyer in the last 1 hour (historical)
sameBuyerIdDailyintegerNumber of transactions for the same buyer in the last 1 day (historical)
sameBuyerIdTotalPaidPriceIn30MinutesfloatTotal transaction volume in the same currency for the same buyer in the last 30 minutes (historical)
sameBuyerIdTotalPaidPriceHourlyfloatTotal transaction volume in the same currency for the same buyer in the last 1 hour (historical)
sameBuyerIdTotalPaidPriceDailyfloatTotal transaction volume in the same currency for the same buyer in the last 1 day (historical)
sameBuyerIdDistinctCardIn30MinutesintegerNumber of transactions made with a different card for the same buyer in the last 30 minutes (historical)
sameBuyerIdDistinctCardHourlyintegerNumber of transactions made with a different card for the same buyer in the last 1 hour (historical)
sameBuyerIdDistinctCardDailyintegerNumber of transactions made with a different card for the same buyer in the last 1 day (historical)
sameBuyerExternalIdIn30MinutesintegerNumber of transactions for the buyer with the same externalId in the last 30 minutes (historical)
sameBuyerExternalIdHourlyintegerNumber of transactions for the buyer with the same externalId in the last 1 hour (historical)
sameBuyerExternalIdDailyintegerNumber of transactions for the buyer with the same externalId in the last 1 day (historical)
sameBuyerExternalIdTotalPaidPriceIn30MinutesfloatTotal transaction volume for the buyer with the same externalId in the last 30 minutes (historical)
sameBuyerExternalIdTotalPaidPriceHourlyfloatTotal transaction volume for the buyer with the same externalId in the last 1 hour (historical)
sameBuyerExternalIdTotalPaidPriceDailyfloatTotal transaction volume for the buyer with the same externalId in the last 1 day (historical)
sameBuyerExternalIdDistinctCardIn30MinutesintegerNumber of transactions made with a different card by the buyer with the same externalId in the last 30 minutes (historical)
sameBuyerExternalIdDistinctCardHourlyintegerNumber of transactions made with a different card by the buyer with the same externalId in the last 1 hour (historical)
sameBuyerExternalIdDistinctCardDailyintegerNumber of transactions made with a different card by the buyer with the same externalId in the last 1 day (historical)
sameBuyerPhoneNumberIn30MinutesintegerNumber of transactions for the buyer with the same phone number in the last 30 minutes (historical)
sameBuyerPhoneNumberHourlyintegerNumber of transactions for the buyer with the same phone number in the last 1 hour (historical)
sameBuyerPhoneNumberDailyintegerNumber of transactions for the buyer with the same phone number in the last 1 day (historical)
sameBuyerPhoneNumberTotalPaidPriceIn30MinutesfloatTotal transaction volume for the buyer with the same phone number in the last 30 minutes (historical)
sameBuyerPhoneNumberTotalPaidPriceHourlyfloatTotal transaction volume for the buyer with the same phone number in the last 1 hour (historical)
sameBuyerPhoneNumberTotalPaidPriceDailyfloatTotal transaction volume for the buyer with the same phone number in the last 1 day (historical)
sameBuyerPhoneNumberDistinctCardIn30MinutesintegerNumber of transactions made with a different card by the buyer with the same phone number in the last 30 minutes (historical)
sameBuyerPhoneNumberDistinctCardHourlyintegerNumber of transactions made with a different card by the buyer with the same phone number in the last 1 hour (historical)
sameBuyerPhoneNumberDistinctCardDailyintegerNumber of transactions made with a different card by the buyer with the same phone number in the last 1 day (historical)
sameBuyerEmailIn30MinutesintegerNumber of transactions for the buyer with the same email in the last 30 minutes (historical)
sameBuyerEmailHourlyintegerNumber of transactions for the buyer with the same email in the last 1 hour (historical)
sameBuyerEmailDailyintegerNumber of transactions for the buyer with the same email in the last 1 day (historical)
sameBuyerEmailTotalPaidPriceIn30MinutesfloatTotal transaction volume for the buyer with the same email in the last 30 minutes (historical)
sameBuyerEmailTotalPaidPriceHourlyfloatTotal transaction volume for the buyer with the same email in the last 1 hour (historical)
sameBuyerEmailTotalPaidPriceDailyfloatTotal transaction volume for the buyer with the same email in the last 1 day (historical)
sameBuyerEmailDistinctCardIn30MinutesintegerNumber of transactions made with a different card by the buyer with the same email in the last 30 minutes (historical)
sameBuyerEmailDistinctCardHourlyintegerNumber of transactions made with a different card by the buyer with the same email in the last 1 hour (historical)
sameBuyerEmailDistinctCardDailyintegerNumber of transactions made with a different card by the buyer with the same email in the last 1 day (historical)
sameCardNumberIn30MinutesintegerNumber of transactions with the same card in the last 30 minutes (historical)
sameCardNumberHourlyintegerNumber of transactions with the same card in the last 1 hour (historical)
sameCardNumberDailyintegerNumber of transactions with the same card in the last 1 day (historical)
sameCardNumberTotalPaidPriceIn30MinutesfloatTotal transaction volume in the same currency with the same card in the last 30 minutes (historical)
sameCardNumberTotalPaidPriceHourlyfloatTotal transaction volume in the same currency with the same card in the last 1 hour (historical)
sameCardNumberTotalPaidPriceDailyfloatTotal transaction volume in the same currency with the same card in the last 1 day (historical)
sameCardNumberHasFraudSuspectIn30MinutesbooleanAny transaction with the same card in the last 30 minutes with error group FRAUD_SUSPECT (historical)?
sameCardNumberHasFraudSuspectHourlybooleanAny transaction with the same card in the last 1 hour with error group FRAUD_SUSPECT (historical)?
sameCardNumberHasFraudSuspectDailybooleanAny transaction with the same card in the last 1 day with error group FRAUD_SUSPECT (historical)?
sameCardNumberInvalidCvvIn30MinutesintegerNumber of transactions with INVALID_CVC2 error using the same card in the last 30 minutes (historical)
sameCardNumberInvalidCvvHourlyintegerNumber of transactions with INVALID_CVC2 error using the same card in the last 1 hour (historical)
sameCardNumberInvalidCvvDailyintegerNumber of transactions with INVALID_CVC2 error using the same card in the last 1 day (historical)
sameCardNumberInvalidExpireDateIn30MinutesintegerNumber of transactions with INVALID_EXPIRE_YEAR_MONTH error using the same card in the last 30 minutes (historical)
sameCardNumberInvalidExpireDateHourlyintegerNumber of transactions with INVALID_EXPIRE_YEAR_MONTH error using the same card in the last 1 hour (historical)
sameCardNumberInvalidExpireDateDailyintegerNumber of transactions with INVALID_EXPIRE_YEAR_MONTH error using the same card in the last 1 day (historical)
sameCustomFraudVariableIn30MinutesintegerNumber of transactions with the same custom variable value in the last 30 minutes (historical)
sameCustomFraudVariableHourlyintegerNumber of transactions with the same custom variable value in the last 1 hour (historical)
sameCustomFraudVariableDailyintegerNumber of transactions with the same custom variable value in the last 1 day (historical)
sameCustomFraudVariableTotalPaidPriceIn30MinutesfloatTotal transaction volume with the same custom variable value in the last 30 minutes (historical)
sameCustomFraudVariableTotalPaidPriceHourlyfloatTotal transaction volume with the same custom variable value in the last 1 hour (historical)
sameCustomFraudVariableTotalPaidPriceDailyfloatTotal transaction volume with the same custom variable value in the last 1 day (historical)
sameCustomFraudVariableDistinctCardIn30MinutesintegerNumber of transactions with a different card and the same custom variable value in the last 30 minutes (historical)
sameCustomFraudVariableDistinctCardHourlyintegerNumber of transactions with a different card and the same custom variable value in the last 1 hour (historical)
sameCustomFraudVariableDistinctCardDailyintegerNumber of transactions with a different card and the same custom variable value in the last 1 day (historical)
sameConversationIdIn30MinutesintegerNumber of transactions with the same conversationId in the last 30 minutes (historical)
sameConversationIdHourlyintegerNumber of transactions with the same conversationId in the last 1 hour (historical)
sameConversationIdDailyintegerNumber of transactions with the same conversationId in the last 1 day (historical)
sameConversationIdTotalPaidPriceIn30MinutesfloatTotal transaction volume in the same currency with the same conversationId in the last 30 minutes (historical)
sameConversationIdTotalPaidPriceHourlyfloatTotal transaction volume in the same currency with the same conversationId in the last 1 hour (historical)
sameConversationIdTotalPaidPriceDailyfloatTotal transaction volume in the same currency with the same conversationId in the last 1 day (historical)
sameConversationIdDistinctCardIn30MinutesintegerNumber of transactions made with a different card and the same conversationId in the last 30 minutes (historical)
sameConversationIdDistinctCardHourlyintegerNumber of transactions made with a different card and the same conversationId in the last 1 hour (historical)
sameConversationIdDistinctCardDailyintegerNumber of transactions made with a different card and the same conversationId in the last 1 day (historical)
sameExternalIdIn30MinutesintegerNumber of transactions with the same externalId in the last 30 minutes (historical)
sameExternalIdHourlyintegerNumber of transactions with the same externalId in the last 1 hour (historical)
sameExternalIdDailyintegerNumber of transactions with the same externalId in the last 1 day (historical)
sameExternalIdTotalPaidPriceIn30MinutesfloatTotal transaction volume in the same currency with the same externalId in the last 30 minutes (historical)
sameExternalIdTotalPaidPriceHourlyfloatTotal transaction volume in the same currency with the same externalId in the last 1 hour (historical)
sameExternalIdTotalPaidPriceDailyfloatTotal transaction volume in the same currency with the same externalId in the last 1 day (historical)
sameExternalIdDistinctCardIn30MinutesintegerNumber of transactions made with a different card and the same externalId in the last 30 minutes (historical)
sameExternalIdDistinctCardHourlyintegerNumber of transactions made with a different card and the same externalId in the last 1 hour (historical)
sameExternalIdDistinctCardDailyintegerNumber of transactions made with a different card and the same externalId in the last 1 day (historical)
sameCheckoutTokenIn30MinutesintegerNumber of transactions with the same checkoutToken in the last 30 minutes (historical)
sameCheckoutTokenHourlyintegerNumber of transactions with the same checkoutToken in the last 1 hour (historical)
sameCheckoutTokenDailyintegerNumber of transactions with the same checkoutToken in the last 1 day (historical)
sameCheckoutTokenTotalPaidPriceIn30MinutesfloatTotal transaction volume in the same currency with the same checkoutToken in the last 30 minutes (historical)
sameCheckoutTokenTotalPaidPriceHourlyfloatTotal transaction volume in the same currency with the same checkoutToken in the last 1 hour (historical)
sameCheckoutTokenTotalPaidPriceDailyfloatTotal transaction volume in the same currency with the same checkoutToken in the last 1 day (historical)
sameCheckoutTokenDistinctCardIn30MinutesintegerNumber of transactions made with a different card and the same checkoutToken in the last 30 minutes (historical)
sameCheckoutTokenDistinctCardHourlyintegerNumber of transactions made with a different card and the same checkoutToken in the last 1 hour (historical)
sameCheckoutTokenDistinctCardDailyintegerNumber 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 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 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