1. Home
  2. Libraries for webmasters
  3. Sending SOAP requests in PHP

Sending SOAP requests in PHP

If you need the payment module in PHP to send SOAP requests, contact with us. The SOAP requests are available as methods of an object ‘$call’ that is static parameter class ‘SoapService’ from namespace ‘billon’ available after including script ‘billon.php’ of the payment module. The methods take arguments:

  • an array with elements:
    • with key ‘WUI’ and value that is API key, which can be obtained on the settings page of the service ‘billon.me’, or with an array with elements: with key ‘Name’ with value which is username and with key ‘Address’ with value that is the address on which the application 24/7 listens for incoming requests,
    • with key ‘params’ and value which is the parameters of SOAP request in the form of an array;
  • function with arguments, which is the response of the application 24/7.

You can set an action after sending every SOAP operation setting the function ‘$onRequestSend’ that is static parameter class ‘SoapService’. The function takes the same arguments as the function that is set with the configuration method ‘onRequestSend’, the name of the request, the parameters on an object form, the response and an error while sending in turn.

An example:

require_once "billon/index.php"; // location of a script 'index.php' of the Billon payment module
\billon\SoapService::$onRequestSend = function ($requestName, $parameters, $requestResponse, $error)
{ // the event of sending SOAP request, not required function assignment
   $requestName; // name of the SOAP message 
   $parameters; // parameters of the SOAP message 
   $requestResponse; // 27/7 application response 
   $error; // errors when sending SOAP request (the errors from 24/7 app are being passed by the argument '$requestResponse') 
});
$uid = uniqueId();
$data = array("WUI" => "eyJhkGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c3VyIjp7ImlkIjoyNSwic2FsdCI6IjEyZWVkMzQwLTM2NGUtMThNjgyN1hNDM5zA1MiOjEh0OTCJpYXQiDk0NjF9Q1M.zeWXG7Nyr3PFVhb4HRgLi5rh8fLZx41VHySHWUStIzc", // API key of a user of the service 'billon.me', only the requests 'hello', 'requestPaymentInitiation', 'getTaskStatus', 'getMoneyStatus' and 'startSeriesPayment'
              /*array("Name" => "billonpayments4", "Address" => "http://213.189.38.34:20891"),*/ // direct communication with application 24/7
              "params" => array("type" => "NORMAL", "amount" => array("amount" => 1000, "currency" => 'PLN'), 'seriesId' => null, "requestData" => array("username" => 'paying', "uniqueTransferId" => $uid, "title" => 'Payment title', "merchantBrandName" => 'Brand name', "requestInvoiceData" => "NOT_NEEDED", "requestDeliveryData" => "NOT_NEEDED", "description" => ' ')));
\billon\SoapService::$call->requestPaymentInitiation($data, function($requestResponse)
{
    if (is_object($requestResponse) && property_exists($requestResponse, 'requestStatus') && $requestResponse->requestStatus === "SUCCESS") 
    {
    }
});
Was this article helpful to you? Yes No

How can we help?