Contents

preparePayForTemplateV2#

Prepare to make a payment based on a taler://pay-template/ URI.

Instantiates the referenced order template at the merchant, honoring templateParams for template fields that are editable by the customer, and creates (or reuses) a payment transaction for the resulting order. As with preparePayForUriV2, the payment is then inspected with getChoicesForPayment and confirmed with confirmPay.

Request:

The args must be a PreparePayTemplateRequest object.

Response:

On success, the result is a PreparePayV2Result object.

Side effects:

Fetches the payment template from the merchant over the network and creates a payment transaction in dialog state.

Expected errors:

The caller can handle the following errors inline: WALLET_TALER_URI_MALFORMED, WALLET_CONTRACT_TERMS_UNSUPPORTED.

interface PreparePayTemplateRequest {
  // The taler://pay-template/ URI to pay.
  talerPayTemplateUri: string;

  // Values for editable template fields.
  templateParams?: TemplateParams;

  // Enables progress correlation and cancellation through
  // cancelProgressToken.
  progressToken?: string;
}
type TemplateParams = {
  amount?: AmountString;
  summary?: string;
};