SkillAgentSearch skills...

Pain001

Pain001, A Powerful Python Library that enables you to create ISO 20022-Compliant Payment Files from CSV, SQLite, or Python data structures.๐Ÿ

Install / Use

/learn @sebastienrousseau/Pain001

README

Pain001: Automate ISO 20022-Compliant Payment File Creation

![Pain001 banner][banner]

Enterprise-Grade ISO 20022 Payment File Generation

[![PyPI Version][pypi-badge]][03] [![Python Versions][python-versions-badge]][03] [![PyPI Downloads][pypi-downloads-badge]][07] [![Licence][licence-badge]][01] [![Codecov][codecov-badge]][06] [![Tests][tests-badge]][tests-url] [![Quality][quality-badge]][quality-url] [![Documentation][docs-badge]][docs-url]

Latest Release: v0.0.47 - REST API, streaming loaders, security hardening, unified CLI, and XSD caching. [See what's new โ†’][release-047]

Overview

Pain001 is an open-source Python library that you can use to create ISO 20022-compliant payment files from your CSV files, SQLite databases, or Python data structures (lists and dictionaries).

The library focuses specifically on Payment Initiation and Advice Messages, commonly known as Pain. In a simplified way, a pain.001 is a message that initiates a customer payment.

Key Features:

  • Mandatory Data Validation: Ensures all payment files are ISO 20022-compliant before creation
  • Multi-source Support: Works with CSV files, SQLite databases, and Python data structures
  • Automatic XSD Validation: Validates generated XML against ISO 20022 schemas
  • Comprehensive Testing: 1,022 tests with branch coverage ensuring reliability
  • Secure by Design: Uses defusedxml to prevent XXE attacks and implements SQL injection protection
  • Type-Safe: Full type hints for better IDE support and type checking with mypy
  • Robust Error Handling: Specific exception types for precise error handling and debugging
  • 9 ISO 20022 Versions Supported: Supports all 9 Customer Credit Transfer Initiation versions: pain.001.001.03 through pain.001.001.11
  • Production-Ready: Used in production environments for SEPA and international payments

As of today, the library is designed to be compatible with the:

  • Payments Initiation V03 (pain.001.001.03): This version is used for initiating credit transfers within the SEPA (Single Euro Payments Area)
  • Payments Initiation V04 (pain.001.001.04): Enhanced with additional optional fields and improved data structures
  • Payments Initiation V05 (pain.001.001.05): Brings further refinements and clarifications to the ISO 20022 standard
  • Payments Initiation V06 (pain.001.001.06): Focused on supporting instant credit transfers within the SEPA region
  • Payments Initiation V07 (pain.001.001.07): Extended schema with additional optional elements for enhanced payment requests
  • Payments Initiation V08 (pain.001.001.08): Introduces support for new transaction types and enhanced validation rules
  • Payments Initiation V09 (pain.001.001.09): Simplified message structure with consolidated required fields
  • Payments Initiation V10 (pain.001.001.10): Enhanced with improved data structures and additional compliance requirements
  • Payments Initiation V11 (pain.001.001.11): The latest version with extended ISO 20022 compliance and advanced payment features

Version Comparison

| Version | Status | CSV Fields | Key Features | Use Case | |---------|--------|------------|--------------|----------| | pain.001.001.03 | โœ… Stable | 42 | SEPA credit transfers | EU payments | | pain.001.001.04 | โœ… Stable | 47 | Extended fields | Enhanced payment details | | pain.001.001.05 | โœ… Stable | 47 | Schema refinements | ISO 20022 alignment | | pain.001.001.06 | โœ… Stable | 44 | Instant transfers | Real-time SEPA payments | | pain.001.001.07 | โœ… Stable | 44 | Additional elements | Extended functionality | | pain.001.001.08 | โœ… Stable | 44 | Enhanced validation | Improved compliance | | pain.001.001.09 | โœ… Stable | 23 | Simplified structure | Modern implementations | | pain.001.001.10 | โœ… Stable | 23 | Improved compliance | Enhanced data validation | | pain.001.001.11 | โœ… Latest | 23 | Advanced features | Future-proof payments |

Payments usually start with a pain.001 payment initiation message. The payer sends it to the payee (or the payeeโ€™s bank) via a secure network. This network could be SWIFT, SEPA (Single Euro Payments Area), or other payment networks such as CHAPS, BACS, Faster Payments, etc. The message contains the payer's and payee's bank account details, payment amount, and other information required to process the payment.

The Pain001 library reduces payment processing complexity and costs by generating ISO 20022-compliant payment files with mandatory validation. These files are automatically validated before creation, eliminating the need to create and validate them manually. This makes the payment process more efficient and cost-effective whilst saving you time and resources and minimising the risk of errors, ensuring accurate and seamless payment processing.

Use the Pain001 library to simplify, accelerate, and automate your payment processing with confidence that every file is ISO 20022-compliant.

How It Works

Payment Processing Flow

flowchart LR
    A["CSV / SQLite / Python
    Data Source"] -->|Load & Validate| B["Pain001
    Library"]
    B -->|Generate XML| C["ISO 20022
    Payment File"]
    C -->|XSD Validation| D{Valid?}
    D -->|Yes| E["Submit to Bank
    via SWIFT/SEPA"]
    D -->|No| F["Error Report
    & Fix Data"]
    F -->|Retry| A
    E --> G["Payment
    Processed"]

Table of Contents

Features

Core Functionality

  • Easy to Use: Both developers and non-developers can easily use the library, as it requires minimal coding knowledge
  • Open Source: The library is open source and free to use, making it accessible to everyone
  • Mandatory Data Validation: Ensures payment file integrity and ISO 20022 compliance
    • All data sources (CSV, SQLite, Python dict/list) are automatically validated
    • Invalid data raises clear ValueError messages indicating what needs to be fixed
    • Validates required fields, data types, boolean values, and field formats
    • Prevents creation of non-compliant payment files
    • No manual validation neededโ€”it's built into every data load operation

Security & Quality

  • Secure: The library prioritises security with multiple layers of protection
    • Uses defusedxml for secure XML parsing to prevent XXE attacks
    • Implements SQL injection protection in database operations
    • Regular security audits with Bandit and Safety tools
    • All dependencies kept up to date to address known vulnerabilities
    • No sensitive data storageโ€”all information remains confidential
    • OWASP Top 10 security best practices implemented
  • ๐Ÿ›ก๏ธ Enterprise Logging & Compliance:
    • Structured Logging: All logs emitted as JSON for seamless integration with Splunk, Datadog, Elasticsearch, and CloudWatch
    • PII Protection: Automatic masking of sensitive fields (IBANs, BICs, names, account numbers) in logs to ensure GDPR Article 32 and PCI-DSS Requirement 3.4 compliance
    • Event Standardisation: 17 standardised event types for consistent observability across payment processing lifecycle
    • Zero PII Leakage: Logs never expose clear-text payment dataโ€”all sensitive information automatically redacted before logging
  • Robust Development: Comprehensive quality assurance with
    • 1,022 tests with branch coverage across Python 3.9โ€“3.12
    • Code formatting with Black and Ruff
    • Import sorting with isort
    • Style checking with Flake8 (10.00/10 score)
    • Static type checking with mypy (strict mode)
    • Code quality analysis wi

Related Skills

View on GitHub
GitHub Stars38
CategoryData
Updated4d ago
Forks17

Languages

Python

Security Score

95/100

Audited on Mar 26, 2026

No findings