A price checker on the shop floor (a kiosk page your app serves) — the recipe
A retailer wants a screen on its floor where a customer scans an item and reads its price, without asking a cashier. iVendNext's own guide calls this a genuinely different screen, a separate application, not a till key. This recipe builds it as a page your app serves, priced by iVendNext itself for each scan. It is for an iVendNext developer who has made an outside app before (the event feed recipe).
Next: the sample, S24 · Price-checker kioskAll recipes
In the App library: Price-checker kiosk
Reference implementation: samples/s24_price_checker/ — Price-checker kiosk.
When to use it. A screen on the shop floor that nobody signs in to, that only reads, and that shows only what anyone standing in the store could see: a price checker, an is it in stock screen. ⛔ Not for a member's balance, a customer's order, a staff clock-in or anything that writes: whoever holds the address can use it, so those need a sign-in (recipe). For a screen the cashier opens on the till, use a partner page (recipe): the till opens it and hands it the sale.
Steps
-
Declare one record per screen in your manifest (
samples/s24_price_checker/manifest.json): a record type<PREFIX> Kiosknamed by the framework's random name ("autoname": "hash"), so each record's name is a code nobody can guess; a link to the store's till profile, and read-only fields that fetch what you need from it (fetch_from: company, price list, currency, walk-in customer, store). Give System Manager the rights to edit it and your integration role read only. The install makes a role the manifest names that the site lacks, with no one in it (the sample's isPP PRC Integration). Add a feed registration naming the record type; the install makes the app's own user, which holds that role, names it there and gives it read on the record type. The reads the service makes beyond the feed go inrole_rights(Item and Item Price in the sample). -
Serve the page from your app, and let its address name the retailer. A partner page is opened by the till, and its call names no retailer. A kiosk is a browser: its address carries the retailer and the screen after a
#, which never reaches a server log:https://your.app/#shop=shop-a.example.com&kiosk=k3v9q0abcdThe page sends both with each scan to your own service (
POST /prc/price, same origin). It holds no key and signs nothing. Serve it with a content policy that allows only your own script and style (default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; img-src https:), keep the script in its own file, and draw every answer withtextContent. -
Answer only for a retailer you know and a screen it has switched on. Your service finds the retailer among those that connected (the app template's handshake, keyed by site; or the one retailer it is set up for), reads the screen's record with that retailer's key, and answers only when it exists and is switched on. Keep the record a minute, so switching it off stops that address within a minute. Treat a 404 as no such screen only when iVendNext's answer names that record; any other 404 (a wrong record type) means iVendNext cannot be read.
-
Ask iVendNext for the price; never work it out yourself. One call with your key, a whitelisted call of iVendNext:
POST /api/method/ivendnext_mpos.api.v1.price_check {"search_value": "<scanned text>", "args": {...one unit, no item...}}It answers
{"scan": …, "price": …}. It finds the item from a barcode, a serial number, a batch or a price-and-weight label (decoded as the till reads it), with the barcode's own unit, then prices it. It reads a label from POS build2.1.0.698; before it, a label reads not found. The pricer finds the price row for one unit on the store's price list, the walk-in customer's own row first, in that unit (a price in the stock unit is converted), on the kiosk's own date. Sendqty1,doctypeSales Invoice, the company,selling_price_list,currency,conversion_rate1,transaction_date, the customer, andignore_pricing_rule1. ⛔ Never send arate: given one, the pricer may write a price row when the retailer's auto-insert price setting is on. Showprice_list_rate; a 0 or no row is no price here, never free. A 417 from the pricer means iVendNext will not price that item (disabled, past its end of life, a template). -
Say what the kiosk does not show. On iVendNext a selling offer is a promotion, which the till works out on the whole sale (the engine refuses a selling price rule), so a one-unit check cannot ask for it. Under every price, say Any offer is worked out at the till. The price shown is the store's list price, which a promotion only lowers.
The kiosk record
What the retailer does after install, in its own words:
- After install: the install makes the app's own user,
pp_prc@integration.invalid, and names it on your feed registration. Nothing is left for the retailer to switch on. - Make one Kiosk record per screen: where it stands, and the store's till profile. The record's name is the screen's code. Changed the profile's price list later? Save the Kiosk again: its fields are fetched when it is saved.
- On the tablet, open your app's address with
#shop=and the site's key address (the App library shows it at its top: This site's key address: …, with Copy) and&kiosk=and the record's name, in full screen. A domain of the retailer's own that points at the site is not the key address: a kiosk given another address answers that it is not set up. A barcode scanner connected to the tablet as a keyboard (USB or Bluetooth) scans into the page. - To stop a screen, switch its record off or delete it.
What iVendNext needs from you
- The address of your app, and the words for the tablet's set-up above.
- The note that the kiosk's address works without a sign-in: anyone who has it can check prices at that store, as anyone standing in it can.
- What your service reads from iVendNext (item names, units, public pictures and prices), and that it writes nothing.
Technical notes
- Many retailers: the template's handshake hands your app iVendNext's integration user's key when the retailer connects. iVendNext makes that user at the install, and the retailer's site hands the key over when it connects, after the install or an update (Connect again only if the site could not reach the app, or a key was lost or changed); until the key arrives the kiosk says it is not set up. Name your service's one
*.ivendnext.appaddress in the manifest'sallowed_urls: the site connects only to that address. - Hosting: a page and a press-only answer, so it can run as a function that runs only when called (
app.json"runs": "function"; what that costs is in publish); the sample'slambda_handlerreturns the page with its own content type. - Bounds: a typed item code is not looked up (the sample's 1.0); the price is shown in the till profile's currency, converted by the retailer's own exchange rate when its list is in another (read in the engine's pricer, not run); whoever holds a real kiosk's address can check as often as they like (two calls to iVendNext each); a walk-in customer whose customer group has its own price list is priced on the store's list; online only.
What was proven where
- Laptop: the sample's tests (the core, the service over the wire with one retailer and many, the function entry, the three calls to iVendNext against a stand-in that answers as iVendNext does, the manifest) and its canaries, each RED with its baseline passing.
- Our test bench: see the sample's README.
Needs this serves
- A price checker shoppers use on the shop floor — Ready, with limits (1)