- POST [/instances/$INSTANCE]/templates/$TEMPLATE_ID#
This using template can be modified by everyone and will be used to create order.
Request:
The request must be a UsingTemplateDetailsRequest and we accept JSON application and URL encoded.
Response:
- 400 Bad Request:
The request body is malformed. Returned with
TALER_EC_GENERIC_PARAMETER_MALFORMED,TALER_EC_MERCHANT_POST_USING_TEMPLATES_NO_AMOUNT,TALER_EC_MERCHANT_POST_USING_TEMPLATES_NO_CURRENCY,TALER_EC_MERCHANT_POST_USING_TEMPLATES_NO_SUMMARY,TALER_EC_MERCHANT_POST_USING_TEMPLATES_AMOUNT_CONFLICT_TEMPLATES_CONTRACT_AMOUNT,TALER_EC_MERCHANT_POST_USING_TEMPLATES_SUMMARY_CONFLICT_TEMPLATES_CONTRACT_SUBJECT,TALER_EC_MERCHANT_POST_USING_TEMPLATES_WRONG_PRODUCT,TALER_EC_MERCHANT_POST_USING_TEMPLATES_WRONG_TYPEorTALER_EC_MERCHANT_GENERIC_CURRENCY_MISMATCH.- 404 Not found:
The template, instance, or product is unknown. Returned with
TALER_EC_MERCHANT_GENERIC_TEMPLATE_UNKNOWNorTALER_EC_MERCHANT_GENERIC_PRODUCT_UNKNOWN.- 413 Request entity too large:
The uploaded body is to long, it exceeds the size limit. Returned with an error code of
TALER_EC_GENERIC_UPLOAD_EXCEEDS_LIMIT.- 500 Internal Server Error:
The server experienced an internal failure. Returned with
TALER_EC_GENERIC_DB_FETCH_FAILED,TALER_EC_GENERIC_FAILED_COMPUTE_AMOUNTorTALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE.
The response is exactly the same type of response as when creating an order using POST /private/orders.
Details:
type UsingTemplateDetailsRequest = (UsingTemplateFixedOrderRequest | UsingTemplateInventoryCartRequest | UsingTemplatePaivanaRequest) & UsingTemplateCommonRequest;
interface UsingTemplateCommonRequest { // 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; // Summary to use in the contract. Only if // not already specified by the template. summary?: string; // The amount to be paid, including tip. amount?: Amount; // Optional tip amount. Must match the currency of amount or the // fixed template currency. // Since protocol **v25**. tip?: Amount; }
interface UsingTemplateFixedOrderRequest { template_type: "fixed-order"; }
interface UsingTemplateInventoryCartRequest { template_type: "inventory-cart"; // Inventory-cart: selected products and quantities. // Since protocol **v25**. inventory_selection?: InventorySelectionEntry[]; }
interface InventorySelectionEntry { // Inventory product to add. product_id: string; // Quantity in "<integer>[.<fraction>]" form using the product unit rules. quantity: DecimalQuantity; }
interface UsingTemplatePaivanaRequest { template_type: "paivana"; // URL of the Paivana-protected website to be // accessed. Will become the fulfillment URL in // the contract. website: string; // Client Paivana ID to grant access to. // This becomes the "session_id" for session-based // access control. paivana_id: string; }