ColdFusion中的Visa Payment Gateway API

时间:2016-07-02 17:29:24

标签: coldfusion payment-gateway cfhttp cfhttpparam

我在PHP中有一个Visa Payment Gateway示例:

$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);

我正在尝试将PHP代码转换为ColdFusion。如何通过CURLOPT_SSLKEY传递cfhttpparam选项?到目前为止,这是我的代码:

<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结果输出: enter image description here

0 个答案:

没有答案