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

# Payment Note

> Query the notes attached to Elation Billing payments, including who wrote each note and when.

One row per note per payment - the notes recorded against an Elation Billing payment, carrying the note text, who wrote it, and when. Notes arrive by two paths: a billing user working the payment in Elation Billing, or the EHR patient-payment integration posting a payment taken in the EHR. Only the first carries an `elation_billing_user_id`. Filter on `is_deleted = false` to exclude notes that have since been removed.

This table's columns and relationships are shown in the [Hosted Database schema](/articles/hdb/schema).

<Note>
  `payment_note.payment_id` joins to [payment](/articles/hdb/payment)`.id`. `payment_note.elation_billing_user_id` joins to `elation_billing_user.id` and is an Elation Billing user identifier, not an Elation EHR user id.

  A null `elation_billing_user_id` means the note was created by the EHR patient-payment integration rather than by a person, which is the majority of notes today. Null here means system-created, not unknown.

  `author_login` is a point-in-time snapshot of the author's login taken when the note was written, so it will not always match the current `elation_billing_user.email` - a user who was later deactivated or renamed keeps their old login on historical notes. Treat it as display text and do not join on it.
</Note>

**For reporting on but not limited to:**

* The full note history on a single payment, in the order it was written
* Separating notes a biller wrote from notes the EHR patient-payment integration posted
* Note volume per biller over a date range
* Adding narrative context to a payment reconciliation report
* Auditing what was said about a payment that was later adjusted or reversed

## Note history for a payment

Returns every note on a single payment, oldest first. `author_login` is the fallback for notes with no billing user, which is where the EHR patient-payment integration notes show up.

<CodeGroup>
  ```sql sql theme={null}
  select
      n.id as payment_note_id
    , n.created_timestamp
    , coalesce(concat(u.first_name, ' ', u.last_name), n.author_login) as author
    , n.author_login
    , n.note
  from payment_note n
    left join elation_billing_user u on u.id = n.elation_billing_user_id
  where n.is_deleted = false
    and n.payment_id = 1234567890  -- Replace with actual payment ID
  order by n.created_timestamp;
  ```
</CodeGroup>

## Biller notes versus integration notes

Splits notes by where they came from. Notes posted by the EHR patient-payment integration have no billing user and their text is prefixed `INTERNAL MEMO - `.

<CodeGroup>
  ```sql sql theme={null}
  select
      case
        when n.elation_billing_user_id is null then 'EHR patient payment integration'
        else 'Billing user'
      end as note_source
    , count(*) as notes
    , count(distinct n.payment_id) as distinct_payments
    , min(n.created_timestamp) as earliest_note
    , max(n.created_timestamp) as most_recent_note
  from payment_note n
  where n.is_deleted = false
  group by 1
  order by notes desc;
  ```
</CodeGroup>

## Note volume per biller

Ranks billers by how many payment notes they wrote over the last 90 days. Integration notes are excluded because they have no billing user.

<CodeGroup>
  ```sql sql theme={null}
  select
      concat(u.first_name, ' ', u.last_name) as author_name
    , u.email as author_email
    , count(*) as notes_written
    , count(distinct n.payment_id) as distinct_payments
    , max(n.created_timestamp) as most_recent_note
  from payment_note n
    inner join elation_billing_user u on u.id = n.elation_billing_user_id
  where n.is_deleted = false
    and n.created_timestamp >= dateadd(day, -90, current_date)
  group by u.first_name, u.last_name, u.email
  order by notes_written desc;
  ```
</CodeGroup>

## Recent payments with their notes

Pairs each payment from the last 30 days with its notes, plus the patient and practice the payment belongs to.

<CodeGroup>
  ```sql sql theme={null}
  select
      p.id as payment_id
    , p.local_id
    , p.payment_date
    , p.amount
    , p.pay_type
    , concat(pat.first_name, ' ', pat.last_name) as patient_name
    , pr.name as practice_name
    , n.created_timestamp as note_timestamp
    , coalesce(concat(u.first_name, ' ', u.last_name), n.author_login) as author
    , n.note
  from payment_note n
    inner join payment p on p.id = n.payment_id
    left join patient pat on pat.id = p.patient_id
    left join practice pr on pr.id = p.practice_id
    left join elation_billing_user u on u.id = n.elation_billing_user_id
  where n.is_deleted = false
    and p.is_deleted = false
    and p.payment_date >= dateadd(day, -30, current_date)
  order by p.payment_date desc, n.created_timestamp;
  ```
</CodeGroup>

*If you have any questions about this topic please reach out to [Elation Support Portal](/articles/support-portal-introduction) with the subject line HDB - \<your\_question>*
