sepaxml is a Python library for creating and parsing SEPA (Single Euro Payments Area) XML files, specifically supporting pain.001.001.03 (Credit Transfer), pain.008.001.02 (Direct Debit), and pain.002.001.03 (Return File) standards. It provides an intuitive API to construct payment instructions and handles XML serialization and deserialization. The current version is 2.7.0, and the library is actively maintained with regular updates to support standards and fix bugs.
pip install sepaxmlVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to create a basic SEPA Credit Transfer (pain.001) XML file using `sepaxml`. It initializes a `CreditTransfer` object with creditor details and then adds a single payment transaction. Finally, it exports the payment instructions as an XML string.
Migrate to standard Python `datetime` for date handling and generate IDs manually if needed. Refer to the current documentation for updated practices.
Ensure all financial identifiers (IBAN, BIC) are valid using a library like `schwifty` (which `sepaxml` uses internally) and that dates are passed as `datetime.date` objects. Consult the SEPA specifications for mandatory fields for your specific message type.
Always provide a BIC unless you are certain it's not required for your specific payment scenario (e.g., using `is_bic_optional=True` for direct debits if allowed by your bank). Banks may reject files if an optional BIC is present but incorrect, or if a mandatory BIC is missing.