ClickandBuy的简单PHP SOAP请求?

时间:2012-06-02 20:29:42

标签: php soap payment

ClickandBuy提供了大量样本,但它们的编码和编码都很差。所以我认为应该有一个简单的PHP 5 SOAP解决方案,用于简单的SOAP payRequest,在SoapClient类中使用PHP5构建。

$client = new SoapClient('https://api.clickandbuy.com/webservices/pay_1_1_0.wsdl', array('encoding' => 'UTF-8'));
$client->payRequest(array('authentication'=>array(...), 'details'=>array(...)));

可以使用,但会返回错误:

SOAP-ERROR:编码:对象没有'description'属性

payRequest方法的参数应该没问题。有没有人尝试在没有NuSOAP的情况下实现ClickandBuy?

1 个答案:

答案 0 :(得分:1)

尝试将description属性添加到details数组中:

 $client->payRequest(array('authentication'=>array(...), 
    'details' => array(
      'description' => 'paying for shoes'
    )
));

样品申请:

  <?xml version="1.0" encoding="UTF-8"?> 
  <payRequest_Request xmlns="http://api.clickandbuy.com/webservices/pay_1_1_0/">
    <authentication>
       <merchantID>4000</merchantID>
       <projectID>1</projectID>
       <token>20100623104511::9E9C3E21FE38851B8913469F13619BD645BA1DD6</token> 
    </authentication>
    <details>
      <amount>
        <amount>1</amount> 
        <currency>EUR</currency>  
      </amount>
      <orderDetails>
         <text>My Cart</text>
      </orderDetails> 
      <successURL>http://www.mydomain.com/success.php</successURL>
      <failureURL>http://www.mydomain.com/failure.php</failureURL>
      <externalID>Test123</externalID>  
    </details> 
 </payRequest_Request>