EDIFACT INVOIC Invoice

INVOIC is the UN/EDIFACT invoice message. A supplier sends it to claim payment for goods or services, and the same message also carries credit and debit notes.

BGM identifies the document (380 commercial invoice, 381 credit note), NAD groups name the parties, LIN groups list the items, and MOA and TAX segments in the summary carry the totals.

At a glance

Standard
EDIFACT
Version
D96A
Sent by
Supplier to buyer
Responses
CONTRL, APERAK, REMADV
ediFabric .NET template
TSINVOIC in EdiFabric.Templates.Edifact
OpenEDI definition
View INVOIC in the spec library

INVOIC structure

The full EDIFACT INVOIC layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 51 loops and 142 segment positions, in file order. Loops are shaded and their segments indented; Max use is how many times a segment or loop may repeat.

Segment / loop Name Usage Max use
UNHMessage headerMandatory1
BGMBeginning of messageMandatory1
DTMDate/time/periodMandatory35
PAIPayment instructionsOptional1
ALIAdditional informationOptional5
IMDItem descriptionOptional1
FTXFree textOptional10
RFF loopReferenceOptional99
RFFReferenceMandatory1
DTMDate/time/periodOptional5
NAD loopName and addressOptional99
NADName and addressMandatory1
LOCPlace/location identificationOptional25
FIIFinancial institution informationOptional5
RFF loopReferenceOptional9999
RFFReferenceMandatory1
DTMDate/time/periodOptional5
DOC loopDocument/message detailsOptional5
DOCDocument/message detailsMandatory1
DTMDate/time/periodOptional5
CTA loopContact informationOptional5
CTAContact informationMandatory1
COMCommunication contactOptional5
TAX loopDuty/tax/fee detailsOptional5
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
LOCPlace/location identificationOptional5
CUX loopCurrenciesOptional5
CUXCurrenciesMandatory1
DTMDate/time/periodOptional5
PAT loopPayment terms basisOptional10
PATPayment terms basisMandatory1
DTMDate/time/periodOptional5
PCDPercentage detailsOptional1
MOAMonetary amountOptional1
PAIPayment instructionsOptional1
FIIFinancial institution informationOptional1
TDT loopDetails of transportOptional10
TDTDetails of transportMandatory1
LOC loopPlace/location identificationOptional10
LOCPlace/location identificationMandatory1
DTMDate/time/periodOptional5
RFF loopReferenceOptional9999
RFFReferenceMandatory1
DTMDate/time/periodOptional5
TOD loopTerms of delivery or transportOptional5
TODTerms of delivery or transportMandatory1
LOCPlace/location identificationOptional2
PAC loopPackageOptional1000
PACPackageMandatory1
MEAMeasurementsOptional5
PCI loopPackage identificationOptional5
PCIPackage identificationMandatory1
RFFReferenceOptional1
DTMDate/time/periodOptional5
GINGoods identity numberOptional5
ALC loopAllowance or chargeOptional9999
ALCAllowance or chargeMandatory1
ALIAdditional informationOptional5
RFF loopReferenceOptional5
RFFReferenceMandatory1
DTMDate/time/periodOptional5
QTY loopQuantityOptional1
QTYQuantityMandatory1
RNGRange detailsOptional1
PCD loopPercentage detailsOptional1
PCDPercentage detailsMandatory1
RNGRange detailsOptional1
MOA loopMonetary amountOptional2
MOAMonetary amountMandatory1
RNGRange detailsOptional1
RTE loopRate detailsOptional1
RTERate detailsMandatory1
RNGRange detailsOptional1
TAX loopDuty/tax/fee detailsOptional5
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
RCS loopRequirements and conditionsOptional100
RCSRequirements and conditionsMandatory1
RFFReferenceOptional5
DTMDate/time/periodOptional5
FTXFree textOptional5
AJT loopAdjustment detailsOptional1
AJTAdjustment detailsMandatory1
FTXFree textOptional5
INP loopParties and instructionOptional1
INPParties and instructionMandatory1
FTXFree textOptional5
LIN loopLine itemOptional9999999
LINLine itemMandatory1
PIAAdditional product idOptional25
IMDItem descriptionOptional10
MEAMeasurementsOptional5
QTYQuantityOptional5
PCDPercentage detailsOptional1
ALIAdditional informationOptional5
DTMDate/time/periodOptional35
GINGoods identity numberOptional1000
GIRRelated identification numbersOptional1000
QVRQuantity variancesOptional1
EQDEquipment detailsOptional1
FTXFree textOptional5
MOA loopMonetary amountOptional5
MOAMonetary amountMandatory1
CUXCurrenciesOptional1
PAT loopPayment terms basisOptional10
PATPayment terms basisMandatory1
DTMDate/time/periodOptional5
PCDPercentage detailsOptional1
MOAMonetary amountOptional1
PRI loopPrice detailsOptional25
PRIPrice detailsMandatory1
APRAdditional price informationOptional1
RNGRange detailsOptional1
DTMDate/time/periodOptional5
RFF loopReferenceOptional10
RFFReferenceMandatory1
DTMDate/time/periodOptional5
PAC loopPackageOptional10
PACPackageMandatory1
MEAMeasurementsOptional5
PCI loopPackage identificationOptional5
PCIPackage identificationMandatory1
RFFReferenceOptional1
DTMDate/time/periodOptional5
GINGoods identity numberOptional5
LOC loopPlace/location identificationOptional9999
LOCPlace/location identificationMandatory1
QTYQuantityOptional100
DTMDate/time/periodOptional5
TAX loopDuty/tax/fee detailsOptional99
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
LOCPlace/location identificationOptional5
NAD loopName and addressOptional20
NADName and addressMandatory1
LOCPlace/location identificationOptional5
RFF loopReferenceOptional5
RFFReferenceMandatory1
DTMDate/time/periodOptional5
DOC loopDocument/message detailsOptional5
DOCDocument/message detailsMandatory1
DTMDate/time/periodOptional5
CTA loopContact informationOptional5
CTAContact informationMandatory1
COMCommunication contactOptional5
ALC loopAllowance or chargeOptional15
ALCAllowance or chargeMandatory1
ALIAdditional informationOptional5
DTMDate/time/periodOptional5
QTY loopQuantityOptional1
QTYQuantityMandatory1
RNGRange detailsOptional1
PCD loopPercentage detailsOptional1
PCDPercentage detailsMandatory1
RNGRange detailsOptional1
MOA loopMonetary amountOptional2
MOAMonetary amountMandatory1
RNGRange detailsOptional1
RTE loopRate detailsOptional1
RTERate detailsMandatory1
RNGRange detailsOptional1
TAX loopDuty/tax/fee detailsOptional5
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional1
TDT loopDetails of transportOptional10
TDTDetails of transportMandatory1
LOC loopPlace/location identificationOptional10
LOCPlace/location identificationMandatory1
DTMDate/time/periodOptional5
TOD loopTerms of delivery or transportOptional5
TODTerms of delivery or transportMandatory1
LOCPlace/location identificationOptional2
RCS loopRequirements and conditionsOptional100
RCSRequirements and conditionsMandatory1
RFFReferenceOptional5
DTMDate/time/periodOptional5
FTXFree textOptional5
UNSSection controlMandatory1
CNTControl totalOptional10
MOA loopMonetary amountMandatory100
MOAMonetary amountMandatory1
RFF loopReferenceOptional1
RFFReferenceMandatory1
DTMDate/time/periodOptional5
TAX loopDuty/tax/fee detailsOptional10
TAXDuty/tax/fee detailsMandatory1
MOAMonetary amountOptional2
ALC loopAllowance or chargeOptional15
ALCAllowance or chargeMandatory1
ALIAdditional informationOptional1
MOAMonetary amountOptional2
UNTMessage trailerMandatory1

