1. Go to this page and download the library: Download luisurrutia/transbank-soap library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
luisurrutia / transbank-soap example snippets
namespace MYPACKAGE\Transbank;
use SoapClient;
use DOMDocument;
use LuisUrrutia\TransbankSoap\Process;
class TransbankSoap extends SoapClient
{
public function __doRequest($request, $location, $saction, $version, $one_way = null)
{
$process = new Process($request);
$process->sign(PRIVATE_KEY);
$process->addIssuer(CERTIFICATE);
$signedRequest = $process->getXML();
$retVal = parent::__doRequest(
$signedRequest,
$location,
$saction,
$version,
$one_way
);
$doc = new DOMDocument();
$doc->loadXML($retVal);
return $doc->saveXML();
}
}
namespace MYPACKAGE\Transbank;
use LuisUrrutia\TransbankSoap\Validation;
$response = $this->soapClient->__getLastResponse();
$soapValidation = new Validation($response, TBK_CERTIFICATE);
if (!$soapValidation->isValid()) {
throw new Exception('Invalid response or certificate');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.