Skip to content

Repository files navigation

License: MIT

Simple Java SEPA XML Generator

The Single Euro Payments Area (SEPA) is a payment-integration initiative of the European Union for simplification of bank transfers denominated in euro. As of 2018, SEPA consists of the 28 member states of the European Union, the four member states of the European Free Trade Association (Iceland, Liechtenstein, Norway and Switzerland), Andorra, Monaco and San Marino.

This Java library proviedes SEPA XML files to automate direct debit and credit transfer payment processes. For direct debit transactions you need a creaditor identifier the central bank of your countty is providing to you. The following standarts are supported: pain.001.002.03.xsd pain.008.002.02.xsd

How to use?

SEPA Direct Debit

importorg.simple.sepa.*;
importjava.util.ArrayList;
importjava.util.Date;
importjava.util.List;
publicclassExampleDirectDebit {
publicstaticvoidmain(String[] args) {
finalStringcreditorID = "DE98ZZZ09999999999";
finalSEPABankAccountreciver = newSEPABankAccount(
"DE89370400440532013000",
"DEUTDEBBXXX",
"Joe Doe"
);
finalList<SEPATransaction> transactions = newArrayList<SEPATransaction>() {{
add(newSEPATransaction(
newSEPABankAccount(
"DE05500105173195282731",
"VBRSDE33347",
"Peter Parker"
),
10.20d,
"Invoice 4711564",
newDate(),
"MYCOMP11111111",
newDate(),
SEPATransaction.Currency.EUR
)
);
add(newSEPATransaction(
newSEPABankAccount(
"DK5250511963137134",
"UINVDEFFXXX",
"Carl White"
),
1000.00d,
"Invoice 789765",
newDate(),
"MYCOMP22222222",
newDate(),
SEPATransaction.Currency.EUR
)
);
add(newSEPATransaction(
newSEPABankAccount(
"CZ7627005991764514418145",
"SWBSDESSXXX",
"Frank Black"
),
50.00d,
"Invoice 7856",
newDate(),
"MYCOMP11111111",
newDate(),
SEPATransaction.Currency.EUR
)
);
}};
finalSEPAsepa = newSEPADirectDebit(reciver, transactions, creditorID);
System.out.println(sepa.toString());
}
}

SEPA Credit Transfer

importorg.simple.sepa.SEPA;
importorg.simple.sepa.SEPABankAccount;
importorg.simple.sepa.SEPACreditTransfer;
importorg.simple.sepa.SEPATransaction;
importjava.util.ArrayList;
importjava.util.List;
publicclassExampleCreditTransfer {
publicstaticvoidmain(String[] args) {
finalSEPABankAccountsender = newSEPABankAccount(
"DE89370400440532013000",
"DEUTDEBBXXX",
"Joe Doe"
);
finalList<SEPATransaction> transactions = newArrayList<SEPATransaction>() {{
add(newSEPATransaction(
newSEPABankAccount(
"DE05500105173195282731",
"VBRSDE33347",
"Peter Parker"
),
2000.20d,
"Salary PP 2018-07",
SEPATransaction.Currency.EUR
)
);
add(newSEPATransaction(
newSEPABankAccount(
"DK5250511963137134",
"UINVDEFFXXX",
"Carl White"
),
1000.00d,
"Salary CW 2015-12",
SEPATransaction.Currency.EUR
)
);
add(newSEPATransaction(
newSEPABankAccount(
"CZ7627005991764514418145",
"SWBSDESSXXX",
"Frank Black"
),
5000.00d,
"Salary FB 2017-05",
SEPATransaction.Currency.EUR
)
);
}};
finalSEPAsepa = newSEPACreditTransfer(sender, transactions);
sepa.write(System.out);
}
}

XML File Result for SEPA Direct Debit

 <?xml version="1.0" encoding="UTF-8"?>
<Documentxmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.002.02"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.008.002.02 pain.008.002.02.xsd">
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>DEUTDEBBXXX0020181403121442</MsgId>
<CreDtTm>2018-07-03T12:14:42.000Z</CreDtTm>
<NbOfTxs>3</NbOfTxs>
<InitgPty>
<Nm>Joe Doe</Nm>
</InitgPty>
</GrpHdr>
<PmtInf>
<PmtInfId>PMT-ID0-20181403121442</PmtInfId>
<PmtMtd>DD</PmtMtd>
<BtchBookg>true</BtchBookg>
<NbOfTxs>3</NbOfTxs>
<CtrlSum>1060.2</CtrlSum>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
<LclInstrm>
<Cd>CORE</Cd>
</LclInstrm>
<SeqTp>
<Cd>FRST</Cd>
</SeqTp>
</PmtTpInf>
<ReqdColltnDt>2018-07-03</ReqdColltnDt>
<Cdtr>
<Nm>Joe Doe</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>DE89370400440532013000</IBAN>
</Id>
</CdtrAcct>
<CdtrAgt>
<FinInstnId>
<BIC>DEUTDEBBXXX</BIC>
</FinInstnId>
</CdtrAgt>
<ChrgBr>SLEV</ChrgBr>
<CdtrSchmeId>
<Id>
<PrvtId>
<Othr>
<Id>DE98ZZZ09999999999</Id>
<SchmeNm>
<Prtry>SEPA</Prtry>
</SchmeNm>
</Othr>
</PrvtId>
</Id>
</CdtrSchmeId>
<DrctDbtTxInf>
<PmtId>
<EndToEndId>NOTPROVIDED</EndToEndId>
</PmtId>
<Amt>
<InstdAmtCcy="EUR">10.2</InstdAmt>
</Amt>
<DrctDbtTx>
<MndtRltdInf>
<MndtId>MYCOMP11111111</MndtId>
<DtOfSgntr>2018-07-03</DtOfSgntr>
<AmdmntInd>false</AmdmntInd>
</MndtRltdInf>
</DrctDbtTx>
<DbtrAgt>
<FinInstnId>
<BIC>VBRSDE33347</BIC>
</FinInstnId>
</DbtrAgt>
<Dbtr>
<Nm>Peter Parker</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>DE05500105173195282731</IBAN>
</Id>
</DbtrAcct>
<UltmtDbtr>
<Nm>Peter Parker</Nm>
</UltmtDbtr>
<RmtInf>
<Ustrd>Invoice 4711564</Ustrd>
</RmtInf>
</DrctDbtTxInf>
<DrctDbtTxInf>
<PmtId>
<EndToEndId>NOTPROVIDED</EndToEndId>
</PmtId>
<Amt>
<InstdAmtCcy="EUR">1000.0</InstdAmt>
</Amt>
<DrctDbtTx>
<MndtRltdInf>
<MndtId>MYCOMP22222222</MndtId>
<DtOfSgntr>2018-07-03</DtOfSgntr>
<AmdmntInd>false</AmdmntInd>
</MndtRltdInf>
</DrctDbtTx>
<DbtrAgt>
<FinInstnId>
<BIC>UINVDEFFXXX</BIC>
</FinInstnId>
</DbtrAgt>
<Dbtr>
<Nm>Carl White</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>DK5250511963137134</IBAN>
</Id>
</DbtrAcct>
<UltmtDbtr>
<Nm>Carl White</Nm>
</UltmtDbtr>
<RmtInf>
<Ustrd>Invoice 789765</Ustrd>
</RmtInf>
</DrctDbtTxInf>
<DrctDbtTxInf>
<PmtId>
<EndToEndId>NOTPROVIDED</EndToEndId>
</PmtId>
<Amt>
<InstdAmtCcy="EUR">50.0</InstdAmt>
</Amt>
<DrctDbtTx>
<MndtRltdInf>
<MndtId>MYCOMP11111111</MndtId>
<DtOfSgntr>2018-07-03</DtOfSgntr>
<AmdmntInd>false</AmdmntInd>
</MndtRltdInf>
</DrctDbtTx>
<DbtrAgt>
<FinInstnId>
<BIC>SWBSDESSXXX</BIC>
</FinInstnId>
</DbtrAgt>
<Dbtr>
<Nm>Frank Black</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>CZ7627005991764514418145</IBAN>
</Id>
</DbtrAcct>
<UltmtDbtr>
<Nm>Frank Black</Nm>
</UltmtDbtr>
<RmtInf>
<Ustrd>Invoice 7856</Ustrd>
</RmtInf>
</DrctDbtTxInf>
</PmtInf>
</CstmrDrctDbtInitn>
</Document>

XML File Result for SEPA Credit Transfer

<?xml version="1.0" encoding="UTF-8"?>
<Documentxmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.002.02"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.008.002.02 pain.008.002.02.xsd">
<CstmrDrctDbtInitn>
<GrpHdr>
<MsgId>DEUTDEBBXXX0020183502113507</MsgId>
<CreDtTm>2018-07-02T11:35:07.000Z</CreDtTm>
<NbOfTxs>3</NbOfTxs>
<InitgPty>
<Nm>Joe Doe</Nm>
</InitgPty>
</GrpHdr>
<PmtInf>
<PmtInfId>PMT-ID0-20183502113507</PmtInfId>
<PmtMtd>DD</PmtMtd>
<BtchBookg>true</BtchBookg>
<NbOfTxs>3</NbOfTxs>
<CtrlSum>8000.2</CtrlSum>
<PmtTpInf>
<SvcLvl>
<Cd>SEPA</Cd>
</SvcLvl>
<LclInstrm>
<Cd>CORE</Cd>
</LclInstrm>
<SeqTp>
<Cd>FRST</Cd>
</SeqTp>
</PmtTpInf>
<ReqdColltnDt>2018-07-02</ReqdColltnDt>
<Dbtr>
<Nm>Joe Doe</Nm>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>DE89370400440532013000</IBAN>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>DEUTDEBBXXX</BIC>
</FinInstnId>
</DbtrAgt>
<ChrgBr>SLEV</ChrgBr>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>NOTPROVIDED</EndToEndId>
</PmtId>
<Amt>
<InstdAmtCcy="EUR">2000.2</InstdAmt>
</Amt>
<CdtrAgt>
<FinInstnId>
<BIC>VBRSDE33347</BIC>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Peter Parker</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>DE05500105173195282731</IBAN>
</Id>
</CdtrAcct>
</CdtTrfTxInf>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>NOTPROVIDED</EndToEndId>
</PmtId>
<Amt>
<InstdAmtCcy="EUR">1000.0</InstdAmt>
</Amt>
<CdtrAgt>
<FinInstnId>
<BIC>UINVDEFFXXX</BIC>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Carl White</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>DK5250511963137134</IBAN>
</Id>
</CdtrAcct>
</CdtTrfTxInf>
<CdtTrfTxInf>
<PmtId>
<EndToEndId>NOTPROVIDED</EndToEndId>
</PmtId>
<Amt>
<InstdAmtCcy="EUR">5000.0</InstdAmt>
</Amt>
<CdtrAgt>
<FinInstnId>
<BIC>SWBSDESSXXX</BIC>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>Frank Black</Nm>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>CZ7627005991764514418145</IBAN>
</Id>
</CdtrAcct>
</CdtTrfTxInf>
</PmtInf>
</CstmrDrctDbtInitn>
</Document>

License

The MIT License (MIT)

Copyright (c) 2016 JohannesLaier

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

This Java library proviedes SEPA XML files to automate direct debit and credit transfer payment processes.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages