Skip to content
Log in

Additional Payments Applied Vouchers Controller - Liquid Controller Reference

On this page

Description

The Additional Payments Applied Vouchers controller applies a voucher to, or removes one from, an order’s outstanding-balance payment page. It is the voucher counterpart of the Additional Payments controller.

Property Value
Controller AdditionalPayments::AppliedVouchersController
Liquid Template Path controllers/additional_payments/applied_vouchers/
Namespace AdditionalPayments

Actions

Action HTTP Method Route Result
create POST /orders/:order_reference_number/payment/applied_vouchers Applies the voucher, then redirects back to the payment page
destroy DELETE /orders/:order_reference_number/payment/applied_vouchers/:id Removes the voucher, then redirects back to the payment page

A voucher cannot be applied to a subscription renewal order. The request redirects back with an error instead.

Example

Create a theme template with the key controllers/additional_payments/applied_vouchers/create to notify another system each time a customer applies a voucher to an outstanding balance. {% api %} inside {% final %} runs after the response is sent, so the customer does not wait for it:

```liquid

{% final %} {%- new Map payload -%} {%- assign payload = payload | set_key: “event”, “voucher_applied” | set_key: “order”, current_request.params.order_reference_number -%} {% api url: “https://hooks.example.com/vouchers”, method: “post”, data: payload %} {% endapi %} {% endfinal %} ```

See how Liquid controllers work for the phases and the tags you can use in them.

Was this article helpful?

Was this article helpful?