我一直在尝试安全地实施 Payment Pro 3D,但卡在了一个点上。我遵循了 Paypal 提供的文档。但我想我需要一些认真的指导。
除了颁发者身份验证响应中显示的以下表单的 html 响应外,我什么也没得到。
当我尝试提交表单时,URL 重定向到: http://localhost/dodirect3d/NextV3DSRequest;jsessionid=Yc8GvrWh2KcnMK1Y
我使用了 CardinalCommerce Corporation 提供的类文件。
以下是我遵循的程序:
<h1>CheckOut</h1>
<form action="" method="post">
<table>
<tr>
<th>Amount</th>
<td><input type="number" name="Amount" value="10000"></td>
</tr>
<tr>
<th>Card Number</th>
<td><input type="number" name="CardNumber" value="4000000000000002"></td>
</tr>
<tr>
<th>Expiry Date</th>
<td>
<input type="number" name="CardExpMonth" placeholder="MM" value="01">
/
<input type="number" name="CardExpYear" placeholder="YYYY" value="2016">
</td>
</tr>
</table>
<button type="submit">Submit</button>
</form>
<?php
if ($_POST) {
require('CentinelClient.php');
require('CentinelConfig.php');
require('CentinelUtility.php');
$centinelClient = new CentinelClient;
$centinelClient->add("MsgType", "cmpi_lookup");
$centinelClient->add("Version", CENTINEL_MSG_VERSION);
$centinelClient->add("ProcessorId", CENTINEL_PROCESSOR_ID);
$centinelClient->add("MerchantId", CENTINEL_MERCHANT_ID);
$centinelClient->add("TransactionPwd", CENTINEL_TRANSACTION_PWD);
$centinelClient->add("TransactionType", "C");
//$centinelClient->add('IPAddress', $_SERVER['REMOTE_ADDR']);
$centinelClient->add('IPAddress', "127.0.0.1");
// Standard cmpi_lookup fields
$centinelClient->add('Amount', $_POST['Amount']);
$centinelClient->add('CurrencyCode', "826"); // For example, GBP = 826, EUR = 978.
$centinelClient->add('OrderNumber', rand(1111, 9999));
// Payer Authentication specific fields
$centinelClient->add('CardNumber', $_POST['CardNumber']);
$centinelClient->add('CardExpMonth', $_POST['CardExpMonth']);
$centinelClient->add('CardExpYear', $_POST['CardExpYear']);
/* * ******************************************************************************* */
/* */
/* Send the XML Msg to the MAPS Server, the Response is the CentinelResponse Object */
/* */
/* * ******************************************************************************* */
$centinelClient->sendHttp(CENTINEL_MAPS_URL, CENTINEL_TIMEOUT_CONNECT, CENTINEL_TIMEOUT_READ);
$response = $centinelClient->response;
echo '<h2>cmpi_lookup Response</h2>';
echo '<pre>';
print_r($response);
echo '</pre>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $response['ACSUrl']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(
array(
'PaReq' => $response['Payload'],
'TermUrl' => CENTINEL_TERM_URL,
'MD' => ''
)
)
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response_IssuerAuthentication = curl_exec($ch);
curl_close($ch);
echo '<h2>Issuer Authentication Response</h2>';
print_r($response_IssuerAuthentication);
}
?>