【发布时间】:2012-07-06 12:06:33
【问题描述】:
我正在尝试使用水星支付系统发送 API 请求,作为回报,我得到了一个支付 ID。 根据他们的文档,在获得付款 ID 后,我们必须将其作为邮件发送到他们的付款流程主机 https://hc.mercurydev.net/CheckoutPOS.aspx 我被重定向到金额未正确显示的页面。 有什么建议吗?
以下是请求API
function get_ms_payment_id($ms_merchant_id,$ms_password,$order_header_id,$amount,$tax,$success_url,$failure_url)
{
$soap_request = '<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">';
$soap_request .= '<SOAP-ENV:Body>';
$soap_request .= '<InitializePayment xmlns="http://www.mercurypay.com/">';
$soap_request .= '<request> ';
$soap_request .= '<MerchantID>'.$ms_merchant_id.'</MerchantID> ';
$soap_request .= '<Password>'.$ms_password.'</Password> ';
$soap_request .= '<Invoice>'.$order_header_id.'</Invoice> ';
$soap_request .= '<TotalAmount>50.23</TotalAmount>';
$soap_request .= '<TaxAmount>'.$tax.'</TaxAmount>';
$soap_request .= '<TranType>Sale</TranType> ';
$soap_request .= '<Frequency>OneTime</Frequency>';
$soap_request .= '<Memo>Your Memo</Memo> ';
$soap_request .= '<PartialAuth>Off</PartialAuth> ';
$soap_request .= '<ProcessCompleteUrl>'.$success_url.'</ProcessCompleteUrl> ';
$soap_request .= '<ReturnUrl>'.$failure_url.'</ReturnUrl> ';
$soap_request .= '<DisplayStyle>Custom</DisplayStyle>';
$soap_request .= '<BackgroundColor>Gray</BackgroundColor>';
$soap_request .= '<FontColor>Black</FontColor>';
$soap_request .= '<FontFamily>FontFamily1</FontFamily>';
$soap_request .= '<FontSize>Medium</FontSize>';
$soap_request .= '<PageTitle>Demo Ecommerce Merchant</PageTitle>';
$soap_request .= '<SecurityLogo>on</SecurityLogo>';
$soap_request .= '<OrderTotal>on</OrderTotal>';
$soap_request .= '<SubmitButtonText>Submit</SubmitButtonText>';
$soap_request .= '<CancelButtonText>Cancel</CancelButtonText>';
$soap_request .= '</request> ';
$soap_request .= '</InitializePayment>';
$soap_request .= '</SOAP-ENV:Body>';
$soap_request .= '</SOAP-ENV:Envelope>';
$header = array("POST /ws/ws.asmx HTTP/1.1",
"Host: w1.mercurypay.com",
"Content-Type: text/xml; charset=utf-8",
"SOAPAction: \"http://www.mercurypay.com/InitializePayment\"");
$url = "https://hc.mercurydev.net/hcws/hcservice.asmx";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_POSTFIELDS, $soap_request);
$result = curl_exec($ch);
include_once('xml.php');
$x_data = XML_unserialize($result);
$x_data = $x_data["soap:Envelope"];
$x_data = $x_data["soap:Body"];
$x_data = $x_data["InitializePaymentResponse"];
$result = $x_data["InitializePaymentResult"];
return($result);
}
作为回应,我得到了一个有效的 paymentId,在使用 paymentId 后,我将其发布到支付网关 但支付网关上没有填充适当的金额。
以下是支付网关的截图
http://screencast.com/t/FbULkAy01X0L
谢谢
【问题讨论】:
-
给我们看一些代码,请求,一些东西!
-
感谢您的垂询。你已经很好地阐述了这个问题并提供了很好的例子。只要再多一点数据,我们应该能够解决这个问题。您可以将您的 HTML 表单帖子发送到 DevelopSupportNotify@MercuryPay.com 吗?通过一些额外的沟通,我相信我们可以更轻松地确定问题所在并找到解决方案。谢谢开发者支持 Mercury 支付系统
-
你从哪里得到的示例代码?
标签: php payment-gateway payment