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.
D96ATSINVOIC in EdiFabric.Templates.EdifactThe 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 |
|---|---|---|---|
UNH | Message header | Mandatory | 1 |
BGM | Beginning of message | Mandatory | 1 |
DTM | Date/time/period | Mandatory | 35 |
PAI | Payment instructions | Optional | 1 |
ALI | Additional information | Optional | 5 |
IMD | Item description | Optional | 1 |
FTX | Free text | Optional | 10 |
| RFF loop | Reference | Optional | 99 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| NAD loop | Name and address | Optional | 99 |
NAD | Name and address | Mandatory | 1 |
LOC | Place/location identification | Optional | 25 |
FII | Financial institution information | Optional | 5 |
| RFF loop | Reference | Optional | 9999 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| DOC loop | Document/message details | Optional | 5 |
DOC | Document/message details | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| CTA loop | Contact information | Optional | 5 |
CTA | Contact information | Mandatory | 1 |
COM | Communication contact | Optional | 5 |
| TAX loop | Duty/tax/fee details | Optional | 5 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
LOC | Place/location identification | Optional | 5 |
| CUX loop | Currencies | Optional | 5 |
CUX | Currencies | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| PAT loop | Payment terms basis | Optional | 10 |
PAT | Payment terms basis | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
PCD | Percentage details | Optional | 1 |
MOA | Monetary amount | Optional | 1 |
PAI | Payment instructions | Optional | 1 |
FII | Financial institution information | Optional | 1 |
| TDT loop | Details of transport | Optional | 10 |
TDT | Details of transport | Mandatory | 1 |
| LOC loop | Place/location identification | Optional | 10 |
LOC | Place/location identification | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| RFF loop | Reference | Optional | 9999 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| TOD loop | Terms of delivery or transport | Optional | 5 |
TOD | Terms of delivery or transport | Mandatory | 1 |
LOC | Place/location identification | Optional | 2 |
| PAC loop | Package | Optional | 1000 |
PAC | Package | Mandatory | 1 |
MEA | Measurements | Optional | 5 |
| PCI loop | Package identification | Optional | 5 |
PCI | Package identification | Mandatory | 1 |
RFF | Reference | Optional | 1 |
DTM | Date/time/period | Optional | 5 |
GIN | Goods identity number | Optional | 5 |
| ALC loop | Allowance or charge | Optional | 9999 |
ALC | Allowance or charge | Mandatory | 1 |
ALI | Additional information | Optional | 5 |
| RFF loop | Reference | Optional | 5 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| QTY loop | Quantity | Optional | 1 |
QTY | Quantity | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| PCD loop | Percentage details | Optional | 1 |
PCD | Percentage details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| MOA loop | Monetary amount | Optional | 2 |
MOA | Monetary amount | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| RTE loop | Rate details | Optional | 1 |
RTE | Rate details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| TAX loop | Duty/tax/fee details | Optional | 5 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
| RCS loop | Requirements and conditions | Optional | 100 |
RCS | Requirements and conditions | Mandatory | 1 |
RFF | Reference | Optional | 5 |
DTM | Date/time/period | Optional | 5 |
FTX | Free text | Optional | 5 |
| AJT loop | Adjustment details | Optional | 1 |
AJT | Adjustment details | Mandatory | 1 |
FTX | Free text | Optional | 5 |
| INP loop | Parties and instruction | Optional | 1 |
INP | Parties and instruction | Mandatory | 1 |
FTX | Free text | Optional | 5 |
| LIN loop | Line item | Optional | 9999999 |
LIN | Line item | Mandatory | 1 |
PIA | Additional product id | Optional | 25 |
IMD | Item description | Optional | 10 |
MEA | Measurements | Optional | 5 |
QTY | Quantity | Optional | 5 |
PCD | Percentage details | Optional | 1 |
ALI | Additional information | Optional | 5 |
DTM | Date/time/period | Optional | 35 |
GIN | Goods identity number | Optional | 1000 |
GIR | Related identification numbers | Optional | 1000 |
QVR | Quantity variances | Optional | 1 |
EQD | Equipment details | Optional | 1 |
FTX | Free text | Optional | 5 |
| MOA loop | Monetary amount | Optional | 5 |
MOA | Monetary amount | Mandatory | 1 |
CUX | Currencies | Optional | 1 |
| PAT loop | Payment terms basis | Optional | 10 |
PAT | Payment terms basis | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
PCD | Percentage details | Optional | 1 |
MOA | Monetary amount | Optional | 1 |
| PRI loop | Price details | Optional | 25 |
PRI | Price details | Mandatory | 1 |
APR | Additional price information | Optional | 1 |
RNG | Range details | Optional | 1 |
DTM | Date/time/period | Optional | 5 |
| RFF loop | Reference | Optional | 10 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| PAC loop | Package | Optional | 10 |
PAC | Package | Mandatory | 1 |
MEA | Measurements | Optional | 5 |
| PCI loop | Package identification | Optional | 5 |
PCI | Package identification | Mandatory | 1 |
RFF | Reference | Optional | 1 |
DTM | Date/time/period | Optional | 5 |
GIN | Goods identity number | Optional | 5 |
| LOC loop | Place/location identification | Optional | 9999 |
LOC | Place/location identification | Mandatory | 1 |
QTY | Quantity | Optional | 100 |
DTM | Date/time/period | Optional | 5 |
| TAX loop | Duty/tax/fee details | Optional | 99 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
LOC | Place/location identification | Optional | 5 |
| NAD loop | Name and address | Optional | 20 |
NAD | Name and address | Mandatory | 1 |
LOC | Place/location identification | Optional | 5 |
| RFF loop | Reference | Optional | 5 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| DOC loop | Document/message details | Optional | 5 |
DOC | Document/message details | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| CTA loop | Contact information | Optional | 5 |
CTA | Contact information | Mandatory | 1 |
COM | Communication contact | Optional | 5 |
| ALC loop | Allowance or charge | Optional | 15 |
ALC | Allowance or charge | Mandatory | 1 |
ALI | Additional information | Optional | 5 |
DTM | Date/time/period | Optional | 5 |
| QTY loop | Quantity | Optional | 1 |
QTY | Quantity | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| PCD loop | Percentage details | Optional | 1 |
PCD | Percentage details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| MOA loop | Monetary amount | Optional | 2 |
MOA | Monetary amount | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| RTE loop | Rate details | Optional | 1 |
RTE | Rate details | Mandatory | 1 |
RNG | Range details | Optional | 1 |
| TAX loop | Duty/tax/fee details | Optional | 5 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 1 |
| TDT loop | Details of transport | Optional | 10 |
TDT | Details of transport | Mandatory | 1 |
| LOC loop | Place/location identification | Optional | 10 |
LOC | Place/location identification | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| TOD loop | Terms of delivery or transport | Optional | 5 |
TOD | Terms of delivery or transport | Mandatory | 1 |
LOC | Place/location identification | Optional | 2 |
| RCS loop | Requirements and conditions | Optional | 100 |
RCS | Requirements and conditions | Mandatory | 1 |
RFF | Reference | Optional | 5 |
DTM | Date/time/period | Optional | 5 |
FTX | Free text | Optional | 5 |
UNS | Section control | Mandatory | 1 |
CNT | Control total | Optional | 10 |
| MOA loop | Monetary amount | Mandatory | 100 |
MOA | Monetary amount | Mandatory | 1 |
| RFF loop | Reference | Optional | 1 |
RFF | Reference | Mandatory | 1 |
DTM | Date/time/period | Optional | 5 |
| TAX loop | Duty/tax/fee details | Optional | 10 |
TAX | Duty/tax/fee details | Mandatory | 1 |
MOA | Monetary amount | Optional | 2 |
| ALC loop | Allowance or charge | Optional | 15 |
ALC | Allowance or charge | Mandatory | 1 |
ALI | Additional information | Optional | 1 |
MOA | Monetary amount | Optional | 2 |
UNT | Message trailer | Mandatory | 1 |
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.
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'
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"
}
}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'
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'
With the same message and BGM document code 381. Debit notes use 383.
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.
The X12 810 invoice.
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.