如何在PHP中集成大通支付网关


how to integrate chase payment gateway in php?

当我发布值时,我得到的响应是20400Invalid Request1 .根据文档http://www.ballwin.mo.us/images/file/3%20Certifcation%20FAQ.pdf

13. 为什么我会收到"20400 无效请求"错误?这是一个 Apache 服务器错误,意思是"无法显示页面"。这通常表示网关服务不可用。投入生产后联系网关支持

我不明白错误代表什么

<?php
$url = "https://orbitalvar2.paymentech.net"; // testing
//$url = "https://orbital1.paymentech.net"; // production
$post_string="
<?xml version='"1.0'" encoding='"UTF-8'"?>
<Request>
<MarkForCapture>
<OrbitalConnectionUsername>*****</OrbitalConnectionUsername>
<OrbitalConnectionPassword>*****</OrbitalConnectionPassword>
<OrderID>123456782</OrderID>
<Amount>100</Amount>
<BIN>000002</BIN>
<MerchantID>**********</MerchantID>
<TerminalID>001</TerminalID>
<TxRefNum>4F320B79F23280DAE62777C80721F838FF13548D</TxRefNum>
</MarkForCapture>
</Request>";
$header= "POST /authorize/ HTTP/1.0'r'n";
$header.= "MIME-Version: 1.0'r'n";
$header.= "Content-type: application/PTI53'r'n";
$header.= "Content-length: " .strlen($post_string) . "'r'n";
$header.= "Content-transfer-encoding: text'r'n";
$header.= "Request-number: 1'r'n";
$header.= "Document-type: Request'r'n";
$header.= "Interface-Version: Test 1.4'r'n";
$header.= "Connection: close 'r'n'r'n";
$header.= $post_string;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
$data = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
} else {
curl_close($ch);
}
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser,XML_OPTION_CASE_FOLDING,0);
xml_parser_set_option($xml_parser,XML_OPTION_SKIP_WHITE,1);
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);
print ($data);
?>

普莱塞帮帮我.提前谢谢。

我相信

您收到此错误是因为您使用了不正确的编码标头。

更改此行:

$header.= "Content-transfer-encoding: text'r'n";

自:

$header.= "Content-transfer-encoding: 8BIT'r'n";

这可能会解决您的问题。

如果没有,也尝试在 $post_string 上使用 utf8_encode() 将 XML 显式转换为 UTF-8。