$data_path = getcwd(). "/.ebics_client_data/"; $work_dir = getcwd(); error_reporting(E_ALL); ini_set('display_errors', 1); set_include_path(get_include_path().PATH_SEPARATOR .$work_dir."/phpseclib"); include_once("Crypt/RSA.php"); include_once('Crypt/Rijndael.php'); include_once('mt940/autoload.php'); define('CLASSES_ROOT',$work_dir); include("ebics_client.class.php"); include("sepa.class.php");
1. What this software does This software is intended to be used as a class for programming EBICS clients written in PHP. With this software you can upload or download data from EBICS servers (normally hosted at a datacenter owned or managed by a bank). 2. Requirements - PHP 5.6 or greater - php5-curl php5-gmp php5-mcrypt openssl php5-xmlrpc php-pear - run in isolated vm and connect your app via vpn tunnel 3. Tested bank institutes This client has been tested with. - Sparkasse - Volks + Raiffeisenbank - Commerzbank - Postbank - Deutsche Bank - UBS Schweiz - procredit Bank - Banken mit ebics.multivia-suite.de - St. Galler Kantonalbank sgkb.ch !!! crippled EBICS implementation -> https://www.sgkb.ch/download/online/EBICS_Verbindungsparameter.pdf 3. Setup a user How EBICS Initialization works: 1. The customer (you) requests an EBICS account from your bank and receive User ID, Partner ID, EBICS Host ID, EBICS URL and the fingerprints of the public keys of the bank. 2. with this code you create your encryption keys and submit them to the bank: $ebics = new ebics_client($user_id,$partner_id,$host_id,$host_url,$data_dir); $ebics->initUser(); // creates a005,x002 and e002 keys... $ebics->loadUser(); $request = $ebics->INI_request(); $result = $ebics->send_request($request); $request = $ebics->HIA_request(); $result = $ebics->send_request($request); $letter = $ebics->getINIHIA_letter(); echo $letter; 3. INI + HIA Letter must be printed and signed and sent back to the bank to activate the EBICS account. After the bank has activated the account continue with step 4. 4. Get the banks public keys with this call: $ebics = new ebics_client($user_id,$partner_id,$host_id,$host_url,$data_dir); $ebics->loadUser(); $result = $ebics->HPB_request(); $result = $ebics->send_request($result); $parsed = $ebics->parse_response($result,"HPB"); 5. EBICS successfully initialized.
$creditor = array("initiator_name" => "Smart Weblications GmbH", "id" => "DE52ZZZ00000012516", "bic" => "BYLADEM1HOF", "iban" => "DE44780500000220626666", ); $debitor = array("debitor_name" => "Florian Wiessner", "id" => "00001337", "bic" => "BYLADEM1HOF", "iban" => "DE95780500000220696666", "verwendungszweck" => "Test SEPA Lastschrift", "refnum" => date("YmdHis"), "amount" => 23.42, "mandate_date_of_sig" => "2011-10-01", "payment_id" => "00001337" ); $sepa = new sepa; $sepa->loadXML("debitnote"); $sepa->add_debitnote($debitor, $creditor,true); $sepa_cdd = $sepa->getXML("debitnote",$creditor); $dom = new DOMDocument('1.0','UTF-8'); $dom->loadXML($sepa_cdd); $sepa_cdd = preg_replace("/\r|\n/"," ",$dom->C14N()); $sepa_cdd = preg_replace("/\s+/", " ", $sepa_cdd); $result = $ebics->Upload_init_request("CDD",$sepa_cdd); print $result;
$from = array("initiator_name" => "Smart Weblications GmbH", "id" => "DE52ZZZ00000012516", "bic" => "BYLADEM1HOF", "iban" => "DE44780500000220626666", ); $to = array("name" => "Max Mustermann", "bic" => "BYLADEM1HOF", "iban" => "DE26244444334444833333", "verwendungszweck" => "SEPA Ueberweisung", "ref-nummer" => date("YmdHis"), "amount" => "23.42" ); $sepa = new sepa; $sepa->loadXML("transfer"); $sepa->addPosition($to); $sepa_transfer = $sepa->getXML("transfer",$from); $dom = new DOMDocument('1.0','UTF-8'); $dom->loadXML($sepa_transfer); $sepa_transfer = preg_replace("/\r\n/"," ",$dom->C14N()); $sepa_transfer = preg_replace("/\s+/", " ", $sepa_transfer); $result = $ebics->Upload_init_request("CCT",$sepa_transfer); print $result;
$Auftrag = "STA"; // STA, PTK, C53, C54 if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-7,date("Y"))); } if (isset($_GET["end"])) { $end = $_GET["end"]; } else { $end = date("Y-m-d"); } $result = $ebics->ebics_request($Auftrag, $start, $end ); $result = $ebics->send_request($result); $result = $ebics->parse_response($result,$Auftrag); print $result;
Ioncube Loader Update:
On October 15, 2024, an update was released for the Ioncube Loader, fixing a bug that sometimes also occurred with our EBICS client. Please update the loader to version 14.
New PHP EBICS Client released 1.3.0
This release supports A006 encryption keys
New PHP EBICS Client released 1.2.23
Minor Bug-Fixes, Support for IonCube Binary with PHP 8.1, switch for SEPA-PAIN 008.001.002 because 008.003.002 was deprecated from some banks.
New PHP EBICS Client released 1.2.13
we added support for the St. Galler Kantonalbank. This bank uses Swiss EBICS method XE2 for upload. The banks implementation of EBICS is incomplete, so not all ordertypes will work.
New PHP EBICS Client released 1.2.12
we dropped php mycrypt requirement to be more compatbile with php 7.2 and 7.3, please upgrade to the new version.