3DS Integration Guide
Integrating the 3DSecure in the Forter Cartridge
In order to integrate with 3DS recommendations, merchants will need to modify their ForterOrder.ds file to handle a new "recommendation" field in the response body as well as to pass additional 3DS authorization response data in the post-authorization request body.
1. Updates to API Schema
Once you've confirmed a 3DS integration with your dedicated Forter Implementations team, they will modify the schema to include additional fields in the request body payment[0].creditCard object and enable the exposure of a "recommendations" key in the response object returned by Forter in the pre-authorization call.
Your Implementation team will direct you to the relevant API version and you can specify which version you should point to in the cartridge in the cartridges > int_forter > cartridge > scripts > init > forterServiceInit.js file of your cartridge by modifying the default Option .86 in svc.addHeader("api-version", "Option .86");
2. Enable Pre-Auth
Go to the CheckoutServices.js file in your Forter Cartridge. The exact path to this file is: Cartridges > int_forter_sfra > cartridge > controllers > CheckoutService.js.
Open this file and uncomment the following code AFTER the var order = COHelpers.createOrder(currentBasket); function and BEFORE the var handlePaymentResult = COHelpers.handlePayments(order, order.orderNo); function in the file.
3. Update your Business Manager
The additional code that you have added above to your CheckoutServices.js file allows your storefront to send order information to the Forter endpoint BEFORE an authorization call is made to your payment gateway.
You will also need to update your Forter Business Manager extension to show a customized error message (in cases of decline) for this updated Pre-Authorization Flow.
4. Handle Recommendations
You will need to add logic in your Forter SFCC cartridge to handle the new, "recommendation" field that will be included in the Forter response for orders that require 3DS.
Merchants should make sure to include logic to handle all possible iterations of both the decisions and recommendations within their Forter cartridge (ForterValidate.js) and within their gateway cartridge to ensure that orders are correctly routed after receiving a pre-authorization decision and recommendation from Forter.
- In the case of 3DS for regulation, the Forter pre-Authorization decision ("action") will be an "approve" along with a populated "recommendations" field.
- In the case of 3DS for risk assessment, the Forter pre-Authorization decision ("action") will be a "decline" along with a populated "recommendations" field
In your SFCC cartridge, go to the forterValidate file, cartridges/int_forter_sfra/cartridge/scripts/pipelets/forter/forterValidate.js and add logic to handle both the decision and recommendation in cases where the recommendation field is populated with a value other than an empty string ("").
Possible Recommendation values are:
- "VERIFICATION_REQUIRED_3DS_CHALLENGE"
- "" (when Forter does NOT recommend any 3DS or Exemption due to clear Approve)
- "REQUEST_SCA_EXCLUSION_MOTO"
- "REQUEST_SCA_EXCLUSION_PREPAID"
- "RECOMMENDATION_REQUEST_SCA_EXCLUSION_ONE_LEG_OUT"
- "REQUEST_SCA_EXCLUSION_ONE_LEG_OUT"
- "REQUEST_SCA_EXCLUSION_MIT"
- "REQUEST_SCA_EXEMPTION_TRA"
- "RECOMMENDATION_REQUEST_SCA_EXEMPTION_LOW_VALUE"
- "REQUEST_SCA_EXEMPTION_LOW_VALUE"
- "REQUEST_SCA_EXEMPTION_CORP"
- "RECOMMENDATION_REQUEST_SCA_EXEMPTION_TRUSTED_BENEFICIARY"
- "REQUEST_SCA_EXEMPTION_TRUSTED_BENEFICIARY"
The logic should be modified within the validateOrder(args) function around line 137 where the current options and logic for handling decisions and response body fields is located:
5. Code Modifications to payment Gateway Cartridge
As seen in the above example, you'll need to modify your SFCC site preferences dw > system > Site to handle the new "recommendations" field in the response body. In the example above, the fucntionality is called initiate3DSChallenge. This functionality should allow your SFCC platform to accept a recommendation and trigger a 3DS challenge from your payment gateway.
Each gateway has different 3DS challenge requirements and configurations. It will be incumbant on each merchant to handle the integration of the recommendation into their gateway and configure the relevant 3DS challenge to a customer based on the recommendation provided by Forter.
6. Post-Auth Options
For a second, synchronous post-auth decision, you will need to update the mapping in your ForterOrder.ds file to include the authorization and 3DS response data from your gateway and make sure your ForterValidate.js file also handles the second post-auth Forter decision.
For an post-auth order status call without a new Forter decision ("action"), you'll modify the ForterUpdate.js job and authorization response mapping in the corresponding ForterPayment() function.
Option 1: Post-Auth Validation Call
After the gateway has successfully initiated 3DS and authorized payment (or rejected payment), the results should be included in the post-authorization call to the Forter cartridge. These fields should be added to the ForterCreditCard(auth, cc) function mapping of your ForterOrder.ds file. This flow is applicable for merchants who may not be receiving a Forter payment recommendation (3DS or PSD2) but want to provide Forter's models with the payments outcome from their processor.
Option 2: Post-Auth Order Status Call
Step 1: Include Post-Auth Status Update script The example Authorize.net script below outlines how to update the script that handles credit card processing so that it includes the relevant post-authorization and 3DS order status call to Forter. Note that the two default order statuses are:
- "PROCESSING" (when the gateway has authorized the payment)
- "CANCELED_BY_MERCHANT" (when the gateway/processor has NOT authorized payment)
The code example below applies to all SFRA and SG pre-auth/status implementations and the full postAuthOrderStatusUpdate() function can be found in forterValidate.js file (cartridges > int_forter_sfra > cartridge > scripts > pipelets > forter > forterValidate.js)
var argOrderUpdate = {
orderNumber: orderNumber,
updateAttempt: 1
},
forterCall = require('*/cartridge/scripts/pipelets/forter/forterValidate'),
forterDecision = forterCall.postAuthOrderStatusUpdate(argOrderUpdate, "PROCESSING");
if (forterDecision.result === false && forterDecision.updateAttempt == Option ) {
forterDecision.updateAttempt = Option ;
forterCall.postAuthOrderStatusUpdate(argOrderUpdate, "PROCESSING");
}
Step 2: Customize ForterUpdate.js file After uncommenting the pre-auth code CheckoutServices.js file, customize the forterUpdate.js file to include your gateway's authorization AND 3DS response in the status call to Forter. The exact path to the forterUpdate.js file is cartridges > int_forter_sfra > cartridge > scripts > lib > forter > dto > forterUpdate.js). Customize the ForterPayment(payment, order) function to map your specific gateway authorization response.