24.5. Application fields in extra_data#
Several Taler endpoints carry a JSON object called extra_data. Use this
reference to find the keys that applications understand, their versions and
the fields that go together. Look up the enclosing resource first. For
example, a fountain response can carry metadata about the fountain itself
and separate metadata about each token family it grants.
Resource |
Key in |
Format version |
Readers and definition |
|---|---|---|---|
PoS settings |
|
1 (proposed) |
Merchant terminals. See PoS layout, version 1 (proposed) and |
Token family |
|
Unversioned, experimental |
Merchant clients and wallets. See DD 101: Semantic Token Families MVP. |
Token family |
|
Unversioned, experimental |
Merchant clients and wallets. DD 101 defines redemption and issuance variants. |
Fountain |
|
Unversioned |
Merchant clients and wallets. See Fountain kind. |
Key fountain |
|
Unversioned |
Wallets. See Access areas on key fountains. |
In DD 101, a discount with a redemption benefit requires both required_tokens
and issuance. An issuance-only discount still requires issuance. The
full variant definitions live in DD 101: Semantic Token Families MVP.
Token family metadata can travel from the private token family API into both payment contracts and fountain grants. Fountain-level metadata is visible to wallets accessing that fountain. The endpoint specification determines who can read the data, whether the object may be omitted, and what a write does. Recording a key here does not change those rules. Data embedded in a contract also follows the contract’s JSON restrictions.
24.5.1. Private resource metadata#
Since merchant protocol v47, fountains, token families, templates and OTP
devices accept an optional private_extra_data JSON object on private
create and update requests. The private detail endpoint returns that object.
Omitting it on update preserves the stored value. Supplying an object replaces
the entire field. Send {} to clear its contents. Clients that edit a shared
object should preserve other applications’ keys.
This metadata is accessible to clients with the resource’s management read permission. Public template responses, wallet fountain information, token grants, order contracts and payment confirmations exclude it.
24.5.2. Adding a format#
For each new shared key, add a row identifying the resource, key, version, readers and owning specification. Define the key’s JSON value in one place and link to it from the endpoints that carry it. Supply a valid example and state what becomes required when an optional member or variant is present.
The proposed convention for new keys is an object with a required positive
integer version inside that key. Two keys in one extra_data object can
evolve independently. Keep the version for an optional addition that older
readers can safely ignore. Use a new version when changing a field’s meaning
or type, or making an optional field required. Keep earlier versions listed
with their definitions so clients can identify saved data. DD 101’s existing
keys retain their original shape and validation rules.
Readers skip keys and versions they do not understand. Editors of a new versioned format preserve unrelated keys and unknown members when saving. If an editor cannot interpret a key’s version, it leaves the entire value intact. For example, a terminal that understands layout version 1 can still display its default catalog when it receives version 2.
24.5.3. Fountain kind#
A merchant can classify a fountain by setting extra_data.kind to a
string. Wallets can use it to group fountains for display. The values
defined here are:
discountfor a fountain offering discounts.subscriptionfor a fountain providing a subscription.keyfor a fountain providing keys.
For example, a subscription fountain can carry this metadata:
{
"extra_data": {
"kind": "subscription"
}
}
The classification applies to the whole fountain. Each grant’s token family
retains its own kind and redemption rules. A wallet that receives no
kind or an unfamiliar value can still display the fountain using its
name and description.
24.5.4. Access areas on key fountains#
A fountain with kind set to "key" can include access_areas in
its wallet-visible extra_data. Each entry in the array describes a room
or area covered by the key and has a required name string containing a
non-blank display name. Merchants can update these names and the set of
areas when access changes.
{
"extra_data": {
"kind": "key",
"access_areas": [
{ "name": "University Library" },
{ "name": "Media Studio" }
]
}
}
Wallets display the names in the supplied order and ignore unrecognized members and entries without a usable name. An omitted or empty array provides no area names to display. The names describe the key to its holder. Token grants and the door’s payment contract determine access.
24.5.5. PoS layout, version 1 (proposed)#
Android and iOS store the arrangement under extra_data.pos_layout. Both
use the catalog’s product_id and numeric category id. Display names
can change or be translated, so they are unsuitable as identifiers.
When present |
Required contents |
|---|---|
|
An object with integer |
|
Both |
|
An object keyed by the category ID in canonical decimal form
(for example, |
For example:
{
"extra_data": {
"pos_layout": {
"version": 1,
"grid": {
"columns": 3,
"cells": ["espresso", null, "tea", "cake"]
},
"category_colors": {"7": "#286749"}
}
}
}
Cells run left to right, then top to bottom. In this example, tea occupies the third cell of the first row and cake starts the second row. An omitted grid or an empty cell array leaves every product in the default catalog view. Products absent from the grid remain available there. A missing catalog product leaves its saved slot empty. An unknown category ID has no visual effect. Keep these references on unrelated edits so a partial catalog or a different screen size cannot silently rearrange another terminal.
A color-only layout such as {"version":1,"category_colors":{"7":"#286749"}}
is valid. A grid containing cells without columns is invalid. A client
reading that grid uses its default placement and can still apply valid
category colors. A smaller screen may adapt how it displays the saved grid.
Only an explicit layout edit changes the stored positions.