Skip to main content

Print the Scan ID on POS Receipts

When you scan a customer's driver's license at the Shopify POS, Real ID attaches the scan ID to the order. You can update your printed receipt template to display this scan ID, so a record of the verification prints on every receipt for a scanned sale.

This is useful for:

  • Compliance and audit records
  • Giving customers a reference if they ever need to dispute a verification

The receipt will read:

Customer's ID scanned by Real ID. Scan ID: bKxg4YvNfM3

Before you start

Add products to the cart before scanning

For the scan ID to print on the receipt, at least one product must be in the cart before you scan the customer's ID.

Real ID attaches the scan ID to the first line item at the moment of scanning. An empty cart means there's no line item to attach to, and the receipt won't have anything to display.

If you open the Scan Drivers License tile with an empty cart, Real ID will prompt you to add items first.

Open the POS receipt code editor

The receipt template lives under Settings → Receipts → Receipt code editor in your Shopify admin.

For a walkthrough, watch this short screencast: How to open the POS receipt code editor.

Add the receipt code

Paste this snippet into the Printed receipt template, in the spot where you want the scan ID to appear — typically near the bottom, after totals and payment information:

{% assign scan_id = '' %}
{% for li in order.line_items %}
{% for p in li.custom_attributes %}
{% if p.first == 'real_id_scan_id' %}
{% assign scan_id = p.last %}
{% endif %}
{% endfor %}
{% endfor %}
{% if scan_id.size > 0 %}
<p>Customer's ID scanned by Real ID. Scan ID: {{ scan_id }}</p>
{% endif %}

The if scan_id.size > 0 check makes sure the line only prints when an ID was actually scanned for that sale. Non-scanned sales print the receipt without it, so you can add this snippet to your default template without affecting other orders.

Save the template, then use the Preview feature to test against an order that had an ID scanned. You should see the line render at the bottom of the preview.

Optional: debug snippet

If the line doesn't appear when you expect it to, drop this debug block into your receipt template and preview a receipt. It dumps everything the template can read about each line item's custom attributes, which helps you confirm whether the scan ID was actually attached.

<p>--- DEBUG START ---</p>
<p>order.line_items.size = {{ order.line_items.size }}</p>

{% for li in order.line_items %}
<p>--- order.line_items[{{ forloop.index0 }}] ---</p>
<p>name = {{ li.name }}</p>
<p>custom_attributes.size = {{ li.custom_attributes.size }}</p>
{% for p in li.custom_attributes %}
<p>ca[{{ forloop.index0 }}] first={{ p.first }} | last={{ p.last }}</p>
{% endfor %}
{% endfor %}
<p>--- DEBUG END ---</p>

For a scanned order, you should see something like:

--- order.line_items[0] ---
name = <product name>
custom_attributes.size = 1
ca[0] first=real_id_scan_id | last=<scan ID>

If custom_attributes.size = 0, the scan ID wasn't attached to that line item. The most common reason is an empty cart at scan time — see the warning above.

Remove the debug block once you've confirmed the production snippet works.

FAQs

Why doesn't an older order show the scan ID?

POS orders placed after May 30, 2026 carry the scan ID on a line item, which is what the receipt template reads from. Orders placed before that date don't have the scan ID in a place the receipt template can access, so the line won't render — even if the customer's ID was scanned at the time.

Re-printing a receipt for an older order won't display the scan ID. New orders going forward will work as expected.

Does this print on every receipt?

Only for sales where an ID was scanned through the Real ID POS tile. Receipts for unscanned sales print normally without the extra line, so it's safe to leave the snippet in your default template.

Can I customize the wording?

Yes. Change the text inside the <p>...</p> tag to anything you'd like. The {{ scan_id }} variable is the value that prints, so you can wrap it in any wording your receipt design needs.

What if I forget to add items to the cart before scanning?

The scan still verifies the customer's ID, but the receipt for that sale won't display the scan ID. You can look up the scan in your Real ID dashboard or in the order's note attributes from Shopify admin.

If you need help setting this up, contact us.