Visa Payment Gateway API in ColdFusion

250 Views Asked by At

I have a Visa Payment Gateway example in PHP:

$authString = $userId.":".$password;
$authStringBytes = utf8_encode($authString);
$authloginString = base64_encode($authStringBytes);
$authHeader = "Authorization:Basic ".$authloginString;
echo "<strong>URL:</strong><br>".$url. "<br><br>";
$header = (array("Accept: application/json", "Content-Type: application/json", $authHeader));

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBodyString); 
curl_setopt($ch, CURLOPT_SSLCERT, $certificatePath);
curl_setopt($ch, CURLOPT_SSLKEY, $privateKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

I am trying to convert the PHP code to ColdFusion. How can I pass the CURLOPT_SSLKEY option via cfhttpparam? This is my code so far:

<cfhttp method="get" url="https://sandbox.api.visa.com/vdp/helloworld" 
        clientcert="C:\ColdFusion10\cfusion\wwwroot\visa\myapp_keyAndCertBundle.p12"
        clientcertpassword="theCertPassword" 
        result="res">

    <cfhttpparam type="header" name="Accept" value="application/json">
    <cfhttpparam type="header" name="Content-Type" value="application/json" />  
    <cfhttpparam type="body" value="Authorization:Basic#authloginString#">
</cfhttp>

cfhttp result output: enter image description here

0

There are 0 best solutions below