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 ‘cNode’ 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 Corporate Node 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 Corporate Node.

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; // Corporate Node response 
   $error; // errors when sending SOAP request (the errors from CNode are being passed by the argument '$requestResponse') 
$uid = uniqueId();
$data = array("cNode" => "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" => ""),*/ // direct communication with Corporate Node
              "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?