Skip to content

Customers and Pricing

Hyvä POS is on the App Store

The free app is out for iPhone, iPad and Mac: install it from the App Store, connect your Magento store and sell. PRO, the Magento module with a license per terminal, follows shortly. News and pricing are at hyva.io/pos.

Method Route Purpose
POST /V1/pos/customer-validate Pre-validate a draft customer through the validator pool
POST /V1/pos/customers Create a customer (re-validated at the boundary)
PUT /V1/pos/customers/:customerId Edit a customer and their addresses, merged into the stored customer (module 1.7.0)
GET /V1/pos/customers/lookup The customers a scanned or typed value finds (module 1.7.0)
GET /V1/pos/customers/:customerId/images/:attributeCode One stored customer image (module 1.7.0)
GET /V1/pos/customers/:customerId/addresses/:addressId/images/:attributeCode One stored address image (module 1.7.0)
POST /V1/pos/self-checkout/otp/request Email a one-time sign-in code to a customer
POST /V1/pos/self-checkout/otp/verify Verify the code, return a customer summary
POST /V1/pos/customer-prices Customer-specific prices from the pricing-resolver pool
GET /V1/pos/customers/:customerId/credit-limit Available credit for pay-by-invoice
GET /V1/pos/wishlist/:customerId The customer's wishlist, shown on the customer profile at the register
GET /V1/pos/customers/:customerId/rule-usage/:ruleId How often the customer used a cart price rule and one of its coupons
GET /V1/pos/catalog-rule-prices The day's catalog rule prices of a website, every customer group, for the offline cache
GET /V1/pos/fixed-product-taxes Every fixed product tax row of a website, for the offline cache
GET /V1/pos/newsletter/status A customer email's newsletter subscription state
POST /V1/pos/newsletter/subscribe · /unsubscribe Subscribe or unsubscribe an email
GET /V1/pos/customer-insights/:customerId Buying-behavior statistics and custom insight sections for the Customer Insights sheet

The routes take these ACL resources on the calling token:

  • Magento_Customer::manage: the credit-limit, newsletter, customer-insights and edit (PUT /V1/pos/customers/:customerId) routes. The edit asks for the resource Magento's own PUT /V1/customers/:customerId asks for.
  • Magento_Customer::customer: the lookup and the two image reads, the resource Magento's own customer reads ask for.
  • Hyva_Pos::locations: every other route in the table.

Register Marker and Staff Session

From module 1.7.0, the module's customer routes identify the staff member and record them. The register applies the role.

The routes concerned: GET /V1/pos/customers/lookup, GET /V1/pos/customer-insights/:customerId, GET /V1/pos/wishlist/:customerId, GET /V1/pos/newsletter/status, the two image reads, POST /V1/pos/customers, PUT /V1/pos/customers/:customerId, POST /V1/pos/newsletter/subscribe and POST /V1/pos/newsletter/unsubscribe. The store config names customer_permissions in capabilities. Magento's own customer routes are unchanged.

  • X-Hyva-Pos-Register: the register marker, sent by app 0.6.0 and later. A request without it is refused with 400 and reason_code register_update_required: "Update Hyvä POS on this device to work with customers. This store needs version 0.6.0 or later." Anyone can send the marker: it says which register asks, never who.
  • X-Hyva-Pos-Staff-Session: the staff session token of the signed-in staff member (see Staff and Roles). A session that is unknown or expired is refused with 401 staff_session_missing or staff_session_expired, and permission names the role form's key for what the route does, such as view_customers or edit_customers. The register then asks for the passcode again. A request without a session passes, whatever Require Staff Login says, and its changes are recorded without a staff member.

The module does not judge the role. View Customers, Create Customers, Edit Customers, Edit Protected Customer Fields and Assign Customer Group are applied by the register on the device.

Refusals carry parameters.reason_code. The statuses:

reason_code Status When
register_update_required 400 No register marker
staff_session_missing, staff_session_expired 401 The session sent is unknown or expired
attribute_read_only 400 An edit names a field the register does not edit, or a key outside the request's contract
address_unknown 400 An address id that is not one of the customer's
attribute_invalid 400 A value Magento's attribute rules refuse
image_unreadable, image_too_large, image_type_not_allowed 400 An image that cannot be read, is too large, or is not a JPEG, GIF or PNG
image_not_found 404 No stored image for the attribute
image_not_saved 500 The store could not keep the image
customer_changed 409 A field the edit writes changed since the form loaded it
customer_busy 409 The customer stayed locked by other saves
lookup_value_empty 400 A lookup without a value
lookup_failed 503 The lookup did not finish in time or could not read

