22.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.

Known uses#

Resource

Key in extra_data

Format version

Readers and definition

PoS settings

pos_layout

1 (proposed)

Merchant terminals. See PoS layout, version 1 (proposed) and GET [/instances/$INSTANCE]/private/pos/settings.

Token family

experimental_subscription

Unversioned, experimental

Merchant clients and wallets. See DD 101: Semantic Token Families MVP.

Token family

experimental_discount

Unversioned, experimental

Merchant clients and wallets. DD 101 defines redemption and issuance variants.

Fountain

kind

Unversioned

Merchant clients and wallets. See Fountain kind.

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.

22.5.1. 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.

22.5.2. 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:

  • discount for a fountain offering discounts.

  • subscription for a fountain providing a subscription.

  • key for 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.

22.5.3. 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.

Field rules for writers#

When present

Required contents

pos_layout

An object with integer version: 1. Both grid and category_colors are optional and independent.

grid

Both columns (a positive safe integer) and cells (an array). Each cell is either a catalog product ID string or JSON null for an empty slot. A product ID may appear at most once.

category_colors

An object keyed by the category ID in canonical decimal form (for example, "7"). Each value is an opaque sRGB color encoded as #RRGGBB, with six hexadecimal digits. Omit a category to use the terminal’s default color.

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.