Mandatory segments must be sent, Optional ones only when the data applies. Trading partners often add their own rules in companion guides - ediFabric templates can be adjusted to match. Open the element-level definition in the EdiNation spec library.

Sample INVOIC file

A D96A invoice with parties, line items and totals. Paste it into EdiNation to see every element named and validated.

UNB+UNOB:1+SENDER1:1+RECEIVER1:1+071101:1701+131++INVOIC++1++1'
UNG+INVOIC+2:1+3:4+971013:1040+5+UN+D:96A:UN+PASSPORT'
UNH+509010117+INVOIC:D:96A:UN'
BGM+380+IN432097'
DTM+137:20020308:102'
PAI+::42'
RFF+ON:ORD9523'
DTM+171:20020212:102'
RFF+PL:PL99523'
DTM+171:20020101:102'
RFF+DQ:53662'
DTM+171:20020215:102'
NAD+BY+5412345000013::9'
RFF+VA:4146023'
NAD+SU+4012345500004::9'
RFF+VA:VR12345'
NAD+DP+5412345678908::9'
CUX+2:EUR:4'
PAT+1++5:3:M:2'
PAT+22++5:3:D:10'
PCD+12:2.5:13'
ALC+C++6++FC'
MOA+23:120'
TAX+7+VAT+++:::19+S'
MOA+124:22.80'
LIN+1++4000862141404:SRS'
QTY+47:40'
MOA+203:2160'
PRI+AAB:60:CA'
TAX+7+VAT+++:::21+S'
MOA+124:453.60'
ALC+A'
PCD+1:10'
LIN+2++5412345111115:SRS'
QTY+46:5'
QTY+47:12.65:KGM'
MOA+203:2530'
PRI+AAA:200:CA::1:KGM'
TAX+7+VAT+++:::19+S'
MOA+124:480.70'
UNS+S'
CNT+2:2'
MOA+86:5767.10'
MOA+79:4690'
MOA+129:5767.10'
MOA+125:4810'
MOA+176:957.10'
MOA+131:120'
TAX+7+VAT+++:::19+S'
MOA+124:503.50'
TAX+7+VAT+++:::21+S'
MOA+124:453.60'
ALC+C++++FC'
MOA+131:120'
UNT+53+509010117'
UNE+1+5'
UNZ+2+131'

