Contents

GET [/instances/$INSTANCE]/templates/$TEMPLATE_ID#

This is used to obtain information about a specific template by wallets before they ask the user to fill in details. This endpoint is available since protocol v11.

Response:

200 OK:

The backend has successfully returned the detailed information about a specific template. Returns a WalletTemplateDetailsRequest.

404 Not found:

The instance or template(ID) is unknown to the backend.

Details:

For inventory-cart templates the backend augments the returned template_contract with inventory_payload containing products, categories, and units. The payload is filtered by the template’s selected_all, selected_categories, and selected_products settings.

interface WalletTemplateDetailsRequest {

  // Type of the template being instantiated.
  // Possible values include "fixed-order",
  // "inventory-cart" and "paivana".
  // Since protocol **v25**.
  // Defaults to "fixed-order" while supporting previous
  // protocol versions.
  template_type: string;

  // Hard-coded information about the contract terms
  // for this template.
  template_contract: TemplateContractDetails;

  // Key-value pairs matching a subset of the
  // fields from template_contract that are
  // user-editable defaults for this template.
  // Since protocol **v13**.
  editable_defaults?: Object;

  // Required currency for payments.  Useful if no
  // amount is specified in the template_contract
  // but the user should be required to pay in a
  // particular currency anyway.  Merchant backends
  // may reject requests if the template_contract
  // or editable_defaults do
  // specify an amount in a different currency.
  // This parameter is optional.
  // Since protocol **v13**.
  required_currency?: string;
}
interface InventoryPayload {
  // Inventory products available for selection.
  // Since protocol **v25**.
  products: InventoryPayloadProduct[];

  // Categories referenced by the payload products.
  // Since protocol **v25**.
  categories: InventoryPayloadCategory[];

  // Custom units referenced by the payload products.
  // Since protocol **v25**.
  units: InventoryPayloadUnit[];
}
interface InventoryPayloadProduct {
  // Product identifier.
  // Since protocol **v25**.
  product_id: string;

  // Human-readable product name.
  // Since protocol **v25**.
  product_name: string;

  // Human-readable product description.
  // Since protocol **v25**.
  description: string;

  // Localized product descriptions.
  // Since protocol **v25**.
  description_i18n?: { [lang_tag: string]: string };

  // Unit identifier for the product.
  // Since protocol **v25**.
  unit: string;

  // Price tiers for the product.
  // Since protocol **v25**.
  unit_prices: Amount[];

  // Whether fractional quantities are allowed for this unit.
  // Since protocol **v25**.
  unit_allow_fraction: boolean;

  // Maximum fractional precision (0-6) enforced for this unit.
  // Since protocol **v25**.
  unit_precision_level: Integer;

  // Remaining stock available for selection.
  // Since protocol **v25**.
  remaining_stock: DecimalQuantity;

  // Category identifiers associated with this product.
  // Since protocol **v25**.
  categories: Integer[];

  // Taxes applied to the product.
  // Since protocol **v25**.
  taxes?: Tax[];

  // Hash of the product image (if any).
  // Since protocol **v25**.
  image_hash?: string;
}
interface InventoryPayloadCategory {
  // Category identifier.
  // Since protocol **v25**.
  category_id: Integer;

  // Human-readable category name.
  // Since protocol **v25**.
  category_name: string;

  // Localized category names.
  // Since protocol **v25**.
  category_name_i18n?: { [lang_tag: string]: string };
}
interface InventoryPayloadUnit {
  // Unit identifier.
  // Since protocol **v25**.
  unit: string;

  // Human-readable long label.
  // Since protocol **v25**.
  unit_name_long: string;

  // Localized long labels.
  // Since protocol **v25**.
  unit_name_long_i18n?: { [lang_tag: string]: string };

  // Human-readable short label.
  // Since protocol **v25**.
  unit_name_short: string;

  // Localized short labels.
  // Since protocol **v25**.
  unit_name_short_i18n?: { [lang_tag: string]: string };

  // Whether fractional quantities are allowed for this unit.
  // Since protocol **v25**.
  unit_allow_fraction: boolean;

  // Maximum fractional precision (0-6) enforced for this unit.
  // Since protocol **v25**.
  unit_precision_level: Integer;
}