X12 820 Payroll Deducted and Other Group Premium Payment

The 820 in HIPAA (005010X218) is the payroll deducted and other group premium payment for insurance products. Employers and plan sponsors use it to pay health plan premiums and to say which members and coverages the payment covers.

BPR carries the payment, TRN its trace number, and ENT loops break the remittance down by organization or individual with RMR segments per premium. Health insurance exchanges use a separate 820 (005010X306) for payments to issuers.

At a glance

Standard
X12 HIPAA
Implementation guide
005010X218
Functional group
RA (GS01)
Sent by
Employer or plan sponsor to health plan
Responses
999
ediFabric .NET template
TS820 in EdiFabric.Templates.Hipaa
OpenEDI definition
View 820 in the spec library

820 structure

The full X12 820 layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 15 loops and 41 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
STTransaction Set HeaderRequired1
BPRFinancial InformationRequired1
TRNReassociation Trace NumberRequired1
CURForeign Currency InformationSituational1
REFPremium Receivers Identification KeySituational>1
Any orderThe loops below can appear in any orderSituational1
DTMProcess DateSituational1
DTMDelivery DateSituational1
DTMCoverage PeriodSituational1
DTMCreation DateSituational1
Any orderThe loops below can appear in any orderRequired1
Loop 1000APremium Receiver NameRequired1
N1Premium Receiver NameRequired1
N2Premium Receiver Additional NameSituational1
N3Premium Receiver AddressSituational1
N4Premium Receiver City State ZIP CodeSituational1
RDMPremium Receiver Remittance Delivery MethodSituational1
Loop 1000BPremium Payer NameRequired1
N1Premium Payer NameRequired1
N2Premium Payer Additional NameSituational1
N3Premium Payer AddressSituational1
N4Premium Payer City State ZIP CodeSituational1
PERPremium Payer Administrative ContactSituational>1
Loop 1000CIntermediary Bank InformationSituational14
N1Intermediary Bank InformationRequired1
N2Intermediary Bank Additional NameSituational1
N3Intermediary Bank AddressSituational1
N4Intermediary Bank City State ZIP CodeSituational1
PERIntermediary Bank Administrative ContactSituational>1
Any orderThe loops below can appear in any orderSituational1
Loop 2000AOrganization Summary RemittanceSituational1
ENTOrganization Summary RemittanceRequired1
Loop 2200AOrganization Summary Remittance Level Adjustmentfor Previous PaymentSituational>1
ADXOrganization Summary Remittance Level Adjustmentfor Previous PaymentRequired1
Loop 2300AOrganization Summary Remittance DetailRequired>1
RMROrganization Summary Remittance DetailRequired1
REFReference InformationSituational>1
DTMOrganizational Coverage PeriodSituational1
Loop 2310ASummary Line ItemSituational1
IT1Summary Line ItemRequired1
Loop 2312AService Promotion Allowance Charge InformationSituational4
SACService Promotion Allowance Charge InformationRequired1
Loop 2315AMember CountSituational3
SLNMember CountRequired1
Loop 2320AOrganization Summary Remittance Level Adjustmentfor Current PaymentSituational>1
ADXOrganization Summary Remittance Level Adjustmentfor Current PaymentRequired1
Loop 2000BIndividual RemittanceSituational99999999
ENTIndividual RemittanceRequired1
Loop 2100BIndividual NameSituational>1
NM1Individual NameRequired1
Loop 2200BIndividual Premium Adjustmentfor Previous PaymentSituational>1
ADXIndividual Premium Adjustmentfor Previous PaymentRequired1
Loop 2300BIndividual Premium Remittance DetailRequired>1
RMRIndividual Premium Remittance DetailRequired1
REFReference InformationSituational>1
DTMIndividual Coverage PeriodSituational1
Loop 2320BIndividual Premium Adjustmentfor Current PaymentSituational>1
ADXIndividual Premium Adjustmentfor Current PaymentRequired1
SETransaction Set TrailerRequired1

