Adds scan link handling and a client-side scanner for Payload. Sites register link kinds with a pattern, site scope, staff check and resolver, and the plugin answers each scan based on who is signed in, with rate limits and fail-closed behaviour. React components read codes from a phone camera or USB scanner. Requires Payload 3.80 or newer and a thin Next route per kind.
Scan for Payload: read barcodes and QR codes with a phone camera or a USB scanner, and answer scan links by who is signed in, without letting codes be probed.
Installation
npm i @extantape/payload-plugin-scan0
Stars
0
Forks
0
Open Issues
6 days ago
Last Updated
313
Weekly Downloads
v0.1.1
npm Version
52.7 KB
Unpacked Size
0
Dependencies
00 since Nov 8
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
302+302 since Nov 14
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 302 |
| Dec 4, 2026 | 293 |
| Dec 3, 2026 | 263 |
| Dec 2, 2026 | 242 |
| Dec 1, 2026 | 32 |
| Nov 30, 2026 | 27 |
| Nov 29, 2026 | 30 |
| Nov 28, 2026 | 29 |
| Nov 27, 2026 | 28 |
| Nov 26, 2026 | 23 |
| Nov 25, 2026 | 26 |
| Nov 24, 2026 | 31 |
| Nov 23, 2026 | 42 |
| Nov 22, 2026 | 313 |
| Nov 21, 2026 | 310 |
| Nov 20, 2026 | 308 |
| Nov 19, 2026 | 308 |
| Nov 18, 2026 | 300 |
| Nov 17, 2026 | 290 |
| Nov 16, 2026 | 277 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1456393482-root)<a href="https://payloaddirectory.dev/plugins/1456393482-root"><img src="https://payloaddirectory.dev/badge/1456393482-root.svg" alt="Payload Directory"></a>README
Scan for Payload: read barcodes and QR codes with a phone camera or a USB scanner, and answer scan links by who is signed in, without letting codes be probed.
Status: 0.1.1. 71 tests pass. 41 are server tests, on Payload 3.92 with an in-memory MongoDB replica set: the answer table, no probing, rate limits, refusals, odd input, the checks that fail closed, and the JSON endpoint with real sign-in. 30 are component and page tests in jsdom, with a fake camera and a fake detector. Nothing has run on a real camera or in a real browser yet, and no site uses it.
A kind is a short name a provider registers, for links like …/k/<code>. Each kind gives:
RegExp, not a subclass), checked before anything is looked up;scopeOf(code), its site (leave it out on a single-site install);isStaff(user, scope);resolve(code, user): where this person may go, or null.resolveScan(payload, { kind, code, req }) answers from who is signed in, never from the link:
| Who | A code they may see | Any other code, or not a code |
|---|---|---|
| Signed out | "Sign in" | "Sign in" |
| Signed in | where resolve sends them | one shared "Nothing here for this account" |
| Staff of that kind, in the code's site | the record | "Not found" |
| Staff of another site | "Not found", the same as a code that doesn't exist |
Over the rate limit, everyone signed in gets the quiet "Nothing here" page, staff included.
perMinute). Over the limit, the answer is the same quiet page and no row is added, so a steady flood can't grow the table. Requests that arrive together can let some past perMinute, and store some rows more than the limit.//x, /\x and paths with tabs or newlines are refused).scopeOf. Without it, staff of any site count as staff for every code. Only a string with at least one non-space character, or a whole number of 1 or more, counts as a site. Return the site's id, not the site document: read with depth: 0, or return site.id. Return the id itself, never String() of a document or any other value. Any other answer ('', 0, false, a list) means the code has no site, so nobody is staff for it. A scopeOf set to anything but a function or false stops start-up.onRefusal gets the kind and the outcome only, for abuse alerts.GET /api/scan/:kind/:code gives the same answers as JSON, never cached: { to }, { signIn: true }, { nothingHere: true } or { notFound: true }.config.custom.scanKinds ([{ owner, kinds }]), with no import, in any plugin order. A kind registered twice stops the site at start-up.A plugin can't add Next routes, so your site keeps thin routes (/k/[code]) that call resolveScan and redirect, or show one of the pages from @extantape/payload-plugin-scan/pages:
ScanSignIn keeps the link's fragment (where an activation secret travels) as the sign-in link's own fragment, so no server ever sees it: never in a query, a cookie or storage. Your sign-in page puts location.hash back on the return URL in the browser when it redirects: never in a form post or a query. Keep third-party scripts off that page, since any script there can read the fragment.ScanNothingHere has a "Use another account" link.ScanNotFound.@extantape/payload-plugin-scan/client)<Scanner onScan={…} />:
BarcodeDetector, or a reader your site provides (detector), for example a ZXing WebAssembly build served from your own domain. Nothing loads from a CDN, and without a reader the camera isn't asked for.repeatMs (2.5 seconds). Typed entries always count.onUndo.<CameraScanButton onResult={…} />: opens the camera in a dialog, reads one code and closes. Escape closes it, and focus goes back to the button. Kitting's packing station, once it's built, is designed to take it by import-map path.useScanner({ … }): the same, without the UI.On its own: Scan needs only Payload. Your site passes its own link kinds in kinds and keeps a thin Next route for each, and the client scanner (./client) needs no server part.
Needs: Payload ^3.80.0 as a peer dependency, with React ^19.0.0 optional. No other EXTANT APE plugin is required.
Works with:
adapters.scan on, Sample Kits registers the k (kit) and b (shipping box) kinds at config.custom.scanKinds.<CameraScanButton>, for example to find a kit. Wizards doesn't import Scan; your site renders the step.<CameraScanButton> as an optional camera adapter, by import-map path.Color Theory: no direct link. The camera scanner and its pages bring no colors of their own and take your site's CSS, so a site styled with Color Theory's --palette-* tokens styles them too.
Family: Scan sits in the Fulfillment family, with Kitting, Restock, Sample Kits, Shipping, Labels, Wizards, Custody and Sequences, though the families are a working draft and Fulfillment is due to be split into different groups.
npm install @extantape/payload-plugin-scan
import { scanPlugin } from '@extantape/payload-plugin-scan'
scanPlugin({
kinds: {
k: {
pattern: /^\d{12}$/,
scopeOf: async ({ code }) => siteOfKit(code),
isStaff: async ({ user, scope }) => isKitStaff(user, scope),
resolve: async ({ code, user, staff }) => (staff ? { to: `/kits/${code}` } : buyerLink(code, user)),
},
},
})
Build the collections' indexes before first use.
location.hash onto the return URL when it redirects.npm test # server and component tests
npm run typecheck
npm run build
MIT. See LICENSE.
payload barcodes
Barcodes and QR codes for Payload ecommerce products with a printable label page and no runtime dependencies
709/wk1v3
payload plugin labels
Design labels with field tokens and print them as PDF on thermal rolls or Avery-style sheets
74134/wk0v3
payload plugin guard
Central access policy file, typed predicates and guarded endpoints for Payload plugins and Local API calls
73664/wk37v3
multi tenant
Manage multiple tenants and tenant-scoped content from a single Payload admin panel
100165.4k/wk46.1kv3 v4
ecommerce
Ecommerce utilities for Payload with idempotent Stripe confirmation, orders, carts and inventory handling
10019.0k/wk46.1kv3 v4
payload totp
Add TOTP-based two-factor authentication to a Payload auth collection using authenticator apps
8425.1k/wk168v3