肥皂请求使用php curl barclays soap api付款

时间:2017-10-27 12:38:02

标签: php web-services curl soap

我已经完成了使用Barclays SOAP API Payments发布付款的任务。阅读完文件后,他们会给出肥皂申请的测试网址,并测试信用卡号码。我在下面使用过,但它并没有做什么。根本没有收到回复或没有收到任何回复。

    $requestXML = "<?xml version='1.0'?>
        <soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
        xmlns:xsd='http://www.w3.org/2001/XMLSchema'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
        <soap:Body>
            <ns1:authorise xmlns:ns1='http://payment.services.adyen.com'>
                <ns1:paymentRequest>
                    <amount xmlns='http://payment.services.adyen.com'>
                        <currency xmlns='http://common.services.adyen.com'>GBP</currency>
                        <value xmlns='http://common.services.adyen.com'>67</value>
                    </amount>
                    <card xmlns='http://payment.services.adyen.com'>
                        <cvc304</cvc>
                        <expiryMonth>03</expiryMonth>
                        <expiryYear>2019</expiryYear>
                        <holderName>Owais</holderName>
                        <number>55554444333331111</number>
                    </card>
                    <merchantAccount xmlns='http://payment.services.adyen.com'>owaiskhan772</merchantAccount>
                    <reference xmlns='http://payment.services.adyen.com'>CPD-1232</reference>
                    <shopperEmail xmlns='http://payment.services.adyen.com'>owaiskhan772@gmail.com</shopperEmail>
                    <shopperReference xmlns='http://payment.services.adyen.com'>2843</shopperReference>
                </ns1:paymentRequest>
            </ns1:authorise>
        </soap:Body>
        </soap:Envelope>";
$soapUrl = "https://pal-test.barclaycardsmartpay.com/pal/servlet/soap/Payment"; // test url

    $soapUser = "";  //  username
    $soapPassword = ""; // password

   $headers = array(
          "Content-type: text/xml;charset=\"utf-8\"",
          "Accept: text/xml",
          "Cache-Control: no-cache",
          "Pragma: no-cache",
          "SOAPAction: https://pal-test.barclaycardsmartpay.com/pal/servlet/soap/Payment",
          "Content-length: ".strlen($requestXML),
    ); //SOAPAction: your op URL

    $url = $soapUrl;

    // PHP cURL  for https connection with auth
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERPWD, $soapUser.":".$soapPassword); // username and password - declared at the top of the doc
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $requestXML); // the SOAP request
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    // converting
    $response = curl_exec($ch);
    print_r($response);
    curl_close($ch);

我没有从中得到任何东西。它出什么问题了。感谢

0 个答案:

没有答案