我以前没有使用过SOAP API。 我想执行带有XML数据请求的SOAP API。 我试过但没有成功。 https://www.getpayments.com/docs/#processrealtimetokenpayment 这是我想要调用的支付网关URL。
我使用了以下代码:
$xml = '<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:px="https://px.ezidebit.com.au/">
<soapenv:Header />
<soapenv:Body>
<px:ProcessRealtimeTokenPayment>
<px:digitalKey>715C0799-307B-4BF4-7B1D-4153201FC0A1</px:digitalKey>
<px:token>3723758</px:token>
<px:paymentAmountInCents>1600</px:paymentAmountInCents>
<px:customerName>Hiren Patel</px:customerName>
<px:paymentReference>123456789</px:paymentReference>
</px:ProcessRealtimeTokenPayment>
</soapenv:Body>
</soapenv:Envelope>';
$soapUrl = "https://api.demo.ezidebit.com.au/v3-5/pci?singleWsdl";
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, $soapUrl );
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true );
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $xml);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($xml) ));
$result = curl_exec($soap_do);
$err = curl_error($soap_do);
curl_close($soap_do);
echo "<pre>";print_r($result);
die;
它抛出以下错误:
a:操作不支持带有操作的消息 "处理实时令牌支付"无法在接收方处理,由于 到端点调度程序的合约过滤器不匹配。这可能是 由于合同不匹配(不匹配 之间的操作 发送方和接收方(或发送方之间的绑定/安全不匹配 和接收器。 检查发送方和接收方是否相同 合同和相同的约束(包括安全要求,例如 消息,传输,无(。卷曲调用成功。
请问任何人都可以指导我吗? 提前谢谢你。
下面是SoapClient的示例:
<?php
$soap = new SoapClient(
'https://api.demo.ezidebit.com.au/v3-5/pci?singleWsdl',
array(
'trace' => 1,
'exceptions' => 1
)
);
$soap->ProcessRealtimeCreditCardPayment(
array(
'DigitalKey' => '715C0799-307B-4BF4-7B1D-4153201FC0A1',
'Token' => '3723758',
'PaymentAmountInCents' => '1600',
'CustomerName' => 'Hiren Patel',
'PaymentReference' => '123456789'
)
);
echo $soap->__getLastRequest() . "n";
echo $soap->__getLastResponse() . "n";
您可以将其保存到文件中并使用以下命令运行:
php file.php