Every create writes one audit log row, created with the new customer's email, under the session's staff member, or under none without a session.

Validate a Draft Customer

POST /V1/pos/customer-validate: runs a draft customer payload through the server-side validator pool before anything is saved. Called by the POS customer-create sheet on Save, so validation rules (email uniqueness, taxvat format, vendor postcode/VAT lookups) live in Magento configuration instead of being duplicated on the device. Vendor modules add validators by implementing CustomerValidatorInterface and registering with the CustomerValidatorPool via di.xml; built-in validators run first, vendor validators refine after.

Request: the payload is wrapped in a request key. Only email, firstname, lastname, and websiteId are required; omit optional keys instead of sending null. websiteId is the website the customer belongs to: the register sends the website of the store view it sells under. locationId (module 1.2.0, optional) is the register's own location, and it decides which customer validators run when that location overrides the global selection. A location that does not exist, or that belongs to another website, is refused with an input error giving the field rather than validated under a different policy. Zero means unspecified on either side: a request without websiteId, and a location the merchant never scoped to a website, both pass the membership check, while two websites that are stated and different fail it. Omit locationId, as a register on a module older than 1.2.0 does, and the website setting applies. The create endpoint reads it the same way, so a customer saved without a prior validate call is checked under the same policy. Send 0 when the caller does not know it and the server resolves it: the website of the store the call runs in, or the default store view's website when the call runs in the all scope, as a token-authenticated REST call does. 0 is never saved as a website. Include customerId only on an edit flow, so the email-uniqueness check excludes the customer's own record:

{
  "request": {
    "email": "jane@example.com",
    "firstname": "Jane",
    "lastname": "Doe",
    "websiteId": 1,
    "company": "Acme BV",
    "taxvat": "NL123456789B01",
    "phone": "+31 6 12345678",
    "street": "Keizersgracht 123",
    "city": "Amsterdam",
    "postcode": "1015CJ",
    "countryCode": "NL"
  }
}

From module 1.7.0 the request also takes:

  • sourceForm: the form the request comes from, customer_create, customer_edit, address_edit or ship_to. It decides which required fields apply: the customer form on Create Customer and Edit Customer, the address form on an address edit and on Create Customer with an address, and the order address's own rules on the ship-to (street, city and country, a postcode key that may be empty, a valid email, and phone, company and fax where Magento requires them). Without it, a request reads as customer_create without a customerId and customer_edit with one.
  • addressId: the stored address an address_edit changes. A field the request leaves out is read from that address before the required check. Null is a new address.
  • customerAttributes and addressAttributes: arrays of {"code", "value"} for the fields the form shows beyond the flat fields. A date is sent as YYYY-MM-DD, a multiple select as a comma list of option values, a Yes/No as 1 or 0. An empty string clears the field.
  • streetLines: the street as an array of lines.
  • images (create only): {"code", "base64_encoded_data", "type", "name"} per customer image attribute. The module takes the type from the bytes (JPEG, GIF or PNG) and names the stored file itself, so type and name are not read.

The required fields come from the website's resolved forms, the Customer Form Fields grids. On an edit, a field the request leaves out is checked as stored and a field it sends empty as a clear. A validator that is always on, attribute_rules, runs Magento's own attribute rules (length, input class, options, dates) on each value sent.

Response: always 200 with a structured result; only network, auth, and server failures produce an error status. valid is true only when no row has severity error. Severities are error (blocks Save), warning, info, and normalize (carries a suggested_value the UI offers as a one-tap fix):

{
  "valid": false,
  "errors": [
    {
      "field": "postcode",
      "code": "postcode_normalized",
      "severity": "normalize",
      "message": "Postcode formatted for NL.",
      "suggested_value": "1015 CJ"
    }
  ]
}

Create a Customer

POST /V1/pos/customers: defensive create wrapper around Magento's CustomerRepositoryInterface::save(). It re-runs the same validator pool at the create boundary, so a client that skips the pre-validate call still cannot land invalid data. Only severity-error rows block; warnings and info rows pass through because the cashier already saw them in the form.

Request: identical shape to /V1/pos/customer-validate, the same request object. The account is saved on the request's websiteId, resolved the same way, so a customer created at the register belongs to the same website as the store's other customers and the uniqueness check reads the website the save will use.

Response: 200 in both outcomes. On success, customer_id carries the new entity id. On validation failure, success is false and errors carries the same severity-tagged rows the validate endpoint returns, so the client can attach them per field without a second round-trip:

{
  "success": true,
  "customer_id": 1287,
  "errors": []
}

