> ## Documentation Index
> Fetch the complete documentation index at: https://docs.iso20022js.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SEPA Credit

> Create a SEPA Credit Payment Initiation message

# SEPACreditPaymentInitiation

<Info>If want to learn more about SEPA, please refer to the <a href="https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html">Official SEPA website</a>.</Info>

The `SEPACreditPaymentInitiation` class is used to generate SEPA Credit Payment v3 Initiation messages (pain.001.001.03). These are primarily used to send cross-border payments within the [Single Euro Payments Area](https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html), which comprises of most countries in Europe.

It can be created via the `SEPACreditPaymentInitiationConfig` interface.

## Constructor

```typescript theme={null}
// Example Usage
const config: SEPACreditPaymentInitiationConfig = {
    initiatingParty: {
        name: 'Electrical',
        id: 'ELECTRIC',
        account: {
            iban: 'ES9121000418450200051332'
        },
        agent: {
            bic: 'BSCHESMMXXX',
            bankAddress: {
                country: 'US'
            }
        }
    },
    paymentInstructions: [
        {
            type: 'sepa',
            direction: 'credit',
            creditor: {
                name: 'Dáel Muñiz',
                account: {
                    iban: 'ES8201822200150201504058'
                },
            },
            amount: 1000, // €10.00
            currency: 'EUR'
        }
    ]
}

const sepa = new SEPACreditPaymentInitiation(config)
```

Initializes a new `SEPACreditPaymentInitiation` instance with the provided configuration.

## Methods

### serialize(): string

```typescript theme={null}
const xmlString = sepa.serialize();
console.log(xmlString);
```

Serializes the `SEPACreditPaymentInitiation` instance into an XML string representation. The resulting XML string can be used to send the payment to the bank.

### toString(): string

Alias for `serialize()`.

## Validation

The class includes built-in validation to ensure the payment initiation data meets the required standards:

* `messageId` should not exceed 35 characters.
* All payment instructions must have a consistent currency.
* All creditors must have a complete address (including country).
* Amount values should be specified in cents (e.g., 1000 for €10.00).
