PHP code example of daltcore / sepa-direct-debit
1. Go to this page and download the library: Download daltcore/sepa-direct-debit 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/ */
daltcore / sepa-direct-debit example snippets
$config = array("name" => "Test",
"IBAN" => "NL50BANK1234567890",
"BIC" => "BANKNL2A",
"batch" => true,
"creditor_id" => "00000",
"currency" => "EUR"
);
try{
$SEPASDD = new SEPASDD($config);
}catch(Exception $e){
echo $e->getMessage();
}
$payment = array("name" => "Test von Testenstein",
"IBAN" => "NL50BANK1234567890",
"BIC" => "BANKNL2A",
"amount" => "1000",
"type" => "FRST",
"collection_date" => "2013-07-12",
"mandate_id" => "1234",
"mandate_date" => "2009-11-01",
"description" => "Test Transaction"
);
try{
$endToEndId = $SEPASDD->addPayment($payment);
}catch(Exception $e){
echo $e->getMessage();
}
try{
$SEPASDD->save();
}catch(Exception $e){
echo $e->getMessage();
}
try{
$SEPASDD->save();
}catch(Exception $e){
echo $e->getMessage();
}
$payment = array("name" => "Test von Testenstein",
"IBAN" => "NL50BANK1234567890",
"BIC" => "BANKNL2A",
"amount" => "1000",
"type" => "FRST",
"collection_date" => "2013-07-12",
"mandate_id" => "1234",
"mandate_date" => "2009-11-01",
"description" => "Test Transaction"
);
try{
$SEPASDD->addPayment($payment);
$SEPASDD->save();
$SEPASDD->addCustomNode("//Document/CstmrDrctDbtInitn/PmtInf[last()]/DrctDbtTxInf[last()]/Dbtr","PstlAdr");
$SEPASDD->addCustomNode("//Document/CstmrDrctDbtInitn/PmtInf[last()]/DrctDbtTxInf[last()]/Dbtr/PstlAdr","AdrLine","Rode Weeshuisstraat 25");
$SEPASDD->addCustomNode("//Document/CstmrDrctDbtInitn/PmtInf[last()]/DrctDbtTxInf[last()]/Dbtr/PstlAdr","AdrLine","9712 ET Groningen");
$SEPASDD->save();
}catch(Exception $e){
echo $e->getMessage();
}
try{
$xml = $SEPASDD->save();
$validation = $SEPASDD->validate($xml);
print_r($validation);
}catch(Exception $e){
echo $e->getMessage();
}