From module 1.7.0 the create writes customerAttributes and addressAttributes: the data interfaces' own fields through their setters, the rest as custom attributes. A code the register cannot write is refused with an attribute_unknown row. The street is saved as its lines and the company on the address, and an empty phone is no longer saved as 0000000000.

When the customer is saved and the address is not, success stays true and errors carries a row with severity warning, field street, code address_not_saved and the message "The customer was created without the address. Add the address to the customer again."

Errors: an email that already exists surfaces as a validation row, not an HTTP error. A 400 indicates a malformed payload; 401 a bad token.

Edit a Customer

PUT /V1/pos/customers/:customerId (module 1.7.0): the register's customer edit, merged into the stored customer and saved through Magento's customer repository. It needs the register marker.

The body:

  • customer: the customer as Magento's CustomerInterface. It carries only id (the customer in the URL), website_id (the stored one), group_id, default_billing and default_shipping, addresses, custom_attributes, and the fields the website's form catalog marks editable. An address row carries its id, customer_id, default flags and region_id beside its editable fields. No extension attribute.
  • baseline: the values the form loaded for the fields it writes. customerAttributes is an array of {"code", "value"}. addresses holds per stored address its id and attributes, with the street's lines joined by a newline and the region by its name or id.
  • deleteAddressIds: the ids of the customer's addresses to delete.
  • requestedByStaffId: the signed-in staff member who asked, when a manager's session stands in for this one save.
{
  "customer": {
    "id": 1287,
    "email": "jane@example.com",
    "firstname": "Jane",
    "lastname": "Doe",
    "website_id": 1,
    "custom_attributes": [
      { "attribute_code": "loyalty_card", "value": "LC-20931" }
    ]
  },
  "baseline": {
    "customerAttributes": [
      { "code": "firstname", "value": "Jane" },
      { "code": "lastname", "value": "Doe" },
      { "code": "email", "value": "jane@example.com" },
      { "code": "loyalty_card", "value": "" }
    ]
  }
}

The merge:

  • A field the request leaves out keeps its stored value, a custom attribute included. A field the request names is saved as sent, an empty value included.
  • An address the request leaves out is kept. An address is deleted only when its id is in deleteAddressIds. Every id must be one of the customer's addresses.
  • A field the register does not edit (a file, a hidden or read-only field), a code no form offers, the credit limit pair, an extension attribute and any other key are refused with attribute_read_only.
  • An image attribute in custom_attributes takes image content as its value ({"base64_encoded_data", "type", "name"}), "" to remove it, or the stored value sent back unchanged. Image content on an address is refused.
  • Magento's own validation runs on the result.

The service locks the customer's row and then its address rows, reads the customer fresh and compares the baseline. A field whose stored value moved since the form loaded it is refused with 409 customer_changed. A written field without a baseline entry is not checked. A deadlock or lock wait timeout starts the attempt again, at most twice within 8 seconds, and then answers 409 customer_busy. Call it outside a database transaction of your own.

A change to a field the website's form marks Protected, on the customer or on an address the customer already has (and on every deleted address that held one), is written to the audit log under the staff member of the session, or under none without a session. When a manager's session stands in for the save, the row names the manager and, as reported by the register, the staff member who asked. A protected field on an address the request adds holds a first value, not a change, and is not written. A change of the customer's group is written the same way, as group_id with the old and the new group's id. A save that sends no group keeps the stored one.

Response: the saved customer, as Magento's CustomerInterface.

Customer Lookup

