PHPackages                             aligent/orocommerce-fees-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. aligent/orocommerce-fees-bundle

ActiveLibrary[Payment Processing](/categories/payments)

aligent/orocommerce-fees-bundle
===============================

OroCommerce Bundle to charge Fees during Checkout

v5.0.4(2y ago)14071[1 issues](https://github.com/aligent/orocommerce-fees-bundle/issues)GPL-3.0-onlyPHPCI failing

Since Apr 12Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/aligent/orocommerce-fees-bundle)[ Packagist](https://packagist.org/packages/aligent/orocommerce-fees-bundle)[ RSS](/packages/aligent-orocommerce-fees-bundle/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (5)Dependencies (7)Versions (15)Used By (0)

Aligent OroCommerce Fees Bundle
===============================

[](#aligent-orocommerce-fees-bundle)

This Bundle adds the ability to dynamically inject 'fees' as new Line Items into the Checkout process.

For example, if a 'Handling Fee' is to be charged for orders under $100.

This Bundle takes advantage of OroCommerce's 'Freeform LineItem' feature, where a LineItem can be added to the Checkout without being linked to a Product.

It also supports Fees added as Subtotals against the entire Order.

Requirements
------------

[](#requirements)

- OroCommerce 5.0

Important Notes/Caveats
-----------------------

[](#important-notescaveats)

- This bundle currently only adds a Payment Processing Fee, any other Fees must be implemented manually using the provided Abstract classes/interfaces.
- The Line Item which is added to the cart is *not* a real product. We utilize the 'FreeForm Line Item' feature in Oro Checkouts. This allows the price and description to be set by the fee itself, and avoids any possible inventory/visibility issues.
- The process for placing a new Order (**ShoppingList =&gt; Checkout =&gt; Order**) is slightly different to the process for Re-Ordering an existing Order (**Order =&gt; Checkout =&gt; Order**). As a result, our `CreateCheckoutListener` is required to manually persist/flush the Checkout so that the new line item is saved.

Installation and Usage
----------------------

[](#installation-and-usage)

**NOTE: Adjust instructions as needed for your local environment**

### Installation

[](#installation)

Install via Composer

```
composer require aligent/orocommerce-fees-bundle
```

Once installed, run platform update to perform the installation:

```
php bin/console oro:platform:update --env=prod
```

### Configuration

[](#configuration)

1. Login to the Oro Admin
2. Visit **System Configuration =&gt; Commerce =&gt; Aligent =&gt; Fees** (or the Website-specific equivalent)
3. Set the **Default Product Tax Code**

[![Tax Code Configuration](src/Aligent/FeesBundle/Resources/doc/img/tax-code-configuration.png)](src/Aligent/FeesBundle/Resources/doc/img/tax-code-configuration.png)

Note: This Tax Code will apply to the Fee itself. Oro does not apply taxes to FreeForm Line Items, this configuration is used by our `ContextHandler\FreeFormAwareTaxOrderLineItemHandler` to apply the correct tax.

Database Modifications
----------------------

[](#database-modifications)

- Adds a new `processing_fee` column to the `oro_order` database table (and extends the Oro `Order` entity)

All configuration is stored in System Configuration (`oro_config_value`).

### Payment Processing Fees

[](#payment-processing-fees)

This feature allows OroCommerce to charge an additional percentage for payments made via specific methods.

The percentage can be configured on a per-Method basis, eg:

- 1.5% fee for VISA/MasterCard Credit Card Payments
- 2.0% fee for AMEX Credit Card Payments

After installation, visit the System Configuration (or Website Configuration to configure on a per-Website scope).

Each Payment Method will be visible here. Set the Percentage to a value above `0` to charge a processing fee for that method:

[![Processing Fees Configuration](src/Aligent/FeesBundle/Resources/doc/img/processing-fees-configuration.png)](src/Aligent/FeesBundle/Resources/doc/img/processing-fees-configuration.png)

If the Customer chooses that method during the Checkout, a processing fee will be calculated and add to the Subtotals:

[![Processing Fees Subtotal](src/Aligent/FeesBundle/Resources/doc/img/processing-fees-subtotal.png)](src/Aligent/FeesBundle/Resources/doc/img/processing-fees-subtotal.png)

**NOTE: Processing Fees are not currently support by PayPal Express as they are not included in the Subtotal, which causes a payment validation error.**

Additionally, the [PayPal User Agreement](https://www.paypal.com/us/webapps/mpp/ua/useragreement-full) does not allow charging Payment Processing Fees (See [\#13](https://github.com/aligent/orocommerce-fees-bundle/issues/13))

### Adding and Registering new Custom Fees

[](#adding-and-registering-new-custom-fees)

1. Create a new Bundle (or use an existing one as needed)
2. Create a new class for the fee (eg `MyBundle\Fee\HandlingFeeProvider`). This new class should extend `Aligent\FeesBundle\Fee\AbstractLineItemFee`.
3. Define a new service for the new fee, and add it to the fee registry:

    ```
    services:
        Acme\MyBundle\Fee\HandlingFeeProvider:
            parent: '@Aligent\FeesBundle\Fee\Provider\AbstractLineItemFeeProvider'
            tags:
                - { name: aligent_fees.fee_provider, priority: 0 }
    ```
4. Create a new Fee Provider Class and implement the applicable methods:

    ```