Usage follows the 005010X218 implementation guide: Required segments must be sent, Situational ones only when the guide's condition 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 820 file

A premium payment with remittance detail for the covered members. Paste it into EdiNation to see every element named and validated.

ISA*00*          *00*          *ZZ*1234567        *ZZ*11111          *170508*1141*^*00501*000000101*1*P*:~
GS*HC*XXXXXXX*XXXXX*20170617*1741*101*X*005010X218~
ST*820*0001*005010X218~
BPR*C*19000*C*ACH*CTX*01*999999992*DA*12345678*1030449999**01*199999999*DA*98765*20070516~
TRN*1*12345*1030449999~
REF*14*12345~
N1*PE*DEF HEALTH CARE INC.*FI*012222222~
N1*PR*ABC PLASTICS*FI*123456789~
ENT*1*2L*FI*123456789~
RMR*IK*970501001*PI*16500~
IT1*1~
SLN*1**O*5*IE~
SLN*2**O*75*10~
RMR*IK*970501002*PI*250~
IT1*1~
SLN*1**O*25*IE~
SE*15*0001~
GE*1*101~
IEA*1*000000101~

The same 820 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.

{
  "ST": {
    "TransactionSetIdentifierCode_01": "820",
    "TransactionSetControlNumber_02": "0001",
    "ImplementationConventionPreference_03": "005010X218"
  },
  "BPR_FinancialInformation": {
    "TransactionHandlingCode_01": "C",
    "TotalPremiumPaymentAmount_02": "19000",
    "CreditorDebitFlagCode_03": "C",
    "PaymentMethodCode_04": "ACH",
    "PaymentFormatCode_05": "CTX",
    "DepositoryFinancialInstitutionDFIIdentificationNumberQualifier_06": "01",
    "OriginatingDepositoryFinancialInstitutionDFIIdentifier_07": "999999992",
    "AccountNumberQualifier_08": "DA",
    "SenderBankAccountNumber_09": "12345678",
    "PayerIdentifier_10": "1030449999",
    "DepositoryFinancialInstitutionDFIIdentificationNumberQualifier_12": "01",
    "ReceivingDepositoryFinancialInstitutionDFIIdentifier_13": "199999999",
    "AccountNumberQualifier_14": "DA",
    "ReceiverBankAccountNumber_15": "98765",
    "CheckIssueorEFTEffectiveDate_16": "20070516"
  },
  "TRN_ReassociationTraceNumber": {
    "TraceTypeCode_01": "1",
    "CurrentTransactionTraceNumber_02": "12345",
    "OriginatingCompanyIdentifier_03": "1030449999"
  },
  "REF_PremiumReceiversIdentificationKey": [
    {
      "ReferenceIdentificationQualifier_01": "14",
      "MemberGrouporPolicyNumber_02": "12345"
    }
  ],
  "AllN1": {
    "Loop1000A": {
      "N1_PremiumReceiver_Name": {
        "EntityIdentifierCode_01": "PE",
        "PremiumPayerName_02": "DEF HEALTH CARE INC.",
        "IdentificationCodeQualifier_03": "FI",
        "IntermediaryBankIdentifier_04": "012222222"
      }
    },
    "Loop1000B": {
      "N1_PremiumPayer_Name": {
        "EntityIdentifierCode_01": "PR",
        "PremiumPayerName_02": "ABC PLASTICS",
        "IdentificationCodeQualifier_03": "FI",
        "IntermediaryBankIdentifier_04": "123456789"
      }
    }
  },
  "AllENT": {
    "Loop2000A": {
      "ENT_OrganizationSummaryRemittance": {
        "AssignedNumber_01": "1",
        "EntityIdentifierCode_02": "2L",
        "IdentificationCodeQualifier_03": "FI",
        "ReceiversIndividualIdentifier_04": "123456789"
      },
      "Loop2300A": [
        {
          "RMR_OrganizationSummaryRemittanceDetail": {
            "ReferenceIdentificationQualifier_01": "IK",
            "InsuranceRemittanceReferenceNumber_02": "970501001",
            "PaymentActionCode_03": "PI",
            "DetailPremiumPaymentAmount_04": "16500"
          },
          "Loop2310A": {
            "IT1_SummaryLineItem": {
              "LineItemControlNumber_01": "1"
            },
            "Loop2315A": [
              {
                "SLN_MemberCount": {
                  "LineItemControlNumber_01": "1",
                  "InformationOnlyIndicator_03": "O",
                  "HeadCount_04": "5",
                  "CompositeUnitOfMeasure_05": {
                    "UnitorBasisforMeasurementCode_01": "IE"
                  }
                }
              },
              {
                "SLN_MemberCount": {
                  "LineItemControlNumber_01": "2",
                  "InformationOnlyIndicator_03": "O",
                  "HeadCount_04": "75",
                  "CompositeUnitOfMeasure_05": {
                    "UnitorBasisforMeasurementCode_01": "10"
                  }
                }
              }
            ]
          }
        },
        {
          "RMR_OrganizationSummaryRemittanceDetail": {
            "ReferenceIdentificationQualifier_01": "IK",
            "InsuranceRemittanceReferenceNumber_02": "970501002",
            "PaymentActionCode_03": "PI",
            "DetailPremiumPaymentAmount_04": "250"
          },
          "Loop2310A": {
            "IT1_SummaryLineItem": {
              "LineItemControlNumber_01": "1"
            },
            "Loop2315A": [
              {
                "SLN_MemberCount": {
                  "LineItemControlNumber_01": "1",
                  "InformationOnlyIndicator_03": "O",
                  "HeadCount_04": "25",
                  "CompositeUnitOfMeasure_05": {
                    "UnitorBasisforMeasurementCode_01": "IE"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  },
  "SE": {
    "NumberofIncludedSegments_01": "15",
    "TransactionSetControlNumber_02": "0001"
  }
}

Parse and validate an 820 file

Read the file into typed objects with ediFabric .NET, convert it to JSON in process with the ediFabric Native bindings for Python, Java and C, or post it to the ediFabric Cloud REST API from any language.

using EdiFabric.Templates.Hipaa5010;

License.SetSerial("YOUR_SERIAL_KEY");

using (var stream = File.OpenRead(@"C:\edi\PaymentOrder.txt"))
using (var reader = new X12Reader(stream, "EdiFabric.Templates.Hipaa"))
{
    var items = await reader.ReadToEndAsync();
    foreach (var transaction in items.OfType<TS820>())
    {
        if (transaction.IsValid(out MessageErrorContext errors))
            Console.WriteLine($"{transaction.ST.TransactionSetControlNumber_02} is valid");
        else
            Console.WriteLine(string.Join(Environment.NewLine, errors.Flatten()));
    }
}
import json
import edifabric_x12 as ef

serial = "YOUR_SERIAL_KEY"
ef.load_library()
ef.set_serial(serial)
ef.set_map(json.dumps({"default": serial, "maps": {}}))

edi = open("PaymentOrder.txt", "rb").read()
output, offset = ef.parse(edi, ef.ParseMode.JSON_VALIDATE)
transactions = output[:offset]
report = json.loads(output[offset:])
print(report["errors_count"])
import com.edifabric.nativex12.EdiFabricX12;
import com.edifabric.nativex12.ParseMode;
import com.edifabric.nativex12.ParseResult;

String serial = "YOUR_SERIAL_KEY";
EdiFabricX12.loadLibrary();
EdiFabricX12.setSerial(serial);
EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}");

String edi = Files.readString(Path.of("PaymentOrder.txt"));
ParseResult result = EdiFabricX12.parse(edi, ParseMode.JSON_VALIDATE);
System.out.println(result.getTransactions());
System.out.println(result.getReport());
#include "edifabric_x12.h"

const char *serial = "YOUR_SERIAL_KEY";
ef_parse_result result;

if (ef_load_library(NULL) != 0)
    return 1;
ef_set_serial(serial);
ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}");

char *edi = read_file("PaymentOrder.txt", NULL);   /* helper in example_all_functions.c */
if (ef_parse(edi, EF_PARSE_JSON_VALIDATE, NULL, &result) == 0) {
    /* transactions = output[0 .. offset), report = output[offset .. length) */
    fwrite(result.output.data, 1, (size_t)result.output.length, stdout);
    ef_free(result.output.data);
}
curl -X POST 'https://api.edination.com/v2/x12/read' \
-H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \
-H 'Content-Type: application/octet-stream' \
--data-binary '@PaymentOrder.txt'

Generate an 820 file

Populate a TS820 object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 820 file back.

using EdiFabric.Templates.Hipaa5010;

License.SetSerial("YOUR_SERIAL_KEY");

var transaction = new TS820();

//  Beginning of an 820 transaction set, Control number = 0001.
transaction.ST = new ST();
transaction.ST.TransactionSetIdentifierCode_01 = "820";
transaction.ST.TransactionSetControlNumber_02 = "0001";
transaction.ST.ImplementationConventionPreference_03 = "005010X218";

// ... 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 X12Writer(stream))
    {
        writer.Write(SegmentBuilders.BuildIsa("1"));
        writer.Write(SegmentBuilders.BuildGs("1", "SENDER1", "RECEIVER1", "005010X218"));
        writer.Write(transaction);
    }
    Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray()));
}
import json
import edifabric_x12 as ef

serial = "YOUR_SERIAL_KEY"
ef.load_library()
ef.set_serial(serial)
ef.set_map(json.dumps({"default": serial, "maps": {}}))

# the transactions JSON returned by ef.parse, edited or produced by your application
transactions = open("PaymentOrder.json", "rb").read()
edi = ef.build(transactions, postfix="\r\n")
print(edi)
import com.edifabric.nativex12.EdiFabricX12;

String serial = "YOUR_SERIAL_KEY";
EdiFabricX12.loadLibrary();
EdiFabricX12.setSerial(serial);
EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}");

// the transactions JSON returned by parse, edited or produced by your application
String transactions = Files.readString(Path.of("PaymentOrder.json"));
String edi = EdiFabricX12.build(transactions, "\r\n");
System.out.println(edi);
#include "edifabric_x12.h"

ef_buffer edi;

if (ef_load_library(NULL) != 0)
    return 1;
ef_set_serial("YOUR_SERIAL_KEY");
ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}");

/* the transactions JSON returned by ef_parse, edited or produced by your application */
char *transactions = read_file("PaymentOrder.json", NULL);
if (ef_build(transactions, "\r\n", &edi) == 0) {
    fwrite(edi.data, 1, (size_t)edi.length, stdout);
    ef_free(edi.data);
}
# the JSON returned by /read, edited or produced by your application
curl -X POST 'https://api.edination.com/v2/x12/write' \
-H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \
-H 'Content-Type: application/json' \
--data-binary '@PaymentOrder.json' \
-o 'PaymentOrder.txt'

820 questions

What is the difference between the HIPAA 820 and the 820 HIX?

005010X218 is used by employers and sponsors to pay group premiums. 005010X306 is used between health insurance exchanges and issuers for exchange-related premium payments.

How is an 820 matched with the money?

TRN02 is the trace number that also travels with the funds transfer, and BPR02 is the total amount.

Is the 820 related to the 834?

Yes. The 834 enrolls the members, the 820 pays the premiums for them. Both usually come from the same employer or sponsor.

How do I parse and generate X12 820 files in .NET, Python, Java and C?

In .NET, install EdiFabric and EdiFabric.Templates.Hipaa, read the file with X12Reader into TS820 objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 820 files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.

Parse your first 820 in five minutes

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