{"section":"tutorials","requestedLocale":"en","requestedSlug":"configuring-clearsale-v3-antifraud","locale":"en","slug":"configuring-clearsale-v3-antifraud","path":"docs/en/tutorials/payments/payment-settings/configuring-clearsale-v3-antifraud.md","branch":"main","content":"At VTEX, it is possible to integrate with ClearSaleV3 [anti-fraud](/en/docs/tutorials/how-to-configure-the-anti-fraud). Through this system, it is possible to increase the level of security in payment transactions carried out in your store using risk analyzes that identify possible fraud.\nPara configurar o ClearSaleV3, siga os passos abaixo:\n\nTo configure ClearSaleV3, follow the steps below:\n\n1. In the VTEX Admin, go to __Store Settings > Payment > Providers__, or type __Providers__ in the search bar at the top of the page.\n2. On the providers screen, click the `New Provider` button.\n3. Type the name __ClearSaleV3__ in the search bar and click on the name of the provider.\n4. If you wish to modify the identification name to be displayed for the ClearSaleV3 provider on the VTEX Admin screen, enter the information in the __Name__ field in __Basic Information__.\n5. In __Payment Control__, select whether you want to activate the provider in a test environment by clicking __Enable test mode__.\n6. Fill in the information below according to your ClearSale settings:\n<ul>\n  <li>**Login**: Login.</li>\n  <li>**Password**: Password.</li>\n  <li>**Custom SLA in minutes (optional)**: Period in which ClearSale will have to process the fraud analysis.</li>\n  <li>**Product (optional)**: Numeric value. Corresponds to the product ID contracted on ClearSale.</li>\n  <li>**Transaction currency**: Currency in which the transaction is carried out.</li>\n  <li>**Observation (optional)**: Text that will be sent to ClearSale as a remark.</li>\n  <li>**Send authenticated transactions?**: Indicates whether payment transactions must be authenticated with a password in the 3DSecure program.</li>\n</ul>\n7. Click `Save`.\n\n> ℹ️ If you have a mobile application that uses VTEX APIs at checkout, it is necessary to implement fingerprint data collection to be sent to Clearsale, according to the platform used by the application. Find out more at [Clearsale Behavior Analytics](https://api.clearsale.com.br/docs/behavior-analytics). With the SDK implementation, it is necessary to collect the <span class=\"bg-muted-4\">sessionId</span> value and send it in the <span class=\"bg-muted-4\">deviceFingerprint</span> via [API when creating the payment](https://developers.vtex.com/docs/api-reference/payment-provider-protocol#post-/payments).\n\n## Creating a Google Tag Manager tag\n\nConfiguring ClearSale v3 anti-fraud solution requires creating a tag in Google Tag Manager, as described in the following steps:\n\n1. Sign in to your [Google Tag Manager](https://tagmanager.google.com/) account.\n2. Click on __Tag__ and then on __New__.\n3. Choose the product __Personalized HTML Tag__.\n4. Enter the following script, replacing `your-app` with the identifier sent to you by ClearSale (between single quotes):\n\n  ```\n    var deviceFingerprintIdCSV4 = 10000000 + Math.floor(Math.random() * 99999999);\n    (function (a, b, c, d, e, f, g) {\n    a['CsdpObject'] = e; a[e] = a[e] || function () {\n    (a[e].q = a[e].q || []).push(arguments)\n    }, a[e].l = 1 * new Date(); f = b.createElement(c),\n    g = b.getElementsByTagName(c)[0]; f.async = 1; f.src = d; g.parentNode.insertBefore(f, g)\n    })(window, document, 'script', '//device.clearsale.com.br/p/fp.js', 'csdp');\n    csdp('app', 'your-app');\n    csdp('sessionid', deviceFingerprintIdCSV4);\n    window.vtex.deviceFingerprint = deviceFingerprintIdCSV4;\n  ```\n\n5. Check the option __Support for document.write__.\n6. In __Trigger In__, select the option __More__ and click on __New__.\n7. Allocate a name to this trigger and choose the event type __Personalized Event__.\n8. In __Trigger In__, define the name of the event as __payment__.\n9. Save the trigger.\n10. Click on the __Create Tag__ button, enter a name for this tag and save.\n11. In the top right corner, click on __Publish__.\n\n![Pasted image at 2017 10 20 01 11 PM](https://cdn.statically.io/gh/vtexdocs/help-center-content/refs/heads/main/docs/en/tutorials/payments/payment-settings/configuring-clearsale-v3-antifraud_1.png)\n\n> ℹ️ See the [ FingerPrint documentation](https://api.clearsale.com.br/docs/finger-print) on ClearSale for more information on the above script.\n\n## CustomSLA field details\n\nThe value entered in the **Custom SLA in minutes** field when configuring the anti-fraud solution is one of the three possible values for the `customSLA` field. If the cart is empty, the `customSLA` value will be the value of the `shippingEstimate` field for the transaction cart. If the cart has at least one item, the `customSLA` value will be the lowest value between the `deliverySlaInMinutes` value of the first item in the cart and the **Custom SLA in minutes** value used when configuring the anti-fraud solution.\n\nThe `shippingEstimate` and `deliverySlaInMinutes` values correspond to the delivery time and are generated at checkout from information in the Logistics module. The calculation of the delivery time is explained in the article [How is the delivery time is calculated?](/en/docs/tutorials/how-is-the-order-delivery-deadline-calculated).\n\nThe `shippingEstimate` value is obtained from a calculation made by the Logistics module. The value is followed by a letter, which represents the time unit used. The letters are:\n\n- `d` for calendar days or `bd` for working days if the time is zero or at least 24 hours.\n- `h` for hours if the time is less than 24 hours and at least 2 hours.\n- `m` for minutes if time is less than 2 hours.\n\nThe `shippingEstimate` field can be obtained from the `shippingData.logisticsInfo[]` items in the [Get Order](https://developers.vtex.com/docs/api-reference/orders-api#get-/api/oms/pvt/orders/-orderId-) endpoint response.\n\nThe `deliverySlaInMinutes` value is the conversion of `shippingEstimate` into minutes. If the unit is `m` (minutes), the value will be the same. If the unit is `h` (hours), the value is multiplied by 60, and if the unit is `d` (calendar days) or `bd` (working days), the value is multiplied by 1440. For example, three calendar days or `3d` is represented as `4320`. The `deliverySlaInMinutes` field is used in each item of the `minicart` in the request body of the [Send Antifraud Pre-Analysis Data](https://developers.vtex.com/docs/api-reference/antifraud-provider-protocol#post-/pre-analysis) and [Send Antifraud Data](https://developers.vtex.com/docs/api-reference/antifraud-provider-protocol#post-/transactions) endpoints.\n\n> ℹ️ Although the time conversion in calendar days (`d`) and working days (`bd`) to minutes is the same in the `deliverySlaInMinutes` field, the delivery date may be different depending on the calendar (when there are weekends and holidays within the delivery window)."}