get-templates-TEMPLATE_ID.rst (5238B)
1 .. http:get:: [/instances/$INSTANCE]/templates/$TEMPLATE_ID 2 3 This is used to obtain information about a specific template by wallets 4 before they ask the user to fill in details. 5 This endpoint is available since protocol **v11**. 6 7 **Response:** 8 9 :http:statuscode:`200 OK`: 10 The backend has successfully returned the detailed information about a specific template. 11 Returns a `WalletTemplateDetailsRequest`. 12 :http:statuscode:`404 Not found`: 13 The instance or template(ID) is unknown to the backend. 14 15 **Details:** 16 17 For ``inventory-cart`` templates the backend augments the returned 18 ``template_contract`` with ``inventory_payload`` containing products, 19 categories, and units. The payload is filtered by the template's 20 ``selected_all``, ``selected_categories``, and ``selected_products`` settings. 21 22 .. ts:def:: WalletTemplateDetailsRequest 23 24 interface WalletTemplateDetailsRequest { 25 26 // Type of the template being instantiated. 27 // Possible values include "fixed-order", 28 // "inventory-cart" and "paivana". 29 // Since protocol **v25**. 30 // Defaults to "fixed-order" while supporting previous 31 // protocol versions. 32 template_type: string; 33 34 // Hard-coded information about the contract terms 35 // for this template. 36 template_contract: TemplateContractDetails; 37 38 // Key-value pairs matching a subset of the 39 // fields from ``template_contract`` that are 40 // user-editable defaults for this template. 41 // Since protocol **v13**. 42 editable_defaults?: Object; 43 44 // Required currency for payments. Useful if no 45 // amount is specified in the ``template_contract`` 46 // but the user should be required to pay in a 47 // particular currency anyway. Merchant backends 48 // may reject requests if the ``template_contract`` 49 // or ``editable_defaults`` do 50 // specify an amount in a different currency. 51 // This parameter is optional. 52 // Since protocol **v13**. 53 required_currency?: string; 54 } 55 56 .. ts:def:: InventoryPayload 57 58 interface InventoryPayload { 59 // Inventory products available for selection. 60 // Since protocol **v25**. 61 products: InventoryPayloadProduct[]; 62 63 // Categories referenced by the payload products. 64 // Since protocol **v25**. 65 categories: InventoryPayloadCategory[]; 66 67 // Custom units referenced by the payload products. 68 // Since protocol **v25**. 69 units: InventoryPayloadUnit[]; 70 } 71 72 .. ts:def:: InventoryPayloadProduct 73 74 interface InventoryPayloadProduct { 75 // Product identifier. 76 // Since protocol **v25**. 77 product_id: string; 78 79 // Human-readable product name. 80 // Since protocol **v25**. 81 product_name: string; 82 83 // Human-readable product description. 84 // Since protocol **v25**. 85 description: string; 86 87 // Localized product descriptions. 88 // Since protocol **v25**. 89 description_i18n?: { [lang_tag: string]: string }; 90 91 // Unit identifier for the product. 92 // Since protocol **v25**. 93 unit: string; 94 95 // Price tiers for the product. 96 // Since protocol **v25**. 97 unit_prices: Amount[]; 98 99 // Whether fractional quantities are allowed for this unit. 100 // Since protocol **v25**. 101 unit_allow_fraction: boolean; 102 103 // Maximum fractional precision (0-6) enforced for this unit. 104 // Since protocol **v25**. 105 unit_precision_level: Integer; 106 107 // Remaining stock available for selection. 108 // Since protocol **v25**. 109 remaining_stock: DecimalQuantity; 110 111 // Category identifiers associated with this product. 112 // Since protocol **v25**. 113 categories: Integer[]; 114 115 // Taxes applied to the product. 116 // Since protocol **v25**. 117 taxes?: Tax[]; 118 119 // Hash of the product image (if any). 120 // Since protocol **v25**. 121 image_hash?: string; 122 } 123 124 .. ts:def:: InventoryPayloadCategory 125 126 interface InventoryPayloadCategory { 127 // Category identifier. 128 // Since protocol **v25**. 129 category_id: Integer; 130 131 // Human-readable category name. 132 // Since protocol **v25**. 133 category_name: string; 134 135 // Localized category names. 136 // Since protocol **v25**. 137 category_name_i18n?: { [lang_tag: string]: string }; 138 } 139 140 .. ts:def:: InventoryPayloadUnit 141 142 interface InventoryPayloadUnit { 143 // Unit identifier. 144 // Since protocol **v25**. 145 unit: string; 146 147 // Human-readable long label. 148 // Since protocol **v25**. 149 unit_name_long: string; 150 151 // Localized long labels. 152 // Since protocol **v25**. 153 unit_name_long_i18n?: { [lang_tag: string]: string }; 154 155 // Human-readable short label. 156 // Since protocol **v25**. 157 unit_name_short: string; 158 159 // Localized short labels. 160 // Since protocol **v25**. 161 unit_name_short_i18n?: { [lang_tag: string]: string }; 162 163 // Whether fractional quantities are allowed for this unit. 164 // Since protocol **v25**. 165 unit_allow_fraction: boolean; 166 167 // Maximum fractional precision (0-6) enforced for this unit. 168 // Since protocol **v25**. 169 unit_precision_level: Integer; 170 }