The same INVOIC as JSON

ediFabric turns every loop, segment and element into a named field. This is the transaction from the sample, in the JSON that ediFabric Native and Cloud return and accept.

{
  "UNH": {
    "MessageReferenceNumber_01": "509010117",
    "MessageIdentifier_02": {
      "MessageType_01": "INVOIC",
      "MessageVersionNumber_02": "D",
      "MessageReleaseNumber_03": "96A",
      "ControllingAgencyCoded_04": "UN"
    }
  },
  "BGM": {
    "DOCUMENTMESSAGENAME_01": {
      "Documentmessagenamecoded_01": "380"
    },
    "Documentmessagenumber_02": "IN432097"
  },
  "DTM": [
    {
      "DATETIMEPERIOD_01": {
        "Datetimeperiodqualifier_01": "137",
        "Datetimeperiod_02": "20020308",
        "Datetimeperiodformatqualifier_03": "102"
      }
    }
  ],
  "PAI": {
    "PAYMENTINSTRUCTIONDETAILS_01": {
      "Paymentmeanscoded_03": "42"
    }
  },
  "RFFLoop": [
    {
      "RFF": {
        "REFERENCE_01": {
          "Referencequalifier_01": "ON",
          "Referencenumber_02": "ORD9523"
        }
      },
      "DTM": [
        {
          "DATETIMEPERIOD_01": {
            "Datetimeperiodqualifier_01": "171",
            "Datetimeperiod_02": "20020212",
            "Datetimeperiodformatqualifier_03": "102"
          }
        }
      ]
    },
    {
      "RFF": {
        "REFERENCE_01": {
          "Referencequalifier_01": "PL",
          "Referencenumber_02": "PL99523"
        }
      },
      "DTM": [
        {
          "DATETIMEPERIOD_01": {
            "Datetimeperiodqualifier_01": "171",
            "Datetimeperiod_02": "20020101",
            "Datetimeperiodformatqualifier_03": "102"
          }
        }
      ]
    },
    {
      "RFF": {
        "REFERENCE_01": {
          "Referencequalifier_01": "DQ",
          "Referencenumber_02": "53662"
        }
      },
      "DTM": [
        {
          "DATETIMEPERIOD_01": {
            "Datetimeperiodqualifier_01": "171",
            "Datetimeperiod_02": "20020215",
            "Datetimeperiodformatqualifier_03": "102"
          }
        }
      ]
    }
  ],
  "NADLoop": [
    {
      "NAD": {
        "Partyqualifier_01": "BY",
        "PARTYIDENTIFICATIONDETAILS_02": {
          "Partyididentification_01": "5412345000013",
          "Codelistresponsibleagencycoded_03": "9"
        }
      },
      "RFFLoop": [
        {
          "RFF": {
            "REFERENCE_01": {
              "Referencequalifier_01": "VA",
              "Referencenumber_02": "4146023"
            }
          }
        }
      ]
    },
    {
      "NAD": {
        "Partyqualifier_01": "SU",
        "PARTYIDENTIFICATIONDETAILS_02": {
          "Partyididentification_01": "4012345500004",
          "Codelistresponsibleagencycoded_03": "9"
        }
      },
      "RFFLoop": [
        {
          "RFF": {
            "REFERENCE_01": {
              "Referencequalifier_01": "VA",
              "Referencenumber_02": "VR12345"
            }
          }
        }
      ]
    },
    {
      "NAD": {
        "Partyqualifier_01": "DP",
        "PARTYIDENTIFICATIONDETAILS_02": {
          "Partyididentification_01": "5412345678908",
          "Codelistresponsibleagencycoded_03": "9"
        }
      }
    }
  ],
  "CUXLoop": [
    {
      "CUX": {
        "CURRENCYDETAILS_01": {
          "Currencydetailsqualifier_01": "2",
          "Currencycoded_02": "EUR",
          "Currencyqualifier_03": "4"
        }
      }
    }
  ],
  "PATLoop": [
    {
      "PAT": {
        "Paymenttermstypequalifier_01": "1",
        "TERMSTIMEINFORMATION_03": {
          "Paymenttimereferencecoded_01": "5",
          "Timerelationcoded_02": "3",
          "Typeofperiodcoded_03": "M",
          "Numberofperiods_04": "2"
        }
      }
    },
    {
      "PAT": {
        "Paymenttermstypequalifier_01": "22",
        "TERMSTIMEINFORMATION_03": {
          "Paymenttimereferencecoded_01": "5",
          "Timerelationcoded_02": "3",
          "Typeofperiodcoded_03": "D",
          "Numberofperiods_04": "10"
        }
      },
      "PCD": {
        "PERCENTAGEDETAILS_01": {
          "Percentagequalifier_01": "12",
          "Percentage_02": "2.5",
          "Percentagebasiscoded_03": "13"
        }
      }
    }
  ],
  "ALCLoop": [
    {
      "ALC": {
        "Allowanceorchargequalifier_01": "C",
        "Settlementcoded_03": "6",
        "SPECIALSERVICESIDENTIFICATION_05": {
          "Specialservicescoded_01": "FC"
        }
      },
      "MOALoop": [
        {
          "MOA": {
            "MONETARYAMOUNT_01": {
              "Monetaryamounttypequalifier_01": "23",
              "Monetaryamount_02": "120"
            }
          }
        }
      ],
      "TAXLoop": [
        {
          "TAX": {
            "Dutytaxfeefunctionqualifier_01": "7",
            "DUTYTAXFEETYPE_02": {
              "Dutytaxfeetypecoded_01": "VAT"
            },
            "DUTYTAXFEEDETAIL_05": {
              "Dutytaxfeerate_04": "19"
            },
            "Dutytaxfeecategorycoded_06": "S"
          },
          "MOA": {
            "MONETARYAMOUNT_01": {
              "Monetaryamounttypequalifier_01": "124",
              "Monetaryamount_02": "22.80"
            }
          }
        }
      ]
    }
  ],
  "LINLoop": [
    {
      "LIN": {
        "Lineitemnumber_01": "1",
        "ITEMNUMBERIDENTIFICATION_03": {
          "Itemnumber_01": "4000862141404",
          "Itemnumbertypecoded_02": "SRS"
        }
      },
      "QTY": [
        {
          "QUANTITYDETAILS_01": {
            "Quantityqualifier_01": "47",
            "Quantity_02": "40"
          }
        }
      ],
      "MOALoop": [
        {
          "MOA": {
            "MONETARYAMOUNT_01": {
              "Monetaryamounttypequalifier_01": "203",
              "Monetaryamount_02": "2160"
            }
          }
        }
      ],
      "PRILoop": [
        {
          "PRI": {
            "PRICEINFORMATION_01": {
              "Pricequalifier_01": "AAB",
              "Price_02": "60",
              "Pricetypecoded_03": "CA"
            }
          }
        }
      ],
      "TAXLoop": [
        {
          "TAX": {
            "Dutytaxfeefunctionqualifier_01": "7",
            "DUTYTAXFEETYPE_02": {
              "Dutytaxfeetypecoded_01": "VAT"
            },
            "DUTYTAXFEEDETAIL_05": {
              "Dutytaxfeerate_04": "21"
            },
            "Dutytaxfeecategorycoded_06": "S"
          },
          "MOA": {
            "MONETARYAMOUNT_01": {
              "Monetaryamounttypequalifier_01": "124",
              "Monetaryamount_02": "453.60"
            }
          }
        }
      ],
      "ALCLoop": [
        {
          "ALC": {
            "Allowanceorchargequalifier_01": "A"
          },
          "PCDLoop": {
            "PCD": {
              "PERCENTAGEDETAILS_01": {
                "Percentagequalifier_01": "1",
                "Percentage_02": "10"
              }
            }
          }
        }
      ]
    },
    {
      "LIN": {
        "Lineitemnumber_01": "2",
        "ITEMNUMBERIDENTIFICATION_03": {
          "Itemnumber_01": "5412345111115",
          "Itemnumbertypecoded_02": "SRS"
        }
      },
      "QTY": [
        {
          "QUANTITYDETAILS_01": {
            "Quantityqualifier_01": "46",
            "Quantity_02": "5"
          }
        },
        {
          "QUANTITYDETAILS_01": {
            "Quantityqualifier_01": "47",
            "Quantity_02": "12.65",
            "Measureunitqualifier_03": "KGM"
          }
        }
      ],
      "MOALoop": [
        {
          "MOA": {
            "MONETARYAMOUNT_01": {
              "Monetaryamounttypequalifier_01": "203",
              "Monetaryamount_02": "2530"
            }
          }
        }
      ],
      "PRILoop": [
        {
          "PRI": {
            "PRICEINFORMATION_01": {
              "Pricequalifier_01": "AAA",
              "Price_02": "200",
              "Pricetypecoded_03": "CA",
              "Unitpricebasis_05": "1",
              "Measureunitqualifier_06": "KGM"
            }
          }
        }
      ],
      "TAXLoop": [
        {
          "TAX": {
            "Dutytaxfeefunctionqualifier_01": "7",
            "DUTYTAXFEETYPE_02": {
              "Dutytaxfeetypecoded_01": "VAT"
            },
            "DUTYTAXFEEDETAIL_05": {
              "Dutytaxfeerate_04": "19"
            },
            "Dutytaxfeecategorycoded_06": "S"
          },
          "MOA": {
            "MONETARYAMOUNT_01": {
              "Monetaryamounttypequalifier_01": "124",
              "Monetaryamount_02": "480.70"
            }
          }
        }
      ]
    }
  ],
  "UNS": {
    "Sectionidentification_01": "S"
  },
  "CNT": [
    {
      "CONTROL_01": {
        "Controlqualifier_01": "2",
        "Controlvalue_02": "2"
      }
    }
  ],
  "MOALoop": [
    {
      "MOA": {
        "MONETARYAMOUNT_01": {
          "Monetaryamounttypequalifier_01": "86",
          "Monetaryamount_02": "5767.10"
        }
      }
    },
    {
      "MOA": {
        "MONETARYAMOUNT_01": {
          "Monetaryamounttypequalifier_01": "79",
          "Monetaryamount_02": "4690"
        }
      }
    },
    {
      "MOA": {
        "MONETARYAMOUNT_01": {
          "Monetaryamounttypequalifier_01": "129",
          "Monetaryamount_02": "5767.10"
        }
      }
    },
    {
      "MOA": {
        "MONETARYAMOUNT_01": {
          "Monetaryamounttypequalifier_01": "125",
          "Monetaryamount_02": "4810"
        }
      }
    },
    {
      "MOA": {
        "MONETARYAMOUNT_01": {
          "Monetaryamounttypequalifier_01": "176",
          "Monetaryamount_02": "957.10"
        }
      }
    },
    {
      "MOA": {
        "MONETARYAMOUNT_01": {
          "Monetaryamounttypequalifier_01": "131",
          "Monetaryamount_02": "120"
        }
      }
    }
  ],
  "TAXLoop2": [
    {
      "TAX": {
        "Dutytaxfeefunctionqualifier_01": "7",
        "DUTYTAXFEETYPE_02": {
          "Dutytaxfeetypecoded_01": "VAT"
        },
        "DUTYTAXFEEDETAIL_05": {
          "Dutytaxfeerate_04": "19"
        },
        "Dutytaxfeecategorycoded_06": "S"
      },
      "MOA": [
        {
          "MONETARYAMOUNT_01": {
            "Monetaryamounttypequalifier_01": "124",
            "Monetaryamount_02": "503.50"
          }
        }
      ]
    },
    {
      "TAX": {
        "Dutytaxfeefunctionqualifier_01": "7",
        "DUTYTAXFEETYPE_02": {
          "Dutytaxfeetypecoded_01": "VAT"
        },
        "DUTYTAXFEEDETAIL_05": {
          "Dutytaxfeerate_04": "21"
        },
        "Dutytaxfeecategorycoded_06": "S"
      },
      "MOA": [
        {
          "MONETARYAMOUNT_01": {
            "Monetaryamounttypequalifier_01": "124",
            "Monetaryamount_02": "453.60"
          }
        }
      ]
    }
  ],
  "ALCLoop2": [
    {
      "ALC": {
        "Allowanceorchargequalifier_01": "C",
        "SPECIALSERVICESIDENTIFICATION_05": {
          "Specialservicescoded_01": "FC"
        }
      },
      "MOA": [
        {
          "MONETARYAMOUNT_01": {
            "Monetaryamounttypequalifier_01": "131",
            "Monetaryamount_02": "120"
          }
        }
      ]
    }
  ],
  "UNT": {
    "NumberofSegmentsinaMessage_01": "53",
    "MessageReferenceNumber_02": "509010117"
  }
}

