PHPackages                             sander-van-hooft/laravel-payable-redirect-mollie - 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. [Database &amp; ORM](/categories/database)
4. /
5. sander-van-hooft/laravel-payable-redirect-mollie

ActiveLibrary[Database &amp; ORM](/categories/database)

sander-van-hooft/laravel-payable-redirect-mollie
================================================

Associate Mollie payments with Laravel Eloquent models

1.0.4(8y ago)214934[1 issues](https://github.com/sandervanhooft/laravel-payable-redirect-mollie/issues)MITPHPPHP ~5.6|~7.0

Since Jun 7Pushed 8y ago3 watchersCompare

[ Source](https://github.com/sandervanhooft/laravel-payable-redirect-mollie)[ Packagist](https://packagist.org/packages/sander-van-hooft/laravel-payable-redirect-mollie)[ RSS](/packages/sander-van-hooft-laravel-payable-redirect-mollie/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (3)Dependencies (9)Versions (6)Used By (0)

Associate Mollie payments with Eloquent models
==============================================

[](#associate-mollie-payments-with-eloquent-models)

[![Latest Version on Packagist](https://camo.githubusercontent.com/73fdda52348a7a7ed8038324484c3f210a567a26ec5196173bc6bc9d9d8117bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616e6465722d76616e2d686f6f66742f6c61726176656c2d70617961626c652d72656469726563742d6d6f6c6c69652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sander-van-hooft/laravel-payable-redirect-mollie)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/bac5159333dc4c1a11271ff1453058d8232b2d89f32ee4940a0e428feb986006/68747470733a2f2f7472617669732d63692e6f72672f73616e64657276616e686f6f66742f6c61726176656c2d70617961626c652d72656469726563742d6d6f6c6c69652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sandervanhooft/laravel-payable-redirect-mollie)[![Code Quality](https://camo.githubusercontent.com/90dca2faf9563c4ae6cbcbb6c8389832f9ef652e3b034061b390e4458212a58b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616e64657276616e686f6f66742f6c61726176656c2d70617961626c652d72656469726563742d6d6f6c6c69652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/sandervanhooft/laravel-payable-redirect-mollie/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/3d5066d649e08ff590932d6d34c7578585d31dc22a2857e98a81176f3b6a2890/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616e6465722d76616e2d686f6f66742f6c61726176656c2d70617961626c652d72656469726563742d6d6f6c6c69652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sander-van-hooft/laravel-payable-redirect-mollie)

Implementing Mollie payments in your Laravel 5.4 app does not have to be difficult. This package helps you by creating payment records and keeping the status in sync with Mollie. It is built on top of the very solid official [Mollie PHP client](https://github.com/mollie/mollie-api-php). It supports one-off payments only; recurring payments are not (yet) supported.

Structure
---------

[](#structure)

```
config/
database/
docs/
routes/
src/
tests/

```

Install
-------

[](#install)

Via Composer

```
$ composer require sander-van-hooft/laravel-payable-redirect-mollie
```

Next, you must install the service provider:

```
// config/app.php
'providers' => [
    ...
    SanderVanHooft\PayableRedirect\PayableRedirectServiceProvider::class,
];
```

And add the Mollie API key to the `.env` file in your project root. This is also where you can override the webhook route which Mollie calls when a payment status is updated:

```
# /.env:
...
MOLLIE_KEY=YOUR_MOLLIE_API_KEY_HERE
# MOLLIE_WEBHOOK_URL=your_url_relative/to_your_app_url
```

You can publish the migration with:

```
$ php artisan vendor:publish --provider="SanderVanHooft\PayableRedirect\PayableRedirectServiceProvider" --tag="migrations"
```

After the migration has been published you can create the payments-table by running the migrations:

```
$ php artisan migrate
```

Laravel automatically loads the routes from this package.

If you prefer this over configuring using the `.env` file (not required!) you can also publish the `payable.php` config file with:

```
$ php artisan vendor:publish --provider="SanderVanHooft\PayableRedirect\PayableRedirectServiceProvider" --tag="config"
```

In the config file, you can set the MOLLIE api key and override the default mollie payment webhook route. This is what the default config file looks like:

```
return [
    'mollie' => [
        'key' => env('MOLLIE_KEY', 'test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
        'webhook_url' => env('MOLLIE_WEBHOOK_URL', '/webhooks/payments/mollie'),
    ],
];
```

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

In your code, create a Payment record using the MolliePaymentGateway:

```
// Using some App\Order model (provided by you)

$order = new App\Order(['amount' => 12345]);
$order->save();

$paymentGateway = new SanderVanHooft\PayableRedirect\MolliePaymentGateway;

$payment = $paymentGateway->chargeAmountForPayable(
    $order->amount, // AMOUNT IN CENTS!!
    $order,
    'Some description',
    [ 'return_url' => 'http://some-return-url.com' ]
);
```

**The payment amount is in eurocents!**

The payment status will be kept in sync with Mollie: Mollie will call the webhook whenever the payment status changes. This will trigger your app to fetch the latest payment status from Mollie. Mollie has designed this process in this way for security reasons.

### IsPayableTrait

[](#ispayabletrait)

For convenience you can use the `isPayableTrait` on your payable Eloquent model (the `App\Order` model in the example above). This enables you to call `$order->payments`.

```
use Illuminate\Database\Eloquent\Model;
use SanderVanHooft\PayableRedirect\Payment;
use SanderVanHooft\PayableRedirect\IsPayable\IsPayableTrait;

class Order extends Model
{
    use IsPayableTrait;
}
```

### Events

[](#events)

PaymentEvents are dispatched for easy integration with your own custom listeners (see [Laravel events and listeners](https://laravel.com/docs/5.4/events)). The following events are available:

- PaymentUpdated: this event is dispatched when Mollie calls the webhook. It checks whether the payment status really has changed. Depending on the new status, it dispatches one of the [Mollie based](https://www.mollie.com/nl/docs/status) events below.
- PaymentCancelled
- PaymentChargedBack
- PaymentExpired
- PaymentFailed
- PaymentOpened
- PaymentPaid
- PaymentPaidOut
- PaymentPending
- PaymentRefunded

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

Please mind that for testing the payment status synchronisation your app needs to be reachable on a public url by Mollie. Therefore, under normal circumstances, you cannot fully test this functionality on a local Laravel installation.

Make sure to configure the Mollie API key (`MOLLIE_KEY`) as an environment variable. This can for example be done in the `phpunit.xml` file.

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Sander van Hooft](https://github.com/sandervanhooft)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 91.9% 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 ~61 days

Total

5

Last Release

3067d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/78913b3d9fc2c28cf333e08366566ac23d0894a14d4c0914365acfb208420c29?d=identicon)[sandervanhooft](/maintainers/sandervanhooft)

---

Top Contributors

[![sandervanhooft](https://avatars.githubusercontent.com/u/7265703?v=4)](https://github.com/sandervanhooft "sandervanhooft (34 commits)")[![tomodutch](https://avatars.githubusercontent.com/u/4613944?v=4)](https://github.com/tomodutch "tomodutch (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

eloquentlaravellaravel-5-packagemolliepaymentslaraveleloquentmollieredirectSanderVanHooftpayable

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sander-van-hooft-laravel-payable-redirect-mollie/health.svg)

```
[![Health](https://phpackages.com/badges/sander-van-hooft-laravel-payable-redirect-mollie/health.svg)](https://phpackages.com/packages/sander-van-hooft-laravel-payable-redirect-mollie)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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