- POST [/instances/$INSTANCE]/private/templates#
This is used to create a template.
Required permission:
templates-writeRequest:
The request must be a TemplateAddDetails.
Response:
- 204 No content:
The creation of the template is successful.
- 404 Not found:
The merchant instance is unknown or it is not in our data.
Details:
interface TemplateAddDetails { // Template ID to use. template_id: string; // Human-readable description for the template. template_description: string; // OTP device ID. // This parameter is optional. otp_id?: string; // Fixed contract information for orders created from // 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; }
type TemplateContractDetails = (TemplateContractFixedOrder | TemplateContractInventoryCart | TemplateContractPaivana) & TemplateContractCommon;
interface TemplateContractCommon { // Template type to apply. Defaults to "fixed-order" if omitted. // Prescribes which interface has to be followed // Since protocol **v25**. template_type?: TemplateType; // Human-readable summary for the template. summary?: string; // Required currency for payments to the template. // This parameter is optional and should not be present // if "amount" is given. currency?: string; // The time the customer need to pay before his order will be deleted. // It is deleted if the customer did not pay and if the duration is over. pay_duration?: RelativeTime; // Minimum age buyer must have (in years). Default is 0. minimum_age?: Integer; // Inventory-cart: request a tip during instantiation. // Since protocol **v25**. request_tip?: boolean; }
enum TemplateType { FIXED_ORDER = "fixed-order", INVENTORY_CART = "inventory-cart", PAIVANA = "paivana" }
interface TemplateContractFixedOrder { // The price is imposed by the merchant and cannot be changed by the customer. // This parameter is optional. amount?: Amount; }
interface TemplateContractInventoryCart { // Inventory-cart: allow any inventory item to be selected. // Since protocol **v25**. selected_all?: boolean; // Inventory-cart: only products in these categories are selectable. // Since protocol **v25**. selected_categories?: Integer[]; // Inventory-cart: only these products are selectable. // Since protocol **v25**. selected_products?: string[]; // Inventory-cart: require exactly one selection entry. // Since protocol **v25**. choose_one?: boolean; // Inventory-cart: backend-provided payload with selectable data. // Only present in GET /templates/$TEMPLATE_ID responses. // Since protocol **v25**. inventory_payload?: InventoryPayload; }
interface TemplateContractPaivana { // Regular expression over URLs for which // this template is valid. // Optional, if not given all URLs are accepted. // Since protocol **v25**. website_regex?: string; // Methods to pay for the contract. choices: OrderChoice[]; }