Parse and validate an INVOIC file

Read the file into typed objects with ediFabric .NET, or post it to the ediFabric Cloud REST API from any language and get JSON back.

using EdiFabric.Templates.EdifactD96A;

License.SetSerial("YOUR_SERIAL_KEY");

using (var stream = File.OpenRead(@"C:\edi\Invoice.txt"))
using (var reader = new EdifactReader(stream, "EdiFabric.Templates.Edifact"))
{
    var items = await reader.ReadToEndAsync();
    foreach (var transaction in items.OfType<TSINVOIC>())
    {
        if (transaction.IsValid(out MessageErrorContext errors))
            Console.WriteLine($"{transaction.UNH.MessageReferenceNumber_01} is valid");
        else
            Console.WriteLine(string.Join(Environment.NewLine, errors.Flatten()));
    }
}
curl -X POST 'https://api.edination.com/v2/edifact/read' \
-H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \
-H 'Content-Type: application/octet-stream' \
--data-binary '@Invoice.txt'

Generate an INVOIC file

Populate a TSINVOIC object in .NET, or post JSON in the shape shown above to ediFabric Cloud, and get a valid INVOIC file back.

using EdiFabric.Templates.EdifactD96A;

License.SetSerial("YOUR_SERIAL_KEY");

var transaction = new TSINVOIC();

