0

I have not worked with SOAP API before. I want to execute a SOAP API with XML data request. I have tried but did not get success. https://www.getpayments.com/docs/#processrealtimetokenpayment This is the payment gateway URL which I have want to call.

I have used below code :

$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;

It throws below error :

a:ActionNotSupportedThe message with Action 'ProcessRealtimeTokenPayment' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).Curl call success.

Please anyone can guide me in this? Thank you in advance.

4
  • why do you not use SoapClient? php.net/manual/en/class.soapclient.php Commented Jul 13, 2017 at 9:24
  • @IvoP Sorry I am not familiar with it. Can you provide me an example of it? Commented Jul 13, 2017 at 9:26
  • Vladimir already did. See how much readable your code gets. And you have less worries about maintaining xml integrity regarding special chars in your input. Commented Jul 13, 2017 at 10:03
  • the wdsl speaks of a certificate. Did you provide it? Commented Jul 13, 2017 at 10:04

1 Answer 1

1

Here is an example with 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";

You can save it into the file and run with:

php file.php
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.