taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

prepare-pay-for-template-v2.rst (1410B)


      1 .. ts:op:: preparePayForTemplateV2
      2 
      3   Prepare to make a payment based on a ``taler://pay-template/`` URI.
      4 
      5   Instantiates the referenced order template at the merchant, honoring
      6   ``templateParams`` for template fields that are editable by the
      7   customer, and creates (or reuses) a payment transaction for the
      8   resulting order.  As with :ts:op:`preparePayForUriV2`, the payment is
      9   then inspected with :ts:op:`getChoicesForPayment` and confirmed with
     10   :ts:op:`confirmPay`.
     11 
     12   **Request:**
     13 
     14     The ``args`` must be a `PreparePayTemplateRequest` object.
     15 
     16   **Response:**
     17 
     18     On success, the result is a `PreparePayV2Result` object.
     19 
     20   **Side effects:**
     21 
     22     Fetches the payment template from the merchant over the network
     23     and creates a payment transaction in dialog state.
     24 
     25   **Expected errors:**
     26 
     27     The caller can handle the following errors inline:
     28     ``WALLET_TALER_URI_MALFORMED``,
     29     ``WALLET_CONTRACT_TERMS_UNSUPPORTED``.
     30 
     31 .. ts:def:: PreparePayTemplateRequest
     32 
     33   interface PreparePayTemplateRequest {
     34     // The taler://pay-template/ URI to pay.
     35     talerPayTemplateUri: string;
     36 
     37     // Values for editable template fields.
     38     templateParams?: TemplateParams;
     39 
     40     // Enables progress correlation and cancellation through
     41     // cancelProgressToken.
     42     progressToken?: string;
     43   }
     44 
     45 .. ts:def:: TemplateParams
     46 
     47   type TemplateParams = {
     48     amount?: AmountString;
     49     summary?: string;
     50   };