//  Message header
transaction.UNH = new UNH();
transaction.UNH.MessageReferenceNumber_01 = "0001";
transaction.UNH.MessageIdentifier_02 = new S009();
transaction.UNH.MessageIdentifier_02.MessageType_01 = "INVOIC";
transaction.UNH.MessageIdentifier_02.MessageVersionNumber_02 = "D";
transaction.UNH.MessageIdentifier_02.MessageReleaseNumber_03 = "96A";
transaction.UNH.MessageIdentifier_02.ControllingAgencyCoded_04 = "UN";

//  Commercial invoice number IN432097
transaction.BGM = new BGM();
transaction.BGM.DOCUMENTMESSAGENAME_01 = new C002();
transaction.BGM.DOCUMENTMESSAGENAME_01.Documentmessagenamecoded_01 = "380";
transaction.BGM.Documentmessagenumber_02 = "IN432097";

//  Repeating DTM
transaction.DTM = new List<DTM>();

// ... set the remaining loops and segments the same way

// SegmentBuilders is in the Common project of the example repository
using (var stream = new MemoryStream())
{
    using (var writer = new EdifactWriter(stream))
    {
        writer.Write(SegmentBuilders.BuildUnb("1"));
        writer.Write(transaction);
    }
    Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray()));
}
# the JSON returned by /read, edited or produced by your application
curl -X POST 'https://api.edination.com/v2/edifact/write' \
-H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \
-H 'Content-Type: application/json' \
--data-binary '@Invoice.json' \
-o 'Invoice.txt'

INVOIC questions

How is a credit note sent with INVOIC?

With the same message and BGM document code 381. Debit notes use 383.

Where are the invoice totals?

After UNS, in MOA segments such as 77 invoice amount, 79 total line items amount and 125 taxable amount, with TAX and MOA for each tax rate.

What is the X12 equivalent?

The X12 810 invoice.

How do I parse and generate EDIFACT INVOIC files in .NET?

In .NET, install EdiFabric and EdiFabric.Templates.Edifact, read the file with EdifactReader into TSINVOIC objects and write them back with EdifactWriter. From any other language, post the file to the ediFabric Cloud REST API, which returns the same structure as JSON and converts JSON back to EDIFACT.

Parse your first INVOIC in five minutes

The Community plan is free forever and needs no credit card. It includes ediFabric .NET, Native and Cloud.