PURPOSE

When integrating through the direct or CSE route, merchants can use either a HTML form to redirect the cardholder to the ACS URL, or JavaScript. 

 

CAUSE

APEXX recommend that merchants use JS to manage the redirect to avoid unexpected responses from the ACS server.


SAMPLE CODE


Add the below in the HTML page:

<form name="redirectForm" id="redirectForm" action="" method="POST">
  </form>



After receiving the 3DS enrolment response from APEXX, add below JS code

 $('#redirectForm').attr('action', response.three_ds.acsURL);
        $('#redirectForm').append('<input type="hidden" id="PaReq" name="PaReq" value="'+response.three_ds.paReq+'" />');
        $('#redirectForm').append('<input type="hidden" id="TermUrl" name="TermUrl" value="'+response.three_ds.term_url+'"/>');
        $('#redirectForm').append('<input type="hidden" id="MD" name="MD" value="'+response.three_ds.psp_3d_id+'" />');
        // Redirect customer to acsURL for 3DS Payment
        setTimeout(function() {
          document.redirectForm.submit();  
        }, 300);



RELATED ARTICLES

3DS - APEXX API Documentation