build_dati_pagamento
Create a validated DatiPagamento payment block for Italian e-invoice XML, ensuring correct payment terms, method, and IBAN for SDI compliance.
Instructions
Build the DatiPagamento block for the FatturaElettronicaBody.
Use this as step 9 in the invoice generation workflow, after compute_totali() and before generate_fattura_xml(). The block is optional in the XML but strongly recommended for B2B invoices.
condizioni_pagamento: TP01 = instalments, TP02 = single full payment, TP03 = advance. modalita_pagamento: MP05 (bank transfer) is most common for B2B; include iban when using MP05. importo_pagamento: for TP02 this should equal totale_fattura from compute_totali(); for TP01 (instalments) call this tool once per instalment tranche.
Validates: condizioni_pagamento in {TP01, TP02, TP03}; modalita_pagamento in MP01–MP23; IBAN format (letters + digits, max 34 chars); data_scadenza_pagamento is YYYY-MM-DD.
On success returns {'DatiPagamento': {...}} ready for generate_fattura_xml(). On failure returns {'error': ''}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| iban | No | IBAN for bank transfer (MP05). Validated for format (letters+digits, max 34 chars). | |
| importo_pagamento | Yes | Payment amount (may equal or differ from invoice total for instalments). | |
| modalita_pagamento | Yes | Payment method code MP01–MP23. Common values: MP05 (bonifico/bank transfer), MP01 (cash), MP08 (card), MP19/MP20/MP21 (SEPA direct debit), MP23 (PagoPA). Use a valid MP code from the FatturaPA reference. | |
| condizioni_pagamento | Yes | Payment terms code: 'TP01' = full payment in instalments, 'TP02' = full single payment, 'TP03' = advance payment. | |
| istituto_finanziario | No | Name of the financial institution (bank name). Optional. | |
| data_scadenza_pagamento | No | Payment due date (YYYY-MM-DD). Omit for immediate payment. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||