taler-docs

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

check-pay-for-template.rst (1686B)


      1 .. ts:op:: checkPayForTemplate
      2 
      3   Check a ``taler://pay-template/`` URI without creating a payment
      4   transaction.
      5 
      6   Fetches the template details from the merchant, applies the overrides
      7   encoded in the URI (such as amount or summary), and returns the
      8   template details together with the currencies supported by the
      9   merchant.  This allows the client to present the editable template
     10   fields to the user before calling :ts:op:`preparePayForTemplateV2`.
     11 
     12   **Request:**
     13 
     14     The ``args`` must be a `CheckPayTemplateRequest` object.
     15 
     16   **Response:**
     17 
     18     On success, the result is a `CheckPayTemplateReponse` object.
     19 
     20   **Side effects:**
     21 
     22     Fetches the payment template and the merchant's configuration over
     23     the network; does not change wallet 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   **Details:**
     32 
     33     The ``templateDetails`` field is the template information served
     34     by the merchant backend (a `WalletTemplateDetailsResponse` of the
     35     merchant API), with the URI overrides already applied.
     36 
     37 .. ts:def:: CheckPayTemplateRequest
     38 
     39   interface CheckPayTemplateRequest {
     40     // The taler://pay-template/ URI to check.
     41     talerPayTemplateUri: string;
     42 
     43     // Enables progress correlation and cancellation through
     44     // cancelProgressToken.
     45     progressToken?: string;
     46   }
     47 
     48 .. ts:def:: CheckPayTemplateReponse
     49 
     50   type CheckPayTemplateReponse = {
     51     // Template details served by the merchant backend.
     52     templateDetails: WalletTemplateDetailsResponse;
     53 
     54     // Currencies supported by the merchant, sorted.
     55     supportedCurrencies: string[];
     56   };