Starlight
2026-03-04·11 min read

Pharmacy POS Claims Integration: Connect to Insurance

If you build pharmacy software (a POS system, pharmacy management system, or any application that touches prescriptions), claims processing is the hardest integration you'll face. The NCPDP Telecommunication Standard D.0 protocol is complex, poorly documented outside of NCPDP membership, and unforgiving of errors. This guide explains the architecture, the pain points, and how modern APIs are changing the game for POS/PMS vendors.

How pharmacy claims flow today

Every pharmacy claim follows the same path, regardless of which POS system initiates it:

POS/PMSBuilds NCPDP D.0 message (binary, field-level encoding)
SwitchRoutes claim by BIN to the correct PBM/processor
PBMAdjudicates: checks eligibility, formulary, pricing, DUR
ResponsePaid/rejected response flows back through switch to POS

The POS system is responsible for the hardest part: encoding and decoding NCPDP D.0 messages correctly. This is where most of the integration complexity lives.

The NCPDP integration challenge

Here's what building an NCPDP integration actually requires:

Binary protocol

NCPDP D.0 uses field separators (0x1C), segment separators (0x1E), and group separators (0x1D). Fields are identified by 2-character codes (e.g., "AM" for pharmacy provider ID, "C2" for patient ID). One misplaced byte corrupts the entire message.

400+ field definitions

The NCPDP spec defines hundreds of fields across multiple segments (header, patient, insurance, claim, pricing, DUR/PPS, prescriber, etc.). Each payer may require different subsets of these fields.

Payer-specific requirements

Every PBM has a "payer sheet" specifying which fields they require, which they ignore, and their specific validation rules. CVS Caremark expects different fields than Express Scripts. You need to maintain dozens of payer configurations.

Certification testing

Before going live, you must pass NCPDP certification, a formal test suite that validates your encoder/decoder handles all transaction types, edge cases, and error scenarios correctly.

Switch connectivity

You need a contract with at least one pharmacy switch for production routing. This involves VPN/dedicated line setup, IP whitelisting, and ongoing connectivity monitoring.

For established POS vendors like PioneerRx, Liberty Software, or BestRx, this integration represents years of accumulated work. For a new entrant, it's a 6–12 month project minimum.

The middleware approach: API as claims layer

Instead of implementing NCPDP natively, modern POS systems can use Starlight API as a claims middleware layer. Your POS sends JSON, Starlight handles NCPDP encoding, switch routing, and response parsing:

// Your POS submits a claim (no NCPDP encoding needed)
const response = await fetch('https://starlight.claims/api/v1/submit', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.STARLIGHT_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    transaction_type: 'B1',
    patient: {
      first_name: patient.firstName,
      last_name: patient.lastName,
      date_of_birth: patient.dob,
      gender: patient.gender,
      zip_code: patient.zip
    },
    insurance: {
      bin_number: insurance.bin,
      pcn: insurance.pcn,
      group_id: insurance.groupId,
      cardholder_id: insurance.memberId,
      person_code: insurance.personCode,
      relationship_code: insurance.relationship
    },
    prescription: {
      rx_number: rx.number,
      fill_number: rx.fillNumber,
      product_id: rx.ndc,
      quantity_dispensed: rx.quantity,
      days_supply: rx.daysSupply,
      date_written: rx.dateWritten,
      daw_code: rx.daw,
      prescriber_id: prescriber.npi,
      prescriber_last_name: prescriber.lastName,
      prescriber_phone: prescriber.phone
    },
    pricing: {
      ingredient_cost: rx.ingredientCost,
      dispensing_fee: rx.dispensingFee,
      usual_customary: rx.ucPrice,
      gross_amount_due: rx.grossDue
    }
  })
});

const result = await response.json();
// result.header.responseStatus === 'A' → claim paid
// result.pricing.patientPayAmount → what to charge the patient

What this means for POS architecture

Using an API claims layer changes your system architecture significantly:

NCPDP encoder/decoder (10K+ lines)HTTP client + JSON serialization
Switch VPN/connectivity managementStandard HTTPS (TLS 1.3)
Payer sheet database (100+ payer configs)Handled by API provider
NCPDP certification processNot required
Binary protocol debuggingJSON request/response logging
Switch contract negotiationAPI key signup

Your POS focuses on what it does best (prescription workflow, inventory management, patient interaction) while the claims layer is offloaded to a purpose-built service.

The complete claims workflow for POS

A production-ready claims integration in your POS should follow this sequence:

  • 1.Insurance capture: Scan or enter patient's insurance card. Store BIN, PCN, Group, Member ID, Person Code.
  • 2.E1 eligibility check: Verify coverage before filling. Catches expired plans, wrong member IDs, and BIN routing issues. E1 API docs →
  • 3.Fill prescription: Pharmacist verifies, fills, and prices the prescription in your POS.
  • 4.B1 claim submission: Submit the claim with patient, insurance, prescription, and pricing data. Receive adjudication result in real time. B1 API docs →
  • 5.Handle response: If paid, display patient copay. If rejected, show reject codes with resolution guidance.
  • 6.B2 reversal (if needed): If the patient doesn't pick up or the fill was incorrect, reverse the claim. B2 API docs →

Performance considerations

Pharmacy staff expect claims to resolve in 2–5 seconds. Your integration needs to account for:

  • Timeouts: Set a 30-second timeout on claims requests. If a switch or PBM is slow, show the pharmacist a clear "waiting for response" indicator rather than hanging.
  • Retry logic: Network blips happen. Implement idempotent retries with the same claim reference number to avoid duplicate submissions.
  • Offline handling: If your POS loses internet, queue claims locally and submit when connectivity returns. Track which claims are pending vs. confirmed.
  • Concurrent claims: A busy pharmacy may submit 5–10 claims simultaneously across multiple terminals. Your HTTP client should handle concurrent requests without blocking the UI.

DUR (Drug Utilization Review) handling

PBMs perform Drug Utilization Review on every claim and may return DUR conflict codes. Your POS needs to:

  • Display DUR messages: Drug interactions, therapeutic duplications, early refill warnings. These are clinically important.
  • Support DUR overrides: Pharmacists may need to resubmit with DUR/PPS codes indicating they've reviewed and approved the fill despite the warning.
  • Log DUR responses: Required for compliance and audit trails.

Related guides

Add claims to your POS in days, not months

Starlight handles NCPDP encoding, switch connectivity, and payer sheet management. Your POS sends JSON, gets JSON back.