{"title":"Custom risk rules","category":"default","creationDate":1779706501,"content":"<p>You can create custom risk rules next to using <a href=\"\/risk-management\/configure-standard-risk-rules\">standard risk rules<\/a>. Custom risk rules are a <a href=\"\/risk-management\/configure-manual-risk?tab=revenue_protect_premium_2#risk-rule-types\">RevenueProtect premium<\/a> feature. You can use these rules to influence the risk score of a transaction, send it to <a href=\"\/risk-management\/case-management\">case management<\/a>, or use the custom rule in combination with <a href=\"\/risk-management\/dynamic-3d-secure\">Dynamic 3D Secure<\/a>.<\/p>\n<p>With custom rules, you can address risks specific to your business. They provide a flexible way to supplement your risk profile, and can help prevent specific types of potential fraud.<\/p>\n<p>Here are some <a href=\"#example-scenario\">examples<\/a> when creating a custom risk rule might be useful:<\/p>\n<ul>\n<li>You want a combination of different transaction attributes to influence the risk score. For example, you want to increase the risk score for transactions above a certain amount, using a specific payment method and currency.<\/li>\n<li>You want to block a guest shopper from buying too many specific products. This can help prevent reseller fraud.<\/li>\n<\/ul>\n<p>To build your custom risk rules:<\/p>\n<ol>\n<li><a href=\"#set-up-risk-variables\">Choose risk variables<\/a>: understand which variables you can use in custom risk rules, or create custom fields.<\/li>\n<li><a href=\"#create-the-rule\">Create the rule<\/a>: set rule conditions to define when the rule should trigger.<\/li>\n<li><a href=\"#assign-an-action\">Assign an action to the rule<\/a>: define what should happen to the transaction when the rule triggers.<\/li>\n<\/ol>\n<h2 id=\"set-up-risk-variables\">Step 1: Choose risk variables<\/h2>\n<p>You can <a href=\"#create-custom-fields\">create your own fields<\/a>, or choose any of the <a href=\"#adyen-provided-fields\">risk fields provided by Adyen<\/a> as variables in your custom rule. To trigger the custom risk rule, the fields that you are using in the custom rule have to be included in the payment request. For practical examples, see the <a href=\"#example-scenario\">example scenarios<\/a>.<\/p>\n<h3 id=\"create-custom-fields\">Create custom fields<\/h3>\n<ol>\n<li>Log in to your\u00a0<a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>, and stay in your company account.<\/li>\n<li>Go to <strong>Revenue &amp; risk<\/strong>\u00a0&gt; <strong>Risk fields<\/strong>.<\/li>\n<li>Under <strong>Custom fields<\/strong>, select <strong>New field<\/strong>, and provide the details for your custom field. The custom field name is case sensitive.<\/li>\n<\/ol>\n<p>You assign a value to the custom field when you make payment requests. Submit the custom field name and the value in the <code>additionalData<\/code> object of the payment request.<\/p>\n<div class=\"sc-notice note\"><div>\n<p>The custom field name that you provide in your payment request is case-sensitive, and must match the name of the custom field that you created.<\/p>\n<\/div><\/div>\n<p>The example scenario has <a href=\"#test-the-rule\">example payment requests<\/a> that include a custom field.<\/p>\n<h3 id=\"adyen-provided-fields\">Use Adyen-provided risk fields<\/h3>\n<p>To see which Adyen-provided risk fields are available:<\/p>\n<ol>\n<li>Log in to your\u00a0<a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a> and stay in your company account.<\/li>\n<li>Go to <strong>Revenue &amp; risk<\/strong>\u00a0&gt; <strong>Risk fields<\/strong>.<\/li>\n<li>Browse or search for fields that you can use. The fields are divided in different categories:\n<ul>\n<li><strong>ShopperDNA fields<\/strong><br \/>\nFields that, based on ShopperDNA, relate to payments made by a distinct shopper.<\/li>\n<li><strong>Standard fields<\/strong><br \/>\nFields that are included in the payment request, or that are combinations of fields included in the payment request or checkout session.<\/li>\n<li><strong>Basket fields<\/strong><br \/>\nFields that describe the items or products in the transaction.<br \/>\nTo be able to use basket fields in custom rules, provide basket item data using the following parameters in your payment request:\n<ul>\n<li>Checkout API v69 or earlier:  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/69\/post\/payments#request-additionalData-AdditionalDataRisk-riskdata-basket-item_itemNr_-productTitle\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">additionalData.riskdata.basket.item[itemNr]<\/a><\/li>\n<li>Checkout API v70 and later:  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-lineItems\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lineItems<\/a><\/li>\n<\/ul><\/li>\n<li><strong>Promotion fields<\/strong><br \/>\nFields that describe a promotion, such as a discount.<\/li>\n<li><strong>Airline fields<\/strong><br \/>\nFields connected to transactions related to air travel.<\/li>\n<li><strong>Velocity fields<\/strong><br \/>\nFields that relate to the number of times a payment containing the same fields occurred within a certain time period.<\/li>\n<\/ul><\/li>\n<\/ol>\n<h2 id=\"create-the-rule\">Step 2: Create the rule<\/h2>\n<p>Before you create a custom risk rule, decide when you want to trigger the rule: before or after authorization.<\/p>\n<p>When you create a risk rule that triggers after authorization, you can take additional details from the authorization response into consideration. Examples of details that are available after authorization are the <a href=\"\/risk-management\/avs-checks\">AVS<\/a> response, the CVC response, or the liability shift status.<\/p>\n<p>To create a custom rule:<\/p>\n<ol>\n<li>Log in to your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>, and switch to the merchant account for which you want to create a custom rule.<\/li>\n<li>Go to\u00a0<strong>Revenue &amp; risk<\/strong> &gt;\u00a0<strong>Risk profiles<\/strong>.<\/li>\n<li>Select <strong>Risk rules<\/strong> &gt; <strong>Custom rules<\/strong>.<\/li>\n<li>Select <strong>+ Create new custom rule<\/strong>, and then select <strong>Pre-authorization<\/strong> or <strong>Post-authorization<\/strong>. The <a href=\"#set-up-risk-variables\">risk fields that you want to use in your custom rule<\/a> determine if the rule can be triggered before or after authorization.<\/li>\n<li>Enter a\u00a0<strong>Rule Name<\/strong>.<\/li>\n<li>Enter conditions. You can add conditions to the rule by selecting <strong>AND<\/strong> or <strong>OR<\/strong>. For each condition, select:\n<ul>\n<li><strong>Field Name<\/strong> - choose a risk variable, for example a custom field, an Adyen-provided risk field, or a list comparison.<\/li>\n<li><strong>Operator<\/strong> - how to compare the <strong>Field Name<\/strong> and the <strong>Field Value<\/strong>. The type of the fields you are comparing defines which <a href=\"#operators\">operators<\/a> you can use. For example, you can use \u00a0<strong>greater than (&gt;)<\/strong> for numbers, or <strong>starts with<\/strong> for strings.<\/li>\n<li><strong>Field Value<\/strong> - value that triggers your rule.<\/li>\n<\/ul><\/li>\n<li>Select <strong>Save<\/strong> to finish creating the rule.<\/li>\n<\/ol>\n<h2 id=\"assign-an-action\">Step 3: Assign an action to the rule<\/h2>\n<p>After creating your custom rule, assign the action that you want to take when the rule triggers: modify the risk score, or send to case management.<\/p>\n<p>To assign an action for the custom rule you created, configure the <a href=\"\/risk-management\/create-and-use-risk-profiles\">risk profile<\/a> that contains the rule. A risk profile can be assigned to more than one merchant account.<\/p>\n<h3>Configure the risk profile containing the rule<\/h3>\n<p>You can configure a risk profile from either:<\/p>\n<ul>\n<li>A company account.<br \/>\nLog in to your\u00a0<a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>, and stay in your company account. Select\u00a0<strong>Revenue &amp; risk<\/strong> &gt;\u00a0<strong>Risk profiles<\/strong>, and select the risk profile containing your custom rule. The risk profile overview page opens.<\/li>\n<li>A merchant account.<br \/>\nLog in to your\u00a0<a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>, and select a merchant account that uses the risk profile containing your custom rule. Select <strong>Revenue &amp; risk<\/strong> &gt;\u00a0<strong>Risk profiles<\/strong>. The risk profile overview page opens.<\/li>\n<\/ul>\n<p>Regardless where you configure the risk profile, the changes apply to all merchant accounts using that risk profile.<\/p>\n<h3>Assign an action to the custom rule<\/h3>\n<p>From the risk profile overview page:<\/p>\n<ol>\n<li>Select <strong>Risk rules<\/strong> &gt; <strong>Custom rules<\/strong>.<\/li>\n<li>Select your custom rule.<\/li>\n<li>Assign an action from the custom rule menu:\n<ul>\n<li><strong>Increase or decrease total risk score<\/strong> by a given value. For more information on fraud scores, see <a href=\"https:\/\/help.adyen.com\/knowledge\/risk\/fraud-score\/how-does-the-fraud-score-work\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">How does the fraud score work?<\/a>.<\/li>\n<li><strong>Send to case management<\/strong> for manual review. For more information on how to manually review transactions, see\u00a0<a href=\"\/risk-management\/case-management\">Case management<\/a>.<\/li>\n<\/ul><\/li>\n<li>Select <strong>Save changes<\/strong>.<\/li>\n<\/ol>\n<p>Now that you have created your custom rule, and assigned an action, you can also use it as one of the risk checks to be applied when <a href=\"\/risk-management\/dynamic-3d-secure#configuring-dynamic-3d-secure-rules\">configuring Dynamic 3D Secure<\/a>.<\/p>\n<div class=\"notices green\">\n<p>If you use <a href=\"\/risk-management\/dynamic-3d-secure\">Dynamic 3D Secure<\/a> in combination with custom rules, and you copy the risk profile, you have to re-configure any Dynamic 3D Secure rules that use custom rules in the new risk profile.<\/p>\n<\/div>\n<h2 id=\"create-custom-list-comparison\">Optional: Create a custom list comparison<\/h2>\n<p>A custom list comparison lets you compare risk field values against block and trust lists, which includes custom lists. For custom lists you can add expiry dates for list entries. Field values are only compared against list entries that have not expired.<\/p>\n<p>For example, in the <a href=\"#example-restricted\">example scenario<\/a> <strong>Guest user buys too many restricted products<\/strong>, you use a custom list to check if a shopper buys more than two items from a list of restricted items that you define.<\/p>\n<p>First create your custom list containing restricted items. Then create the list comparison that checks if the shopper's basket has any restricted items:<\/p>\n<ol>\n<li>\n<p>Create your list:<\/p>\n<ol>\n<li>From your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a> company account, go to <strong>Revenue &amp; risk<\/strong> &gt; <strong>Risk lists<\/strong>.<\/li>\n<li>Select <strong>Create new list<\/strong>.<\/li>\n<li>Enter the list name and select <strong>Create list<\/strong>.<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>Select the list you just created and add items to it. You can either:<\/p>\n<ul>\n<li>Select <strong>Add item<\/strong> and provide details for your entry:\n<ul>\n<li><strong>Item<\/strong>: The list item. For example, a product title for a restricted item.<\/li>\n<li><strong>Reason<\/strong>: (Optional) Any information useful to you about why the item is part of the list.<\/li>\n<li><strong>Expire date<\/strong>: (Optional) Expiry date for the list entry. The date must be in the future and if empty, we assign <code>9999-12-30 23:00:00+01<\/code>.<\/li>\n<\/ul><\/li>\n<li>\n<p>Select <strong>Upload CSV<\/strong> and upload a CSV file containing your list.<\/p>\n<p>To create a CSV file:<\/p>\n<ol>\n<li>\n<p>Create a spreadsheet file. In the first row of the file, write the following headers: <strong>item<\/strong>, <strong>reason<\/strong>, and <strong>expiredate<\/strong>.<\/p>\n<\/li>\n<li>\n<p>In the next rows, add the <strong>item<\/strong> and provide details for your entry in the spreadsheet.<\/p>\n<ul>\n<li><strong>item<\/strong>: The list item. For example, a product title for a restricted item.<\/li>\n<li><strong>reason<\/strong>: (Optional) Any information useful to you about why the item is part of the list.<\/li>\n<li>\n<p><strong>expiredate<\/strong>: (Optional) Expiry date for the list entry. The date must be in the future and if empty, we assign <code>9999-12-30 23:00:00+01<\/code>.<\/p>\n<p><strong>Example<\/strong>:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">item<\/th>\n<th style=\"text-align: left;\">reason<\/th>\n<th style=\"text-align: left;\">expiredate<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">Signature shirt<\/td>\n<td style=\"text-align: left;\">Limited edition<\/td>\n<td style=\"text-align: left;\">2023-11-10<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Golden shoes<\/td>\n<td style=\"text-align: left;\"><\/td>\n<td style=\"text-align: left;\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Designer bag<\/td>\n<td style=\"text-align: left;\">Limited edition<\/td>\n<td style=\"text-align: left;\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Vintage hat<\/td>\n<td style=\"text-align: left;\"><\/td>\n<td style=\"text-align: left;\">2023-12-30<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Save the spreadsheet in CSV format.<\/p>\n<\/li>\n<li>\n<p>Upload the CSV file to your custom list.<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Define the list comparison:<\/p>\n<ol>\n<li>Go to <strong>Revenue &amp; risk<\/strong> &gt; <strong>Risk fields<\/strong>.<\/li>\n<li>Under <strong>List comparisons<\/strong>, select <strong>New list comparison<\/strong> and provide the details for your comparison:\n<ul>\n<li><strong>Name<\/strong>: A name for the list comparison. It must not contain spaces.<\/li>\n<li><strong>Description<\/strong>: A description of the comparison.<\/li>\n<li><strong>Field for comparison<\/strong>: Select a <a href=\"#create-custom-fields\">custom risk field you defined<\/a> or an Adyen-provided field.<\/li>\n<li><strong>List<\/strong>: Select a custom list you defined or another block and trust list.<\/li>\n<\/ul><\/li>\n<li>Select <strong>Save<\/strong>.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2>Working with custom rules<\/h2>\n<h3 id=\"custom-rule-trigger\">How a payment request triggers a custom rule<\/h3>\n<p>A custom rule triggers when it meets the conditions, and matches the fields or values that you define in the custom rule. If you want a field or value to trigger the rule, make sure the payment request includes the field that triggers the custom rule.<\/p>\n<p>Many fields that can be included in a payment request can also be used in custom rules. If you want to use any of these fields in your custom rule, you must provide <a href=\"\/risk-management\/configure-manual-risk\/required-risk-field-reference\">the required field<\/a>, and assign a value to it in the payment request. The example scenario has <a href=\"#test-the-rule\">example payment requests<\/a> that include both Adyen-provided fields and a custom field.<\/p>\n<p>Some fields and values are automatically extracted, but others have to be specifically provided in the payment request.<\/p>\n<h3 id=\"operators\">Operators<\/h3>\n<p>When you build your custom risk rule, you can use operators to define the rule conditions. You can use <strong>AND<\/strong> and <strong>OR<\/strong> to add conditions to the custom risk rule.<br \/>\nThe data type of the field you are building your rule around determines if you can use a specific operator, which and how many values you can enter, and how the fields will be compared.<\/p>\n<div class=\"sticky-table-container\">\n    \n<table>\n<thead>\n<tr>\n<th>Operator<\/th>\n<th>When to use<\/th>\n<th>Example<\/th>\n<th>Data type<\/th>\n<th>Multiple values<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>equals (==)<\/td>\n<td>Compare the field against another field, against a single field value, or verify that the field value is true or false.<\/td>\n<td><code>quantity<\/code> equals (==) <strong>2<\/strong><\/td>\n<td>String, Number or Boolean<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>does not equal (!=)<\/td>\n<td>Compare the field against another field, against a single field value, or verify that the field value is true or false.<\/td>\n<td><code>quantity<\/code> does not equal (!=) <strong>2<\/strong><\/td>\n<td>String, Number or Boolean<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>is one of<\/td>\n<td>Compare the field against multiple field values of a list.<\/td>\n<td><code>currency<\/code> is one of <strong>EUR, USD, AUD<\/strong><\/td>\n<td>String or Number<\/td>\n<td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>is not one of<\/td>\n<td>Compare the field against multiple field values of a list.<\/td>\n<td><code>currency<\/code> is not one of <strong>EUR, USD, AUD<\/strong><\/td>\n<td>String or Number<\/td>\n<td><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>contains string<\/td>\n<td>Compare the field value to a specific string.<\/td>\n<td><code>emailDomain<\/code> contains <strong>example.com<\/strong><\/td>\n<td>String or Number<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>starts with<\/td>\n<td>Compare the start of the string in the field value to a specific string.<\/td>\n<td><code>emailName<\/code> starts with <strong>test<\/strong><\/td>\n<td>String<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>ends with<\/td>\n<td>Compare the end of the string in the field value to a specific string.<\/td>\n<td><code>emailName<\/code> ends with <strong>test<\/strong><\/td>\n<td>String<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>greater than (&gt;)<\/td>\n<td>Compare the field value against a specific value.<\/td>\n<td><code>amount<\/code> greater than (&gt;) <strong>1000<\/strong><\/td>\n<td>Number<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>greater than or equals (&gt;=)<\/td>\n<td>Compare the field value against a specific value.<\/td>\n<td><code>amount<\/code> greater than or equals (&gt;=) <strong>1000<\/strong><\/td>\n<td>Number<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>less than (&lt;)<\/td>\n<td>Compare the field value against a specific value.<\/td>\n<td><code>amount<\/code> less than (&lt;) <strong>1000<\/strong><\/td>\n<td>Number<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<tr>\n<td>less than or equals (&lt;=)<\/td>\n<td>Compare the field value against a specific value.<\/td>\n<td><code>amount<\/code> less than or equals (&lt;=) <strong>1000<\/strong><\/td>\n<td>Number<\/td>\n<td><img title=\"-x-\" alt=\"-x-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/x.png\" \/><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n<\/div>\n\n<p>Back to <a href=\"#create-the-rule\">Create the rule<\/a>.<\/p>\n<h2 id=\"example-scenario\">Example scenarios<\/h2>\n<h3 id=\"example-high-value\">Block specific high-value transactions<\/h3>\n<p>The following scenario is an example of a basic custom risk rule that increases the risk score of Mastercard payments if they are above EUR&nbsp;1000 or USD.<\/p>\n<h4>Step 1: Choose risk variables<\/h4>\n<p>You will use the variables <code>paymentMethod<\/code>, <code>currency<\/code> and <code>amount<\/code>. All of these are standard risk fields. You do not have to create custom fields.<\/p>\n<h4>Step 2: Create the rule<\/h4>\n<p>For this example scenario:<\/p>\n<ol>\n<li>Select <strong>Pre-authorization<\/strong> when creating the rule.<\/li>\n<li>Name the rule <strong>paymentMethodAmountCurrency<\/strong>.<\/li>\n<li>\n<p>Fill in the conditions for the rules, using <strong>AND<\/strong> to add conditions:<\/p>\n<table>\n<thead>\n<tr>\n<th>Field Name<\/th>\n<th>Operator<\/th>\n<th>Field Value<\/th>\n<th>Corresponding payment request field<\/th>\n<th>Comment<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>paymentMethod (String)<\/td>\n<td>equals (==)<\/td>\n<td><strong>mc<\/strong><\/td>\n<td><code>paymentMethod<\/code><\/td>\n<td>See <a href=\"\/development-resources\/paymentmethodvariant\">payment method variants<\/a> to see how to enter the payment method value.<\/td>\n<\/tr>\n<tr>\n<td>amount (Number)<\/td>\n<td>greater than (&gt;)<\/td>\n<td><strong>100000<\/strong><\/td>\n<td><code>amount<\/code><\/td>\n<td>Specify the amount in <a href=\"\/development-resources\/currency-codes\">minor units<\/a>.<\/td>\n<\/tr>\n<tr>\n<td>currency (String)<\/td>\n<td>is one of<\/td>\n<td><strong>EUR, USD<\/strong><\/td>\n<td><code>currency<\/code><\/td>\n<td>Select each <a href=\"\/development-resources\/currency-codes\">currency<\/a> from the drop-down list.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ol>\n<h4>Step 3: Assign an action<\/h4>\n<p>For this example scenario, select the custom rule you created, <strong>paymentMethodAmountCurrency<\/strong>, and increase the risk score by <strong>100<\/strong>.<br \/>\nThis custom rule will block all Mastercard transactions above USD or EUR&nbsp;1000.<\/p>\n<h3 id=\"example-restricted\">A guest user buys too many restricted items<\/h3>\n<p>The following scenario is an example of how you can set up and use custom rules and custom list comparisons.<\/p>\n<p>As a webshop owner you find out certain purchases by a guest user have an increased fraud risk. You decide to build a custom rule to offset this risk.<\/p>\n<p>Your custom rule adds 20 risk points if the shopper:<\/p>\n<ul>\n<li>Is a guest user.<\/li>\n<li>Is buying more than 2 items from a list of restricted products.<\/li>\n<\/ul>\n<h4>Step 1: Choose risk variables<\/h4>\n<p>For this example scenario, you need all variables:<\/p>\n<ul>\n<li>To use the shopper's basket items in your rule:\n<ul>\n<li>Provide basket item data using the following parameters in your payment request:\n<ul>\n<li>Checkout API v69 or earlier:  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/69\/post\/payments#request-additionalData-AdditionalDataRisk-riskdata-basket-item_itemNr_-productTitle\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">additionalData.riskdata.basket.item[itemNr]<\/a><\/li>\n<li>Checkout API v70 and later:  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-lineItems\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lineItems<\/a><\/li>\n<\/ul><\/li>\n<\/ul><\/li>\n<li>For the user type, you need to <a href=\"#create-custom-fields\">create a custom field<\/a> with the following details:\n<ul>\n<li><strong>Name<\/strong>: userType<\/li>\n<li><strong>Data type<\/strong>: String<\/li>\n<li><strong>Field description<\/strong>: The type of user making the payment<\/li>\n<\/ul><\/li>\n<\/ul>\n<h4>Step 2: Create the rule<\/h4>\n<p>For this example scenario:<\/p>\n<ol>\n<li>Select <strong>Pre-authorization<\/strong> when creating the rule, because you are using custom lists which can only be used before authorization.<\/li>\n<li>Name the rule <strong>guestBuysTooManyRestrictedProducts<\/strong>.<\/li>\n<li>\n<p>Fill in the conditions for the rules, using <strong>AND<\/strong> to add conditions:<\/p>\n<table>\n<thead>\n<tr>\n<th>Field Name<\/th>\n<th>Operator<\/th>\n<th>Field Value<\/th>\n<th>Corresponding payment request field<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>userType (String)<\/td>\n<td>equals (==)<\/td>\n<td>Guest<\/td>\n<td> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-additionalData-AdditionalDataRisk-riskdata-_customFieldName_\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">riskdata.userType<\/a><\/td>\n<\/tr>\n<tr>\n<td>quantity (Number)<\/td>\n<td>greater than (&gt;)<\/td>\n<td>2<\/td>\n<td>Checkout API v69 and earlier: <ul><li markdown=\"1\"> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/69\/post\/payments#request-additionalData-AdditionalDataRisk-riskdata-basket-item_itemNr_-quantity\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">riskdata.basket.item#.quantity<\/a><\/li><\/ul>Checkout API v70 and later:  <ul><li markdown=\"1\"> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-lineItems-quantity\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lineItems.quantity<\/a><\/li><\/ul><\/td>\n<\/tr>\n<tr>\n<td>restrictedProduct (Boolean)<\/td>\n<td>equals (==)<\/td>\n<td>True<\/td>\n<td>Checkout API v69 and earlier: <ul><li markdown=\"1\"> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/69\/post\/payments#request-additionalData-AdditionalDataRisk-riskdata-basket-item_itemNr_-productTitle\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">riskdata.basket.item#.productTitle<\/a><\/li><\/ul>Checkout API v70 and later: <ul><li markdown=\"1\"> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-lineItems-description\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lineItems.description<\/a><\/li><\/ul><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/li>\n<\/ol>\n<h4>Step 3: Assign an action<\/h4>\n<p>For this example scenario, select the custom rule you created, <strong>guestBuysTooManyRestrictedProducts<\/strong>, and increase the risk score by <strong>20<\/strong>.<\/p>\n<h4>Mandatory for this scenario: create a custom list comparison<\/h4>\n<p>To check the items in the shopper's basket against your list of restricted products, you need to <a href=\"#create-custom-list-comparison\">create a custom list comparison<\/a>.<\/p>\n<p>That means you have to create custom list comparison, and create a custom list called <strong>Restricted items<\/strong>.<\/p>\n<p>Create a <a href=\"#create-custom-list-comparison\">custom list comparison<\/a>:<\/p>\n<ul>\n<li><strong>Name<\/strong>: <strong>restrictedProduct<\/strong><\/li>\n<li><strong>Description<\/strong>: Check if a shopper is buying any items with a restricted product title.<\/li>\n<li><strong>Field for comparison<\/strong>: <strong>productTitle<\/strong>, an Adyen-provided risk field. You assign the value of this field when you make a payments request. For an example, see the <a href=\"#test-the-rule\">Test the rule<\/a> section.<\/li>\n<li><strong>List<\/strong>: <strong>Restricted items<\/strong>, the custom list you created.<\/li>\n<\/ul>\n<h4 id=\"test-the-rule\">Step 5: Test the rule<\/h4>\n<p>The following example  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> requests are based on the <a href=\"#example-restricted\">example scenario<\/a> <strong>Guest user buys too many restricted products<\/strong>.<\/p>\n<ol>\n<li>Make a POST request to the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> endpoint, including the risk fields that your custom rule uses:<\/li>\n<\/ol>\n\n<div id=\"taboVsEH\">\n    <div data-component-wrapper=\"tabs\">\n        <tabs\n                        :items=\"[{&quot;title&quot;:&quot;Checkout API v69 and earlier&quot;,&quot;content&quot;:&quot;\\n&lt;p&gt;For the example scenario &lt;strong&gt;Guest user buys too many restricted products&lt;\\\/strong&gt;:&lt;\\\/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;Use  &lt;a href=\\&quot;https:\\\/\\\/docs.adyen.com\\\/api-explorer\\\/Checkout\\\/69\\\/post\\\/payments#request-additionalData-AdditionalDataRisk-riskdata-_customFieldName_\\&quot; class=\\&quot;codeLabel  external-link no-image\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot;&gt;additionalData.riskdata.[customFieldName]&lt;\\\/a&gt; to send in the custom field &lt;code&gt;userType&lt;\\\/code&gt;.&lt;\\\/li&gt;\\n&lt;li&gt;Use  &lt;a href=\\&quot;https:\\\/\\\/docs.adyen.com\\\/api-explorer\\\/Checkout\\\/69\\\/post\\\/payments#request-additionalData-AdditionalDataRisk-riskdata-basket-item_itemNr_-productTitle\\&quot; class=\\&quot;codeLabel  external-link no-image\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot;&gt;additionalData.riskdata.basket.item[itemNr]&lt;\\\/a&gt; to send in the Adyen provided basket fields &lt;code&gt;productTitle&lt;\\\/code&gt; and &lt;code&gt;quantity&lt;\\\/code&gt;.&lt;\\\/li&gt;\\n&lt;\\\/ul&gt;\\n&lt;pre&gt;&lt;code class=\\&quot;language-json\\&quot;&gt;  {\\n     \\&quot;amount\\&quot;:{\\n        \\&quot;currency\\&quot;:\\&quot;USD\\&quot;,\\n        \\&quot;value\\&quot;:1000\\n     },\\n     \\&quot;reference\\&quot;:\\&quot;98739872454D\\&quot;,\\n     \\&quot;paymentMethod\\&quot;: {\\n        \\&quot;type\\&quot;: \\&quot;scheme\\&quot;,\\n        \\&quot;encryptedCardNumber\\&quot;: \\&quot;test_4111111111111111\\&quot;,\\n        \\&quot;encryptedExpiryMonth\\&quot;: \\&quot;test_03\\&quot;,\\n        \\&quot;encryptedExpiryYear\\&quot;: \\&quot;test_2030\\&quot;,\\n        \\&quot;encryptedSecurityCode\\&quot;: \\&quot;test_737\\&quot;\\n     },\\n     \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n     \\&quot;merchantAccount\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n     \\&quot;additionalData\\&quot;:{\\n       \\&quot;riskdata.basket.item1.productTitle\\&quot;:\\&quot;Golden shoes\\&quot;,\\n       \\&quot;riskdata.basket.item1.quantity\\&quot;: \\&quot;3\\&quot;,\\n       \\&quot;riskdata.userType\\&quot;: \\&quot;Guest\\&quot;\\n     }\\n  }&lt;\\\/code&gt;&lt;\\\/pre&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:1,&quot;relation&quot;:&quot;&quot;},{&quot;title&quot;:&quot;Checkout API v70 and later&quot;,&quot;content&quot;:&quot;\\n&lt;p&gt;For the example scenario &lt;strong&gt;Guest user buys too many restricted products&lt;\\\/strong&gt;:&lt;\\\/p&gt;\\n&lt;ul&gt;\\n&lt;li&gt;Use  &lt;a href=\\&quot;https:\\\/\\\/docs.adyen.com\\\/api-explorer\\\/Checkout\\\/latest\\\/post\\\/payments#request-additionalData-AdditionalDataRisk-riskdata-_customFieldName_\\&quot; class=\\&quot;codeLabel  external-link no-image\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot;&gt;additionalData.riskdata.[customFieldName]&lt;\\\/a&gt; to send in the custom field &lt;code&gt;userType&lt;\\\/code&gt;.&lt;\\\/li&gt;\\n&lt;li&gt;\\n&lt;p&gt;Use  &lt;a href=\\&quot;https:\\\/\\\/docs.adyen.com\\\/api-explorer\\\/Checkout\\\/latest\\\/post\\\/payments#request-lineItems\\&quot; class=\\&quot;codeLabel  external-link no-image\\&quot; target=\\&quot;_blank\\&quot; rel=\\&quot;nofollow noopener noreferrer\\&quot;&gt;lineItems&lt;\\\/a&gt; to send in the Adyen-provided basket fields &lt;code&gt;productTitle&lt;\\\/code&gt; and &lt;code&gt;quantity&lt;\\\/code&gt;. Use &lt;code&gt;lineItems.description&lt;\\\/code&gt; for &lt;code&gt;productTitle&lt;\\\/code&gt;, and &lt;code&gt;lineItems.quantity&lt;\\\/code&gt; for &lt;code&gt;quantity&lt;\\\/code&gt;.&lt;\\\/p&gt;\\n&lt;pre&gt;&lt;code class=\\&quot;language-json\\&quot;&gt;{\\n \\&quot;amount\\&quot;:{\\n    \\&quot;currency\\&quot;:\\&quot;USD\\&quot;,\\n    \\&quot;value\\&quot;:1000\\n },\\n \\&quot;reference\\&quot;:\\&quot;98739872454D\\&quot;,\\n \\&quot;paymentMethod\\&quot;: {\\n     \\&quot;type\\&quot;: \\&quot;scheme\\&quot;,\\n     \\&quot;encryptedCardNumber\\&quot;: \\&quot;test_4111111111111111\\&quot;,\\n     \\&quot;encryptedExpiryMonth\\&quot;: \\&quot;test_03\\&quot;,\\n     \\&quot;encryptedExpiryYear\\&quot;: \\&quot;test_2030\\&quot;,\\n     \\&quot;encryptedSecurityCode\\&quot;: \\&quot;test_737\\&quot;\\n },\\n \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n \\&quot;merchantAccount\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n \\&quot;lineItems\\&quot;:[\\n    {\\n       \\&quot;description\\&quot;:\\&quot;Golden shoes\\&quot;,\\n       \\&quot;quantity\\&quot;:\\&quot;3\\&quot;,\\n       \\&quot;amountIncludingTax\\&quot;:\\&quot;1000\\&quot;\\n    }\\n ],\\n \\&quot;additionalData\\&quot;:{\\n   \\&quot;riskdata.userType\\&quot;: \\&quot;Guest\\&quot;\\n }\\n}&lt;\\\/code&gt;&lt;\\\/pre&gt;\\n&quot;,&quot;altTitle&quot;:null,&quot;oldTabId&quot;:1,&quot;relation&quot;:&quot;&quot;}]\"\n            :should-update-when-url-changes='false'>\n        <\/tabs>\n    <\/div>\n<\/div>\n\n<ol start=\"2\">\n<li>Take note of the <code>pspReference<\/code> in the payment response.<\/li>\n<li>Log in to your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>.<\/li>\n<li>In the <strong>Search payments<\/strong>, select <strong>Payments<\/strong> and search for the <code>pspReference<\/code> value.<\/li>\n<li>Select the number listed under <strong>Risk score<\/strong> for your payment. A page will open with a breakdown of which fraud checks triggered.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p><a href=\"\/risk-management\/configure-manual-risk\/configure-custom-risk-rules\">Back to top<\/a><\/p>\n<h2>See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/risk-management\/configure-manual-risk\/required-risk-field-reference\"\n                        target=\"_self\"\n                        >\n                    Required risk field reference\n                <\/a><\/li><li><a href=\"\/risk-management\/configure-standard-risk-rules\"\n                        target=\"_self\"\n                        >\n                    Configure standard risk rules\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/risk-management\/configure-manual-risk\/configure-custom-risk-rules","articleFields":{"description":"Build your own custom rules around the unique fraud risks faced by your business.","robots":"noindex,nofollow","id":"27528124","type":"page","_expandable":{"operations":""},"status":"current","last_edit_on":"01-04-2020 11:43","feedback_component":true},"algolia":{"url":"https:\/\/docs.adyen.com\/risk-management\/configure-manual-risk\/configure-custom-risk-rules","title":"Custom risk rules","content":"You can create custom risk rules next to using standard risk rules. Custom risk rules are a RevenueProtect premium feature. You can use these rules to influence the risk score of a transaction, send it to case management, or use the custom rule in combination with Dynamic 3D Secure.\nWith custom rules, you can address risks specific to your business. They provide a flexible way to supplement your risk profile, and can help prevent specific types of potential fraud.\nHere are some examples when creating a custom risk rule might be useful:\n\nYou want a combination of different transaction attributes to influence the risk score. For example, you want to increase the risk score for transactions above a certain amount, using a specific payment method and currency.\nYou want to block a guest shopper from buying too many specific products. This can help prevent reseller fraud.\n\nTo build your custom risk rules:\n\nChoose risk variables: understand which variables you can use in custom risk rules, or create custom fields.\nCreate the rule: set rule conditions to define when the rule should trigger.\nAssign an action to the rule: define what should happen to the transaction when the rule triggers.\n\nStep 1: Choose risk variables\nYou can create your own fields, or choose any of the risk fields provided by Adyen as variables in your custom rule. To trigger the custom risk rule, the fields that you are using in the custom rule have to be included in the payment request. For practical examples, see the example scenarios.\nCreate custom fields\n\nLog in to your\u00a0Customer Area, and stay in your company account.\nGo to Revenue &amp; risk\u00a0&gt; Risk fields.\nUnder Custom fields, select New field, and provide the details for your custom field. The custom field name is case sensitive.\n\nYou assign a value to the custom field when you make payment requests. Submit the custom field name and the value in the additionalData object of the payment request.\n\nThe custom field name that you provide in your payment request is case-sensitive, and must match the name of the custom field that you created.\n\nThe example scenario has example payment requests that include a custom field.\nUse Adyen-provided risk fields\nTo see which Adyen-provided risk fields are available:\n\nLog in to your\u00a0Customer Area and stay in your company account.\nGo to Revenue &amp; risk\u00a0&gt; Risk fields.\nBrowse or search for fields that you can use. The fields are divided in different categories:\n\nShopperDNA fields\nFields that, based on ShopperDNA, relate to payments made by a distinct shopper.\nStandard fields\nFields that are included in the payment request, or that are combinations of fields included in the payment request or checkout session.\nBasket fields\nFields that describe the items or products in the transaction.\nTo be able to use basket fields in custom rules, provide basket item data using the following parameters in your payment request:\n\nCheckout API v69 or earlier:  additionalData.riskdata.basket.item[itemNr]\nCheckout API v70 and later:  lineItems\n\nPromotion fields\nFields that describe a promotion, such as a discount.\nAirline fields\nFields connected to transactions related to air travel.\nVelocity fields\nFields that relate to the number of times a payment containing the same fields occurred within a certain time period.\n\n\nStep 2: Create the rule\nBefore you create a custom risk rule, decide when you want to trigger the rule: before or after authorization.\nWhen you create a risk rule that triggers after authorization, you can take additional details from the authorization response into consideration. Examples of details that are available after authorization are the AVS response, the CVC response, or the liability shift status.\nTo create a custom rule:\n\nLog in to your Customer Area, and switch to the merchant account for which you want to create a custom rule.\nGo to\u00a0Revenue &amp; risk &gt;\u00a0Risk profiles.\nSelect Risk rules &gt; Custom rules.\nSelect + Create new custom rule, and then select Pre-authorization or Post-authorization. The risk fields that you want to use in your custom rule determine if the rule can be triggered before or after authorization.\nEnter a\u00a0Rule Name.\nEnter conditions. You can add conditions to the rule by selecting AND or OR. For each condition, select:\n\nField Name - choose a risk variable, for example a custom field, an Adyen-provided risk field, or a list comparison.\nOperator - how to compare the Field Name and the Field Value. The type of the fields you are comparing defines which operators you can use. For example, you can use \u00a0greater than (&gt;) for numbers, or starts with for strings.\nField Value - value that triggers your rule.\n\nSelect Save to finish creating the rule.\n\nStep 3: Assign an action to the rule\nAfter creating your custom rule, assign the action that you want to take when the rule triggers: modify the risk score, or send to case management.\nTo assign an action for the custom rule you created, configure the risk profile that contains the rule. A risk profile can be assigned to more than one merchant account.\nConfigure the risk profile containing the rule\nYou can configure a risk profile from either:\n\nA company account.\nLog in to your\u00a0Customer Area, and stay in your company account. Select\u00a0Revenue &amp; risk &gt;\u00a0Risk profiles, and select the risk profile containing your custom rule. The risk profile overview page opens.\nA merchant account.\nLog in to your\u00a0Customer Area, and select a merchant account that uses the risk profile containing your custom rule. Select Revenue &amp; risk &gt;\u00a0Risk profiles. The risk profile overview page opens.\n\nRegardless where you configure the risk profile, the changes apply to all merchant accounts using that risk profile.\nAssign an action to the custom rule\nFrom the risk profile overview page:\n\nSelect Risk rules &gt; Custom rules.\nSelect your custom rule.\nAssign an action from the custom rule menu:\n\nIncrease or decrease total risk score by a given value. For more information on fraud scores, see How does the fraud score work?.\nSend to case management for manual review. For more information on how to manually review transactions, see\u00a0Case management.\n\nSelect Save changes.\n\nNow that you have created your custom rule, and assigned an action, you can also use it as one of the risk checks to be applied when configuring Dynamic 3D Secure.\n\nIf you use Dynamic 3D Secure in combination with custom rules, and you copy the risk profile, you have to re-configure any Dynamic 3D Secure rules that use custom rules in the new risk profile.\n\nOptional: Create a custom list comparison\nA custom list comparison lets you compare risk field values against block and trust lists, which includes custom lists. For custom lists you can add expiry dates for list entries. Field values are only compared against list entries that have not expired.\nFor example, in the example scenario Guest user buys too many restricted products, you use a custom list to check if a shopper buys more than two items from a list of restricted items that you define.\nFirst create your custom list containing restricted items. Then create the list comparison that checks if the shopper's basket has any restricted items:\n\n\nCreate your list:\n\nFrom your Customer Area company account, go to Revenue &amp; risk &gt; Risk lists.\nSelect Create new list.\nEnter the list name and select Create list.\n\n\n\nSelect the list you just created and add items to it. You can either:\n\nSelect Add item and provide details for your entry:\n\nItem: The list item. For example, a product title for a restricted item.\nReason: (Optional) Any information useful to you about why the item is part of the list.\nExpire date: (Optional) Expiry date for the list entry. The date must be in the future and if empty, we assign 9999-12-30 23:00:00+01.\n\n\nSelect Upload CSV and upload a CSV file containing your list.\nTo create a CSV file:\n\n\nCreate a spreadsheet file. In the first row of the file, write the following headers: item, reason, and expiredate.\n\n\nIn the next rows, add the item and provide details for your entry in the spreadsheet.\n\nitem: The list item. For example, a product title for a restricted item.\nreason: (Optional) Any information useful to you about why the item is part of the list.\n\nexpiredate: (Optional) Expiry date for the list entry. The date must be in the future and if empty, we assign 9999-12-30 23:00:00+01.\nExample:\n\n\n\nitem\nreason\nexpiredate\n\n\n\n\nSignature shirt\nLimited edition\n2023-11-10\n\n\nGolden shoes\n\n\n\n\nDesigner bag\nLimited edition\n\n\n\nVintage hat\n\n2023-12-30\n\n\n\n\n\n\n\nSave the spreadsheet in CSV format.\n\n\nUpload the CSV file to your custom list.\n\n\n\n\n\n\nDefine the list comparison:\n\nGo to Revenue &amp; risk &gt; Risk fields.\nUnder List comparisons, select New list comparison and provide the details for your comparison:\n\nName: A name for the list comparison. It must not contain spaces.\nDescription: A description of the comparison.\nField for comparison: Select a custom risk field you defined or an Adyen-provided field.\nList: Select a custom list you defined or another block and trust list.\n\nSelect Save.\n\n\n\nWorking with custom rules\nHow a payment request triggers a custom rule\nA custom rule triggers when it meets the conditions, and matches the fields or values that you define in the custom rule. If you want a field or value to trigger the rule, make sure the payment request includes the field that triggers the custom rule.\nMany fields that can be included in a payment request can also be used in custom rules. If you want to use any of these fields in your custom rule, you must provide the required field, and assign a value to it in the payment request. The example scenario has example payment requests that include both Adyen-provided fields and a custom field.\nSome fields and values are automatically extracted, but others have to be specifically provided in the payment request.\nOperators\nWhen you build your custom risk rule, you can use operators to define the rule conditions. You can use AND and OR to add conditions to the custom risk rule.\nThe data type of the field you are building your rule around determines if you can use a specific operator, which and how many values you can enter, and how the fields will be compared.\n\n    \n\n\n\nOperator\nWhen to use\nExample\nData type\nMultiple values\n\n\n\n\nequals (==)\nCompare the field against another field, against a single field value, or verify that the field value is true or false.\nquantity equals (==) 2\nString, Number or Boolean\n\n\n\ndoes not equal (!=)\nCompare the field against another field, against a single field value, or verify that the field value is true or false.\nquantity does not equal (!=) 2\nString, Number or Boolean\n\n\n\nis one of\nCompare the field against multiple field values of a list.\ncurrency is one of EUR, USD, AUD\nString or Number\n\n\n\nis not one of\nCompare the field against multiple field values of a list.\ncurrency is not one of EUR, USD, AUD\nString or Number\n\n\n\ncontains string\nCompare the field value to a specific string.\nemailDomain contains example.com\nString or Number\n\n\n\nstarts with\nCompare the start of the string in the field value to a specific string.\nemailName starts with test\nString\n\n\n\nends with\nCompare the end of the string in the field value to a specific string.\nemailName ends with test\nString\n\n\n\ngreater than (&gt;)\nCompare the field value against a specific value.\namount greater than (&gt;) 1000\nNumber\n\n\n\ngreater than or equals (&gt;=)\nCompare the field value against a specific value.\namount greater than or equals (&gt;=) 1000\nNumber\n\n\n\nless than (&lt;)\nCompare the field value against a specific value.\namount less than (&lt;) 1000\nNumber\n\n\n\nless than or equals (&lt;=)\nCompare the field value against a specific value.\namount less than or equals (&lt;=) 1000\nNumber\n\n\n\n\n\n\n\nBack to Create the rule.\nExample scenarios\nBlock specific high-value transactions\nThe following scenario is an example of a basic custom risk rule that increases the risk score of Mastercard payments if they are above EUR&nbsp;1000 or USD.\nStep 1: Choose risk variables\nYou will use the variables paymentMethod, currency and amount. All of these are standard risk fields. You do not have to create custom fields.\nStep 2: Create the rule\nFor this example scenario:\n\nSelect Pre-authorization when creating the rule.\nName the rule paymentMethodAmountCurrency.\n\nFill in the conditions for the rules, using AND to add conditions:\n\n\n\nField Name\nOperator\nField Value\nCorresponding payment request field\nComment\n\n\n\n\npaymentMethod (String)\nequals (==)\nmc\npaymentMethod\nSee payment method variants to see how to enter the payment method value.\n\n\namount (Number)\ngreater than (&gt;)\n100000\namount\nSpecify the amount in minor units.\n\n\ncurrency (String)\nis one of\nEUR, USD\ncurrency\nSelect each currency from the drop-down list.\n\n\n\n\n\nStep 3: Assign an action\nFor this example scenario, select the custom rule you created, paymentMethodAmountCurrency, and increase the risk score by 100.\nThis custom rule will block all Mastercard transactions above USD or EUR&nbsp;1000.\nA guest user buys too many restricted items\nThe following scenario is an example of how you can set up and use custom rules and custom list comparisons.\nAs a webshop owner you find out certain purchases by a guest user have an increased fraud risk. You decide to build a custom rule to offset this risk.\nYour custom rule adds 20 risk points if the shopper:\n\nIs a guest user.\nIs buying more than 2 items from a list of restricted products.\n\nStep 1: Choose risk variables\nFor this example scenario, you need all variables:\n\nTo use the shopper's basket items in your rule:\n\nProvide basket item data using the following parameters in your payment request:\n\nCheckout API v69 or earlier:  additionalData.riskdata.basket.item[itemNr]\nCheckout API v70 and later:  lineItems\n\n\nFor the user type, you need to create a custom field with the following details:\n\nName: userType\nData type: String\nField description: The type of user making the payment\n\n\nStep 2: Create the rule\nFor this example scenario:\n\nSelect Pre-authorization when creating the rule, because you are using custom lists which can only be used before authorization.\nName the rule guestBuysTooManyRestrictedProducts.\n\nFill in the conditions for the rules, using AND to add conditions:\n\n\n\nField Name\nOperator\nField Value\nCorresponding payment request field\n\n\n\n\nuserType (String)\nequals (==)\nGuest\n riskdata.userType\n\n\nquantity (Number)\ngreater than (&gt;)\n2\nCheckout API v69 and earlier:  riskdata.basket.item#.quantityCheckout API v70 and later:   lineItems.quantity\n\n\nrestrictedProduct (Boolean)\nequals (==)\nTrue\nCheckout API v69 and earlier:  riskdata.basket.item#.productTitleCheckout API v70 and later:  lineItems.description\n\n\n\n\n\nStep 3: Assign an action\nFor this example scenario, select the custom rule you created, guestBuysTooManyRestrictedProducts, and increase the risk score by 20.\nMandatory for this scenario: create a custom list comparison\nTo check the items in the shopper's basket against your list of restricted products, you need to create a custom list comparison.\nThat means you have to create custom list comparison, and create a custom list called Restricted items.\nCreate a custom list comparison:\n\nName: restrictedProduct\nDescription: Check if a shopper is buying any items with a restricted product title.\nField for comparison: productTitle, an Adyen-provided risk field. You assign the value of this field when you make a payments request. For an example, see the Test the rule section.\nList: Restricted items, the custom list you created.\n\nStep 5: Test the rule\nThe following example  \/payments requests are based on the example scenario Guest user buys too many restricted products.\n\nMake a POST request to the  \/payments endpoint, including the risk fields that your custom rule uses:\n\n\n\n    \n        \n        \n    \n\n\n\nTake note of the pspReference in the payment response.\nLog in to your Customer Area.\nIn the Search payments, select Payments and search for the pspReference value.\nSelect the number listed under Risk score for your payment. A page will open with a breakdown of which fraud checks triggered.\n\n\n\nBack to top\nSee also\n\n\n                    Required risk field reference\n                \n                    Configure standard risk rules\n                \n","type":"page","locale":"en","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Risk management","lvl2":"Configure classic risk profiles","lvl3":"Custom risk rules"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/","lvl1":"https:\/\/docs.adyen.com\/risk-management","lvl2":"https:\/\/docs.adyen.com\/risk-management\/configure-manual-risk","lvl3":"\/risk-management\/configure-manual-risk\/configure-custom-risk-rules"},"levels":4,"category":"Risk Management","category_color":"green","tags":["Custom","rules"]}}
