PHPackages                             dahromy/mvola-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. dahromy/mvola-bundle

ActiveSymfony-bundle[Payment Processing](/categories/payments)

dahromy/mvola-bundle
====================

Symfony bundle for MVola Merchant Pay API

1.1(1y ago)3221MITPHPPHP &gt;=7.4

Since Sep 12Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (3)Used By (0)

MVola Bundle for Symfony
========================

[](#mvola-bundle-for-symfony)

The MVola Bundle is a Symfony bundle that provides integration with the MVola payment gateway. It offers a convenient way to interact with the MVola API, handle transactions, and manage callbacks.

Features
--------

[](#features)

- Easy integration with Symfony projects
- Handles MVola API authentication
- Provides services for initiating transactions, checking transaction status, and retrieving transaction details
- Includes a callback handler for processing MVola notifications
- Configurable retry mechanism for API calls
- Caching support for authentication tokens

Installation
------------

[](#installation)

You can install the MVola Bundle using Composer:

```
composer require dahromy/mvola-bundle
```

Configuration
-------------

[](#configuration)

After installing the bundle, you need to configure it in your Symfony application. Add the following to your `config/packages/mvola.yaml` file:

```
mvola:
    environment: '%env(MVOLA_ENVIRONMENT)%'
    merchant_number: '%env(MVOLA_MERCHANT_NUMBER)%'
    company_name: '%env(MVOLA_COMPANY_NAME)%'
    consumer_key: '%env(MVOLA_CONSUMER_KEY)%'
    consumer_secret: '%env(MVOLA_CONSUMER_SECRET)%'
    auth_url: '%env(MVOLA_AUTH_URL)%'
    max_retries: 3
    retry_delay: 1000
    cache_ttl: 3600
```

Make sure to set the corresponding environment variables in your `.env` file:

```
MVOLA_ENVIRONMENT=sandbox
MVOLA_CONSUMER_KEY=your_consumer_key_here
MVOLA_CONSUMER_SECRET=your_consumer_secret_here
MVOLA_MERCHANT_NUMBER=your_merchant_number_here
MVOLA_COMPANY_NAME=your_company_name_here
MVOLA_AUTH_URL=https://sandbox.mvola.mg/token

```

Usage
-----

[](#usage)

### Initiating a Transaction

[](#initiating-a-transaction)

To initiate a transaction, you can use the `MVolaService`:

```
use DahRomy\MVola\Service\MVolaService;
use DahRomy\MVola\Model\TransactionRequest;

class PaymentController extends AbstractController
{
    private $mvolaService;

    public function __construct(MVolaService $mvolaService)
    {
        $this->mvolaService = $mvolaService;
    }

    public function initiatePayment()
    {
        $transactionRequest = new TransactionRequest();
        $transactionRequest->setAmount(1000)
            ->setCurrency('Ar')
            ->setDescriptionText('Payment for order #123')
            ->setRequestingOrganisationTransactionReference('123456')
            ->setRequestDate(new \DateTime())
            ->setOriginalTransactionReference('123456')
            ->setDebitParty([['key' => 'msisdn', 'value' => '0343500003']])
            ->setCreditParty([['key' => 'msisdn', 'value' => '0343500004']])
            ->setMetadata([
                ['key' => 'partnerName', 'value' => 'Partner Name'],
                ['key' => 'fc', 'value' => 'USD'],
                ['key' => 'amountFc', 'value' => '1']
            ])
            ->setCallbackData([
                'userId' => '123456',
                // ... other callback data
            ]);

        $result = $this->mvolaService->initiateTransaction($transactionRequest);

        // Handle the result
    }
}
```

### Checking Transaction Status

[](#checking-transaction-status)

To check the status of a transaction:

```
$status = $this->mvolaService->getTransactionStatus($serverCorrelationId);
```

### Retrieving Transaction Details

[](#retrieving-transaction-details)

To get the details of a transaction:

```
$details = $this->mvolaService->getTransactionDetails($transactionId);
```

### Handling Callbacks

[](#handling-callbacks)

The MVola Bundle provides a built-in callback handler that processes incoming callbacks from MVola. To handle these callbacks in your application, follow these steps:

1. Create an event subscriber:

```
use DahRomy\MVola\Event\MVolaCallbackEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class MVolaCallbackSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            MVolaCallbackEvent::NAME => 'onMVolaCallback',
        ];
    }

    public function onMVolaCallback(MVolaCallbackEvent $event): void
    {
        // Response data from MVola
        $mvolaData = $event->getMVolaData();

        // Callback data sent with the transaction request
        $callbackData = $event->getCallbackData();

        // Process the callback data
        // For example, update the transaction status in your database
        // or trigger any necessary business logic
    }
}
```

2. Register your event subscriber in your `services.yaml`:

```
services:
    App\EventSubscriber\MVolaCallbackSubscriber:
        tags:
            - { name: kernel.event_subscriber }
```

3. Configure the callback URL:

When initiating a transaction, you can include custom callback data:

```
$transactionRequest = new TransactionRequest();
// ... set other transaction details ...
$transactionRequest->setCallbackData([
    'orderId' => '123456',
    'customerId' => '789',
]);

$result = $this->mvolaService->initiateTransaction($transactionRequest);
```

The MVola Bundle will automatically handle incoming callbacks at the `/mvola/callback` endpoint. When a callback is received, it will:

1. Log the received callback data
2. Dispatch a `MVolaCallbackEvent`

Your event subscriber will then be called to process the callback data according to your application's needs.

You can also customize the callback URL by setting the `callbackUrl` property in the `TransactionRequest` object:

```
$transactionRequest->setCallbackUrl('https://example.com/mvola/callback');
```

Note: Ensure that your server is configured to accept PUT requests at the callback URL, as MVola sends callbacks using the PUT method.

Error Handling
--------------

[](#error-handling)

The bundle throws specific exceptions for different error scenarios. Make sure to catch and handle these exceptions in your application:

- `MVolaApiException`: For general API errors
- `MVolaAuthenticationException`: For authentication-related errors
- `MVolaValidationException`: For validation errors in the request data
- `MVolaNetworkException`: For network-related errors
- `MVolaRateLimitException`: For rate limit errors

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This bundle is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

2

Last Release

644d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/50836890?v=4)[Roméo Honoré RAZAFINDRAKOTO](/maintainers/dahromy)[@dahromy](https://github.com/dahromy)

---

Top Contributors

[![dahromy](https://avatars.githubusercontent.com/u/50836890?v=4)](https://github.com/dahromy "dahromy (11 commits)")

### Embed Badge

![Health badge](/badges/dahromy-mvola-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/dahromy-mvola-bundle/health.svg)](https://phpackages.com/packages/dahromy-mvola-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M376](/packages/easycorp-easyadmin-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M519](/packages/shopware-core)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M462](/packages/pimcore-pimcore)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
