If you integrate using the server to server method, you would need to handle the redirect of the customer to their bank's 3DSecure page, and then wait for the response on the outcome. 


The payment process is asynchronous because the customer is redirected to their banks 3D secure page to authenticate the payment.


You can then display an appropriate message from your systems, to the customer on the frontend. The ShopperResultURL is important for this communication.


CopyAndPay widget handles this asychronous workflow out-of-the-box. However for Server to server, you would need to implement as below :



1. Send initial payment request.


This will return the 3D Secure redirect url as well as the 3D Secure parameters and their values. Below is a sample response with 3D redirect parameters.


 "id":"8ac7a4a2708062d701708181b7a8402b",
  "paymentType":"DB",
  "paymentBrand":"VISA",
  "result":{
    "code":"000.200.000",
    "description":"transaction pending"
  },
  "card":{
    "bin":"411111",
    "last4Digits":"1111",
    "holder":"Jane Jones",
    "expiryMonth":"05",
    "expiryYear":"2020"
  },
  "redirect":{
    "url":"https://test.ppipe.net/connectors/demo/simulator.link?ndcid=8a8294174e735d0c014e78cf26461790_30f6409e8b9643259fa2d0ecbc79347f&REMOTEADDRESS=10.71.36.34",
    "parameters":[
      {
        "name":"connector",
        "value":"THREEDSECURE"
      },
      {
        "name":"MD",
        "value":"8ac7a4a2708062d701708181b7f34032"
      },
      {
        "name":"PaReq",
        "value":"IT8ubu+5z4YupUCOEHKsbiPep8UzIAcPKJEjpwGlzD8#NDExMTExMTExMTExMTExMSM5Mi4wMCBaQVIj"
      },
      {
        "name":"TermUrl",
        "value":"https://test.ppipe.net/connectors/asyncresponse_simulator;jsessionid=60DB67F39CBE98FC6CC469A1BE095ABB.uat01-vm-con03?asyncsource=THREEDSECURE&ndcid=8a8294174e735d0c014e78cf26461790_30f6409e8b9643259fa2d0ecbc79347f"
      }
    ]
  },
  "risk":{
    "score":"100"
  },
  "buildNumber":"88f50db9d2065c23a84dea4c9e6a6a81dc205921@2020-02-25 17:06:59 +0000",
  "timestamp":"2020-02-26 12:38:46+0000",
  "ndc":"8a8294174e735d0c014e78cf26461790_30f6409e8b9643259fa2d0ecbc79347f"
}


 



2. Redirect the shopper to the 3D Secure Page by parsing the redirect url and parameters into a form.


Please see some sample code below. Please note that the parameters and their values may change with each payment

<html><head>

    <meta charset="utf-8">

</head>

<body onload="document.form.submit();">

    <form name="form" action="" target="_self" method="POST">

        <input type="hidden" name="MD" value=""/>

        <input type="hidden" name="PaReq" value="="/>

        <input type="hidden" name="TermUrl" value=""/>

        <input type="hidden" name="connector" value="THREEDSECURE">

        <script>

            <input type="submit" value="Click here to continue" />

        </script>

    </form>

</body>

</html>


For LIVE, note you need to remove the "connector" input



<html><head>

    <meta charset="utf-8">

</head>

<body onload="document.form.submit();">

    <form name="form" action="" target="_self" method="POST">

        <input type="hidden" name="MD" value=""/>

        <input type="hidden" name="PaReq" value="="/>

        <input type="hidden" name="TermUrl" value=""/>

        <script>

            <input type="submit" value="Click here to continue" />

        </script>

    </form>

</body>

</html>


 



3. The payment status is returned to you in JSON format.


The payment response for a successful payment in the TEST system will always have a result code of 000.100.110. In the LIVE system, the result code is 000.000.000. Any other result code besides this is a failed payment. Below is the JSON response for a successful payment in the TEST system: 


{
"id":"8a8294495afbd2e3015aff726b642a8f",
"paymentType":"DB",
"paymentBrand":"VISA",
"amount":"92.00",
"currency":"ZAR",
"descriptor":"4195.9294.6338 OPP_Channel",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"card":{
"bin":"411111",
"last4Digits":"1111",
"holder":"Natalie",
"expiryMonth":"12",
"expiryYear":"2017"
},
"threeDSecure":{
"eci":"05",
"verificationId":"AAACAgSRBklmQCFgMpEGAAAAAAA=",
"xid":"CAACCVVUlwCXUyhQNlSXAAAAAAA="
},
"customParameters":{
"CTPE_DESCRIPTOR_TEMPLATE":""
},
"risk":{
"score":"100"
},
"buildNumber":"38eae4de39e48cd5449b8ca8a087641065defcb2@2017-03-23 13:23:41 +0000",
"timestamp":"2017-03-24 08:33:09+0000",
"ndc":"FB641B5447DC6AD637BB7955B44489E3.sbg-vm-tx01"
}