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

# France CTC Flow 2 (B2B Clearance)

Key: `fr-ctc-flow2-v1`

Module: [github.com/invopop/gobl.fr.ctc](https://github.com/invopop/gobl.fr.ctc)

Support for Flow 2 ("facturation") of the French CTC
reform: domestic B2B clearance, applied to invoices
exchanged between two parties identifiable as French
(SIREN or French VAT ID on both sides). Built on the
EU EN16931 CIUS profile (declared as a dependency).

## Sources

* [External Specifications](https://www.impots.gouv.fr/specifications-externes-b2b)

## Scenarios

Scenarios attach notes and extensions to a document when its filters match.
[Read more about scenarios](https://docs.gobl.org/overview/scenarios.md).

> [accordion] bill/invoice
>
> | Tags | Type | Output |
> | - | - | - |
> | - | `standard` | `{  "ext": {    "untdid-document-type": "380"  }}` |
> | `self-billed` | `standard` | `{  "ext": {    "untdid-document-type": "389"  }}` |
> | `factoring` | `standard` | `{  "ext": {    "untdid-document-type": "393"  }}` |
> | `self-billed` `factoring` | `standard` | `{  "ext": {    "untdid-document-type": "501"  }}` |
> | `prepayment` | `standard` | `{  "ext": {    "untdid-document-type": "386"  }}` |
> | `self-billed` `prepayment` | `standard` | `{  "ext": {    "untdid-document-type": "500"  }}` |
> | - | `corrective` | `{  "ext": {    "untdid-document-type": "384"  }}` |
> | `self-billed` | `corrective` | `{  "ext": {    "untdid-document-type": "471"  }}` |
> | `factoring` | `corrective` | `{  "ext": {    "untdid-document-type": "472"  }}` |
> | `self-billed` `factoring` | `corrective` | `{  "ext": {    "untdid-document-type": "473"  }}` |
> | - | `credit-note` | `{  "ext": {    "untdid-document-type": "381"  }}` |
> | `self-billed` | `credit-note` | `{  "ext": {    "untdid-document-type": "261"  }}` |
> | `factoring` | `credit-note` | `{  "ext": {    "untdid-document-type": "396"  }}` |
> | `self-billed` `factoring` | `credit-note` | `{  "ext": {    "untdid-document-type": "502"  }}` |
> | `prepayment` | `credit-note` | `{  "ext": {    "untdid-document-type": "503"  }}` |
> | `global` | `credit-note` | `{  "ext": {    "untdid-document-type": "262"  }}` |

## Extensions

### France CTC: Billing Mode

Code used to describe the billing framework of the invoice. The
billing mode indicates the nature of goods/services and the payment
context.

Code prefixes indicate the invoice nature:

* "B": Goods invoice (Biens)
* "S": Services invoice
* "M": Mixed/dual invoice (goods and services that are not accessory
  to each other)

The numeric suffix indicates the payment type (1=deposit,
2=already paid, 3=subcontracting with direct payment,
4=final after down payment, 5=subcontractor, 6=co-contractor,
7=e-reporting, 8=multi-vendor, 9=bi-directional).

S3 is public-sector only: a subcontractor bills the public buyer
directly under the paiement direct arrangement.

> [accordion] fr-ctc-billing-mode
>
> | Code | Name |
> | - | - |
> | `B1` | Goods - Standard invoice |
> | `B2` | Goods - Already paid invoice |
> | `B4` | Goods - Final invoice (after down payment) |
> | `B7` | Goods - E-reporting (VAT already collected) |
> | `B8` | Goods - Multi-vendor invoice |
> | `B9` | Goods - Bi-directional invoice |
> | `S1` | Services - Standard invoice |
> | `S2` | Services - Already paid invoice |
> | `S3` | Services - Subcontracting payment request with direct payment |
> | `S4` | Services - Final invoice (after down payment) |
> | `S5` | Services - Subcontractor invoice |
> | `S6` | Services - Co-contractor invoice |
> | `S7` | Services - E-reporting (VAT already collected) |
> | `S8` | Services - Multi-vendor invoice |
> | `S9` | Services - Bi-directional invoice |
> | `M1` | Mixed - Standard invoice |
> | `M2` | Mixed - Already paid invoice |
> | `M4` | Mixed - Final invoice (after down payment) |
> | `M8` | Mixed - Multi-vendor invoice (unit invoices not all Sx or Bx) |
> | `M9` | Mixed - Bi-directional invoice |

## Validation Rules

Validation rules check each struct against a set of assertions and report any
failures with a unique code and message.
[Read more about validation](https://docs.gobl.org/overview/validation.md).

> [accordion] bill.Invoice
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | Invoice | <ul><li>Can convert to \[EUR]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-01` Invoice must be in EUR or provide an exchange rate to EUR |
> | Invoice | <ul><li>Valid invoice code</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-02` Invoice code (with series, when set) must be 1-35 characters of alphanumerics plus -+\_/ (BR-FR-01/02) |
> | `preceding[*]` | <ul><li>Valid preceding code</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-03` Invoice preceding code (with series, when set) must be 1-35 characters of alphanumerics plus -+\_/ (BR-FR-01/02) |
> | `preceding` | <ul><li>Invoice tax ext untdid-document-type in \[384, 471, 472, 473]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-04` Invoice preceding is required for corrective invoices (BR-FR-CO-04) |
> | `preceding` | <ul><li>Invoice tax ext untdid-document-type in \[384, 471, 472, 473]</li><li>Length between 1 and 1</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-05` Invoice preceding must contain exactly one reference for corrective invoices (BR-FR-CO-04) |
> | `preceding` | <ul><li>Invoice tax ext untdid-document-type in \[261, 381, 396, 502, 503]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-06` Invoice preceding must contain at least one reference for credit notes (BR-FR-CO-05) |
> | `preceding[*].issue_date` | <ul><li>Invoice tax ext untdid-document-type in \[261, 381, 396, 502, 503]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-42` Invoice preceding issue\_date is required for credit notes (BR-FR-CO-05) |
> | `tax` | <ul><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-07` Invoice tax is required |
> | `tax.ext` | <ul><li>Ext 'untdid-document-type' in \[380, 389, 393, 501, 386, 500, 384, 471, 472, 473, 381, 261, 396, 502, 503, 262]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-08` Invoice tax ext untdid-document-type must be a valid Flow 2 document type (BR-FR-04) |
> | `tax.ext` | <ul><li>Ext require \[fr-ctc-billing-mode]</li><li>Ext 'fr-ctc-billing-mode' in \[B1, B2, B4, B7, B8, B9, S1, S2, S3, S4, S5, S6, S7, S8, S9, M1, M2, M4, M8, M9]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-09` Invoice tax ext fr-ctc-billing-mode is required and must be a valid billing-mode code |
> | `tax.ext` | <ul><li>Invoice tax ext fr-ctc-billing-mode in \[B4, S4, M4]</li><li>Ext 'untdid-document-type' not in \[386, 500, 503]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-10` Invoice tax ext untdid-document-type must not be an advance-payment code (386, 500, 503) when billing mode is factoring (B4, S4, M4) (BR-FR-CO-08) |
> | `supplier.endpoints` | <ul><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-44` Invoice supplier endpoint is required for French B2B invoices (BR-FR-13) |
> | `supplier.identities` | <ul><li>Legal identity is SIREN</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-12` Invoice supplier legal identity must be a SIREN with iso-scheme-id 0002 (BR-FR-10/11) |
> | `customer` | <ul><li>Invoice tax ext untdid-document-type not in \[389, 501, 500, 471, 473, 261, 502]</li><li>Has SIREN endpoint</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-45` Invoice customer must have an endpoint with scheme 0225 matching the SIREN code when the invoice is not self-billed (BR-FR-21) |
> | `customer.endpoints` | <ul><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-46` Invoice customer endpoint is required for French B2B invoices (BR-FR-12) |
> | `customer.identities` | <ul><li>Legal identity is SIREN</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-15` Invoice customer legal identity must be a SIREN with iso-scheme-id 0002 (BR-FR-10/11) |
> | `supplier` | <ul><li>Invoice tax ext untdid-document-type in \[389, 501, 500, 471, 473, 261, 502]</li><li>Has SIREN endpoint</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-47` Invoice supplier must have an endpoint with scheme 0225 matching the SIREN code when the invoice is self-billed (BR-FR-22) |
> | `ordering.identities` | <ul><li>Identities have at most one ext untdid-reference=AFL</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-17` Invoice ordering identities must not contain more than one entry with UNTDID reference 'AFL' (BR-FR-30) |
> | `ordering.identities` | <ul><li>Identities have at most one ext untdid-reference=AWW</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-18` Invoice ordering identities must not contain more than one entry with UNTDID reference 'AWW' (BR-FR-30) |
> | `ordering` | <ul><li>Invoice supplier is under STC scheme</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-19` Invoice ordering is required when supplier is under STC scheme (BR-FR-CO-15) |
> | `ordering.seller` | <ul><li>Invoice supplier is under STC scheme</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-20` Invoice ordering seller is required when supplier is under STC scheme (BR-FR-CO-15) |
> | `ordering.seller.tax_id` | <ul><li>Invoice supplier is under STC scheme</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-21` Invoice ordering seller tax\_id is required when supplier is under STC scheme (BR-FR-CO-15) |
> | `ordering.seller.tax_id.code` | <ul><li>Invoice supplier is under STC scheme</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-22` Invoice ordering seller tax\_id code is required when supplier is under STC scheme (BR-FR-CO-15) |
> | `notes` | <ul><li>Invoice supplier is under STC scheme</li><li>Has TXD note</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-23` Invoice notes must include an entry with subject TXD and text MEMBRE\_ASSUJETTI\_UNIQUE when supplier is under STC scheme (BR-FR-CO-14) |
> | `ordering` | <ul><li>Invoice tax ext untdid-document-type in \[262]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-24` Invoice ordering is required for global credit notes (BR-FR-CO-03) |
> | `ordering.period` | <ul><li>Invoice tax ext untdid-document-type in \[262]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-43` Invoice ordering period is required for global credit notes (BG-14, BR-FR-CO-03) |
> | `ordering.period` | <ul><li>Invoice tax ext untdid-document-type in \[262]</li><li>Period has both dates</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-48` Invoice ordering period needs both a start and an end for global credit notes (BT-73/BT-74, BR-FR-CO-03) |
> | `ordering.contracts` | <ul><li>Invoice tax ext untdid-document-type in \[262]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-25` Invoice ordering contracts is required for global credit notes (BR-FR-CO-03) |
> | `ordering.contracts` | <ul><li>Invoice tax ext untdid-document-type in \[262]</li><li>Length at least 1</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-26` Invoice ordering contracts must contain at least one entry for global credit notes (BR-FR-CO-03) |
> | Invoice | <ul><li>Invoice tax ext fr-ctc-billing-mode not in \[B2, S2, M2]</li><li>Due dates valid</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-29` Invoice payment terms due\_dates must not be before the invoice issue date (BR-FR-CO-07) |
> | `payment` | <ul><li>Invoice tax ext fr-ctc-billing-mode in \[B2, S2, M2]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-30` Invoice payment is required for final invoices (BR-FR-CO-09) |
> | `payment.terms` | <ul><li>Invoice tax ext fr-ctc-billing-mode in \[B2, S2, M2]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-31` Invoice payment terms is required for final invoices (BR-FR-CO-09) |
> | `payment.terms.due_dates` | <ul><li>Invoice tax ext fr-ctc-billing-mode in \[B2, S2, M2]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-32` Invoice payment terms due\_dates must contain at least one entry for final invoices (BR-FR-CO-09) |
> | `totals` Calculated | <ul><li>Invoice tax ext fr-ctc-billing-mode in \[B2, S2, M2]</li><li>Advances match total\_with\_tax</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-34` Invoice totals advance must equal total\_with\_tax for final invoices (BR-FR-CO-09) |
> | `totals` Calculated | <ul><li>Invoice tax ext fr-ctc-billing-mode in \[B2, S2, M2]</li><li>Payable is zero</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-35` Invoice totals payable must be zero for final invoices (BR-FR-CO-09) |
> | `totals.advance` Calculated | <ul><li>Invoice tax ext fr-ctc-billing-mode in \[B2, S2, M2]</li><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-33` Invoice totals advance is required for final invoices (BR-FR-CO-09) |
> | `notes` | <ul><li>Present</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-36` Invoice notes are required for French CTC invoices (BR-FR-05) |
> | `notes` | <ul><li>Has required note subjects</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-37` Invoice notes must include entries with subjects PMT, PMD and AAB (BR-FR-05) |
> | `notes` | <ul><li>No duplicate note subjects</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-38` Invoice notes must not contain duplicate subjects PMT, PMD, AAB or TXD (BR-FR-06/BR-FR-30) |
> | `attachments` | <ul><li>At most one LISIBLE</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-41` Invoice attachments must not contain more than one entry with description 'LISIBLE' (BR-FR-18) |
> | `attachments[*].description` | <ul><li>One of \[RIB, LISIBLE, FEUILLE\_DE\_STYLE, PJA, BON\_LIVRAISON, BON\_COMMANDE, DOCUMENT\_ANNEXE, BORDEREAU\_SUIVI, BORDEREAU\_SUIVI\_VALIDATION, ETAT\_ACOMPTE, FACTURE\_PAIEMENT\_DIRECT, RECAPITULATIF\_COTRAITANCE]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-INVOICE-40` Invoice attachment description must be one of the allowed values (BR-FR-17) |

> [accordion] bill.DeliveryDetails
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `ext` | <ul><li>Ext allow one of \[icc-incoterms-2010, untdid-delivery-terms]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-DELIVERYDETAILS-01` Delivery ext may include only one of icc-incoterms-2010 or untdid-delivery-terms (BR-FREXT-CL-27, EXT-FR-FE-185) |
> | `ext` | <ul><li>Ext 'icc-incoterms-2010' in \[EXW, FCA, CPT, CIP, DAT, DAP, DDP, FAS, FOB, CFR, CIF]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-DELIVERYDETAILS-02` Delivery ext icc-incoterms-2010 must be a valid Incoterms 2010 code (BR-FREXT-CL-27) |
> | `ext` | <ul><li>Ext 'untdid-delivery-terms' in \[1, 2]</li></ul> | `GOBL-FR-CTC-FLOW2-BILL-DELIVERYDETAILS-03` Delivery ext untdid-delivery-terms must be a valid UNTDID 4053 code (BR-FREXT-CL-27) |

> [accordion] org.Party
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `identities` | <ul><li>SIRET/SIREN coherent</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-PARTY-01` SIRET and SIREN must be coherent (BR-FR-09/10) |
> | `identities` | <ul><li>Unique iso-scheme-id</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-PARTY-03` Party identities must not duplicate iso-scheme-id values (BR-FR-CO-10) |
> | `identities` | <ul><li>Iso-scheme-id present</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-PARTY-04` Every party identifier must carry the iso-scheme-id extension (BR-FR-CO-10) |

> [accordion] org.Identity
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `code` | <ul><li>Scheme 0224</li><li>Length at most 100</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-IDENTITY-01` Identity code for private-id (0224) must not exceed 100 characters (BR-FR-26) |
> | `code` | <ul><li>Scheme 0224</li><li>Matches `^[A-Za-z0-9+\-_.]+$`</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-IDENTITY-02` Identity code for private-id (0224) must contain only alphanumeric characters and +, -, \_, . (BR-FR-24) |
> | `code` | <ul><li>Scheme 0002 or 0231</li><li>Matches `^\d{9}$`</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-IDENTITY-03` Identity code must be exactly 9 digits (BR-FR-32) |

> [accordion] org.Inbox
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `code` | <ul><li>Scheme 0225</li><li>Length at most 125</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-INBOX-01` The length must be between 0 and 125 |
> | `code` | <ul><li>Scheme 0225</li><li>Matches `^[A-Za-z0-9+\-_.]+$`</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-INBOX-02` Must contain only alphanumeric characters and +, -, \_, . (BR-FR-23) |

> [accordion] org.Note
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | Note | <ul><li>Text or subject</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-NOTE-01` Note must carry either text or an untdid-text-subject extension |

> [accordion] org.Endpoint
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `uri` | <ul><li>Uri scheme in \[iso6523-actorid-upis]</li><li>Address within 125 characters</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-ENDPOINT-02` Iso6523-actorid-upis endpoint address must not exceed 125 characters (BR-FR-25) |
> | `uri` | <ul><li>Uri opaque matches `^:0225:`</li><li>Uri opaque matches `^:0225:[A-Za-z0-9+\-_.]+$`</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-ENDPOINT-01` Iso6523-actorid-upis endpoint on scheme 0225 must contain only alphanumeric characters and +, -, \_, . (BR-FR-23) |

> [accordion] org.Item
>
> | Field | Test | Validation Code / Message |
> | - | - | - |
> | `meta` | <ul><li>No blank meta</li></ul> | `GOBL-FR-CTC-FLOW2-ORG-ITEM-01` Meta values cannot be blank (BR-FR-28) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.