Skip to content
Payment Fee Plugin adds possibility to charge the customer for specific payment method e.g. Cash on Delivery.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Payment Fee Plugin


  • Charge extra fee for using payment method.
  • Typical usage: Cash on Delivery.
  • Taxes are implemented the same way as taxes for shipping fees.


  1. Run $ composer require mangoweb-sylius/sylius-payment-fee-plugin.
  2. Register \MangoSylius\PaymentFeePlugin\MangoSyliusPaymentFeePlugin in your Kernel.
  3. Your Entity PaymentMethod has to implement \MangoSylius\PaymentFeePlugin\Model\PaymentMethodWithFeeInterface. You can use Trait MangoSylius\PaymentFeePlugin\Model\PaymentMethodWithFeeTrait.

For guide how to use your own entity see Sylius docs - Customizing Models


  1. Add this to @SyliusAdmin/PaymentMethod/_form.html.twig template.
<div class="ui segment">
	<h4 class="ui dividing header">{{ 'mango-sylius.ui.payment_charges'|trans }}</h4>
	{{ form_row(form.calculator) }}
	{% for name, calculatorConfigurationPrototype in form.vars.prototypes %}
		<div id="{{ }}_{{ name }}" data-container=".calculatorConfiguration"
			 data-prototype="{{ form_widget(calculatorConfigurationPrototype)|e }}">
	{% endfor %}
	<div class="ui segment calculatorConfiguration">
		{% if form.calculatorConfiguration is defined %}
			{% for field in form.calculatorConfiguration %}
				{{ form_row(field) }}
			{% endfor %}
		{% endif %}
  1. Add this to AdminBundle/Resources/views/Order/Show/Summary/_totals.html.twig.
{% set paymentFeeAdjustment = constant('MangoSylius\\PaymentFeePlugin\\Model\\AdjustmentInterface::PAYMENT_ADJUSTMENT') %}

{% set paymentFeeAdjustments = order.getAdjustmentsRecursively(paymentFeeAdjustment) %}
{% if paymentFeeAdjustments is not empty %}
		<td colspan="4" id="payment-fee">

			<div class="ui relaxed divided list">
				{% for paymentFeeLabel, paymentFeeAmount in sylius_aggregate_adjustments(paymentFeeAdjustments) %}
					<div class="item">
						<div class="content">
							<span class="header">{{ paymentFeeLabel }}</span>
							<div class="description">
								{{ money.format(paymentFeeAmount, order.currencyCode) }}
				{% endfor %}

		<td colspan="4" id="paymentFee-total" class="right aligned">
			<strong>{{ 'mango-sylius.ui.paymentFee_total'|trans }}</strong>:
			{{ money.format(order.getAdjustmentsTotal(paymentFeeAdjustment) ,order.currencyCode) }}
{% endif %}



  • Create symlink from .env.dist to .env or create your own .env file
  • Develop your plugin in /src
  • See bin/ for useful commands


After your changes you must ensure that the tests are still passing.

  • Easy Coding Standard
  • PHPStan


This library is under the MIT license.


Developed by manGoweb.

You can’t perform that action at this time.