GET /V1/pos/customers/lookup?value=… (module 1.7.0, optional websiteId, 0 for the request store's website): the customers whose customer field with Lookup checked in the website's Customer Form Fields grid holds the value. With Find Customers by Customer ID on, a value of 1 to 10 digits also finds the customer with that ID, answered first with the field pos:customer_id. See What a Scan Finds at the Register for the behavior at the register.

The comparison trims spaces at both ends and ignores case. It is accent-sensitive, and a composed and a decomposed accent are equal. When customer accounts are shared per website, only the website's customers are found.

{
  "total_count": 1,
  "items": [
    {
      "customer": { "id": 1287, "email": "jane@example.com", "firstname": "Jane", "lastname": "Doe" },
      "fields": [
        { "code": "loyalty_card", "label": "Loyalty Card", "value": "LC-20931" }
      ]
    }
  ]
}

items holds at most 10 customers in ascending id, each counted once with every Lookup field it matched. customer is the customer as GET /V1/customers/:customerId answers it. Errors: 400 lookup_value_empty, and 503 lookup_failed when the search does not finish within 2 seconds or cannot read.

The values are kept in the table hyva_pos_customer_lookup by the Magento indexer of the same id, Hyvä POS Customer Lookup under System → Index Management. To rebuild it at once: bin/magento indexer:reindex hyva_pos_customer_lookup.

Customer Images

GET /V1/pos/customers/:customerId/images/:attributeCode and GET /V1/pos/customers/:customerId/addresses/:addressId/images/:attributeCode (module 1.7.0): one stored image, for the register to show. variant is full (the default) or thumbnail, at most 480 pixels on the long edge. The customer must belong to the request's website when accounts are shared per website. The answer carries Cache-Control: no-store.

{
  "name": "photo.jpg",
  "content_type": "image/jpeg",
  "size": 48213,
  "content": "/9j/4AAQSkZJRgABAQ..."
}

Errors: 404 image_not_found, 400 image_too_large or image_type_not_allowed.

Customer Sign-In via One-Time Code

The self-checkout kiosk signs a customer in by email plus a one-time code. Both calls authenticate with the terminal's own token; no customer token is ever minted; downstream credit and loyalty lookups reuse the terminal's integration auth.

Request a Code

POST /V1/pos/self-checkout/otp/request: generates a code, stores a hash, and emails it to the customer.

{
  "request": {
    "email": "jane@example.com",
    "terminalId": 7
  }
}

Response: 200 with an empty body. The response is identical whether or not the email belongs to an account, so the kiosk cannot be used to enumerate registered customers. The account is looked up on the website of the terminal's location. Rate-limit hits return 400 with a message envelope, and an unknown or inactive terminal returns 400 A valid terminal ID is required. A mail that cannot be sent is logged and the request still returns 200. The code is stored as an HMAC-SHA256 under the store's crypt key and the mail leaves through the store's configured mail transport.

Verify a Code

POST /V1/pos/self-checkout/otp/verify: verifies the code for the email + terminal pair and marks it consumed so it cannot be replayed.

{
  "request": {
    "email": "jane@example.com",
    "code": "482913",
    "terminalId": 7
  }
}

Response: an unprivileged customer summary, enough to attach the customer to the cart:

{
  "customer_id": 1287,
  "email": "jane@example.com",
  "firstname": "Jane",
  "lastname": "Doe",
  "group_id": 1,
  "website_id": 1,
  "company": null,
  "taxvat": null,
  "default_billing_address_id": 542
}

Errors: 401 with Invalid sign-in code. for a wrong code, no code for the email, or a terminal that does not match the one that requested it; 401 This sign-in code has expired. Request a new one.; 401 Too many attempts. Request a new sign-in code.; 404 only for Customer account is no longer available.

Customer Prices

POST /V1/pos/customer-prices: resolves per-customer prices for a batch of SKUs. The server walks the CustomerPriceResolverPool (customer-group prices, Adobe Commerce B2B company tiers, vendor contract prices); the first non-null result per SKU wins. Vendor modules plug in by implementing CustomerPriceResolverInterface.

When the register calls this endpoint is a merchant setting: Stores → Configuration → Hyvä POS → Terminal Defaults → Customer Prices, overridable per location on the location form and lockable under Lock Settings (Lock Customer Price Fetching). In When added to cart mode the register resolves each product as the cashier rings it up, one small batch per add. In While browsing the catalog mode it also resolves the SKUs of every catalog page the cashier views, typically 20 to 60 SKUs per request, so discounts show on the product tiles before anything is added. The API itself puts no ceiling on batch size; size a custom resolver for the browse batch, not the single-SKU case.

Request: omit storeView entirely when you do not need it. Sending "storeView": null explicitly trips Magento's web API input processor on the nullable string type and the whole call returns 400. websiteId: 0 means the customer's default website:

{
  "request": {
    "customerId": 1287,
    "skus": ["24-MB01", "24-MB04"],
    "websiteId": 0
  }
}

Response: one row per SKU the pool had an opinion on; SKUs without a resolved customer price are absent and the POS displays the base price. source is a stable token identifying the resolver that produced the value. tiers is an optional qty-threshold ladder ("at qty N or higher, the customer pays this"); customer_price stays the qty-1 price:

{
  "prices": [
    {
      "sku": "24-MB01",
      "base_price": 45.0,
      "customer_price": 38.25,
      "currency": "EUR",
      "source": "customer_group",
      "tiers": [
        { "qty": 10.0, "price": 36.0 }
      ]
    }
  ]
}

Rule Usage per Customer

GET /V1/pos/customers/:customerId/rule-usage/:ruleId?couponCode=SPRING10: how often this customer has used the cart price rule, and the given coupon code of that rule. The register evaluates promotion rules itself and reads these two counts before it accepts a coupon for an attached customer whose rule sets Uses per Customer (or whose coupon sets a per-customer usage limit); when a limit is reached the code is refused at the counter with the reason. Without the module the register applies such a coupon and shows the cashier that the limit was not checked. couponCode is optional; leave it out for an automatic (no-code) rule. Read-only, two indexed lookups. An unknown customer, rule or code returns zero.

{
  "customer_id": 1287,
  "rule_id": 12,
  "rule_times_used": 1,
  "coupon_code": "SPRING10",
  "coupon_times_used": 1
}

Catalog Rule Prices for the Offline Cache

GET /V1/pos/catalog-rule-prices?websiteId=1: the catalog rule prices of the website for a day, every customer group, from Magento's catalogrule_product_price index: {"indexed_at": "2026-09-09 18:44:43", "date": "2026-09-10", "unchanged": false, "items": [{"product_id": 68, "customer_group_id": 0, "rule_price": 765}, ...]}. date (Y-m-d) defaults to today in the store's timezone. Pass an earlier answer's indexed_at as ifIndexedAfter and the answer is unchanged: true with no items when the catalog rule indexers have not run since. The register requests the full set again when its cached day is over, since the index holds rows per day. A PRO register refreshes this with its offline catalog and, offline, prices a line's catalog rule from it for the cart's customer group. Read-only.

GET /V1/pos/fixed-product-taxes?websiteId=1: every fixed product tax (FPT, WEEE) row of the website's products, from Magento's weee_tax table: {"generated_at": "2026-09-13T11:24:05+02:00", "rows": [{"sku": "bowl-brass", "attribute_code": "recycling_fee", "website_id": 0, "country_id": "NL", "region_id": 0, "value": 0.05}, ...]}. Rows with website_id 0 apply to every website; region_id 0 means the whole country; value is per unit in the base currency, excluding tax. Only products with rows appear, so a product absent from the answer charges no fee; rows is empty when the store charges none. Magento's product list never returns an FPT attribute (its backend is a table of its own that the product collection does not load), so this is how a PRO register learns the fee table for its offline catalog; without it the register reads the single product on the first add of a SKU. Module 1.2.0 and later. Read-only.

Credit Limit

GET /V1/pos/customers/:customerId/credit-limit: resolves the pay-by-invoice credit limit for a customer. The POS calls it at checkout when a cart is about to settle via the pos_invoice payment method, and again from the per-customer Open Invoices sheet. Optional query parameter websiteId; omitted or 0 resolves the current request's website. The server walks the credit-limit resolver pool first-write-wins; used is computed live from the customer's OPEN (issued but unpaid) invoices.

{
  "customer_id": 1287,
  "limit": 5000.0,
  "used": 1240.5,
  "available": 3759.5,
  "currency": "EUR",
  "source": "hyva_pos"
}

limit: 0 means "no credit extended": render it as pay-by-invoice being unavailable, not as "limit reached". available is precomputed max(0, limit - used). An answer can carry reason, present only when it applies: outstanding_unavailable when the store cannot add up the customer's open invoices, with available 0 and used left out. Treat an answer without used as no pay-by-invoice. With Use Customer Credit Limits on, the register offers pay-by-invoice only to a customer with limit above 0. Going over available is a warning, not a block: the register marks the cart as exceeding the credit limit, and a cashier whose role has the pay-by-invoice permission can still place the order. No setting turns the warning into a hard block. Errors: 404 for an unknown customer id.

Newsletter Subscription

The register's newsletter surfaces (the customer-detail toggle, the receipt hand-over and email dialogs, the customer display) run on three endpoints:

GET    /rest/V1/pos/newsletter/status?email=…   — Current state for an email
POST   /rest/V1/pos/newsletter/subscribe        — { email, customerId }
POST   /rest/V1/pos/newsletter/unsubscribe      — { email, customerId }

All three return the same shape:

{ "subscribed": true, "status": "subscribed" }

status is one of subscribed, not_active, unconfirmed, unsubscribed, or none (no subscriber record). Double-opt-in stores respond to a subscribe with unconfirmed; render the truth, not the tapped intent.

The validation and routing replicate Magento's GraphQL subscribeEmailToNewsletter mutation without depending on the GraphQL modules: email format, the foreign-account guard, and the store's Allow Guest Subscription setting for emails that don't belong to an account. A customerId whose account email matches links the subscription to the account; anything else follows the guest path. Both directions are idempotent: subscribing an already-subscribed email (or unsubscribing a non-subscriber) returns the current state instead of erroring, so register toggles can't fail on a double tap.