Mollie API client wrapper for Laravel & Mollie Connect provider for Laravel Socialite

Overview

Mollie for Laravel

Laravel-Mollie incorporates the Mollie API and Mollie Connect into your Laravel or Lumen project.

Accepting iDEAL, Apple Pay, Bancontact/Mister Cash, SOFORT Banking, Creditcard, SEPA Bank transfer, SEPA Direct debit, PayPal, Belfius Direct Net, KBC/CBC, paysafecard, ING Home'Pay, Giftcards, Giropay, EPS and Przelewy24 online payments without fixed monthly costs or any punishing registration procedures. Just use the Mollie API to receive payments directly on your website or easily refund transactions to your customers.

Looking for a complete recurring billing solution? Take a look at laravel/cashier-mollie instead.

Build Status Latest Stable Version Total Downloads

Requirements

  • Get yourself a free Mollie account. No sign up costs.
  • Now you're ready to use the Mollie API client in test mode.
  • Follow a few steps to enable payment methods in live mode, and let us handle the rest.
  • Up-to-date OpenSSL (or other SSL/TLS toolkit)
  • PHP >= 7.0
  • Laravel (or Lumen) >= 5.5
  • Laravel Socialite >= 3.0 (if you intend on using Mollie Connect)

Upgrading from v1.x?

To support the enhanced Mollie API, some breaking changes were introduced. Make sure to follow the instructions in the package migration guide.

Not ready to upgrade? The Laravel-Mollie client v1 will remain supported for now.

Fresh install? Continue with the installation guide below.

Installation

Add Laravel-Mollie to your composer file via the composer require command:

$ composer require mollie/laravel-mollie:^2.0

Or add it to composer.json manually:

"require": {
    "mollie/laravel-mollie": "^2.0"
}

Laravel-Mollie's service providers will be automatically registered using Laravel's auto-discovery feature.

Note: For Lumen you have to add the Mollie facade and service provider manually to: bootstrap/app.php :

$app->withFacades(true, ['Mollie\Laravel\Facades\Mollie' => 'Mollie']);

$app->register(Mollie\Laravel\MollieServiceProvider::class);

Configuration

You'll only need to add the MOLLIE_KEY variable to your .env file.

MOLLIE_KEY=test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Example usage

Here you can see an example of just how simple this package is to use.

A payment using the Mollie API

use Mollie\Laravel\Facades\Mollie;

public function preparePayment()
{
    $payment = Mollie::api()->payments->create([
        "amount" => [
            "currency" => "EUR",
            "value" => "10.00" // You must send the correct number of decimals, thus we enforce the use of strings
        ],
        "description" => "Order #12345",
        "redirectUrl" => route('order.success'),
        "webhookUrl" => route('webhooks.mollie'),
        "metadata" => [
            "order_id" => "12345",
        ],
    ]);

    // redirect customer to Mollie checkout page
    return redirect($payment->getCheckoutUrl(), 303);
}

/**
 * After the customer has completed the transaction,
 * you can fetch, check and process the payment.
 * This logic typically goes into the controller handling the inbound webhook request.
 * See the webhook docs in /docs and on mollie.com for more information.
 */
public function handleWebhookNotification(Request $request) {
    $paymentId = $request->input('id');
    $payment = Mollie::api()->payments->get($paymentId);

    if ($payment->isPaid())
    {
        echo 'Payment received.';
        // Do your thing ...
    }
}

Global helper method

For your convencience we've added the global mollie() helper function. It's an easy shortcut to the Mollie::api() facade accessor.

// Using facade accessor
$payment = \Mollie\Laravel\Facades\Mollie::api()->payments->get($payment_id);

// Using global helper function
$payment = mollie()->payments->get($payment_id);

Other examples

Roadmap

You can find the latest development roadmap for this package here. Feel free to open an issue if you have a feature request.

Want to help us make our Laravel module even better?

Want to help us make our Laravel module even better? We take pull requests, sure. But how would you like to contribute to a technology oriented organization? Mollie is hiring developers and system engineers. Check out our vacancies or get in touch.

License

BSD (Berkeley Software Distribution) License. Copyright (c) 2016, Mollie B.V.

Support

Contact: www.mollie.com β€” [email protected] β€” +31 20-612 88 55

Comments
  • Not getting into the webhook?

    Not getting into the webhook?

    Hi,

    I'm struggling a bit.. for some reason its not getting into the webhook.

    Web route: Route::post('pay/status', 'DonateController@handle');

    Controller code for store:

    $payment = Mollie::api()->payments()->create([
            'amount' => [
              'currency' => 'EUR',
              'value' => '10.00', 
            ],
            "description" => "New Donation!",
            'redirectUrl' => "https://xxxx.com/",
            'webhookUrl'   => "https://xxxx.com/pay/status",
          ]);
          $donate = new Donate;
          $donate->payment_id = $payment->id;
          $donate->payment_status = 'Pending';
          $donate->save();
          return redirect($payment->getCheckoutUrl());
    

    Handle:

    public function handle(Request $request) {
          $donateid = $request->id;
          $donate = Donate::where('payment_id', $donateid);
          $payment = Mollie::api()->payments()->get($donateid);
          
          if($payment->isPaid()) {
            $donate->payment_status = "Paid";
            $donate->save();
          }
        }
    

    VerifyCsrfToken:

    protected $except = [
        'pay/status'
      ];
    

    Its perfecty redirecting, but not getting into the handle part. Nothing in the log files aswell. It just redirect to the giving redirection url.

    Any help would be awesome, thanks in advance for helping me and telling me what i'm doing wrong. ;-)

    question v2 
    opened by JerryKrakel 33
  • Webhook failed with status code 405 (Got HTTP/1.1 405 Method Not Allowed instead of 20x)

    Webhook failed with status code 405 (Got HTTP/1.1 405 Method Not Allowed instead of 20x)

    Hi, I'm using larval-mollie. no problem to generate payment url and make payment with Mollie web form, but my web hook still return 405 error.

    Routes/web.php Route::post('pay/status', ['as' => 'pay.status', 'uses' => 'PaymentController@statusPayment']);

    • the controller is not protected by auth middleware;
    • pay/status is the web hook url;
    • in Http/Middleware/VerifyCsrfToken I have insert: protected $except = [ 'pay/status' ];

    But in Mollie transaction detail I have this error: Webhook failed with status code 405 (Got HTTP/1.1 405 Method Not Allowed instead of 20x)

    Any ideas? Thanks!

    help wanted v1 
    opened by starloungeswitzerland 26
  • openssl error

    openssl error

    when I open my website asp-school.nl, the website gave me the following error message: Unable to communicate with Mollie (35): OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.mollie.nl:443 . (View: C:\inetpub\vhosts\asp-school.nl\laravel\resources\views\master2.blade.php) (View: C:\inetpub\vhosts\asp-school.nl\laravel\resources\views\master2.blade.php)

    Expected Behavior

    • sometimes the error appears when I open a normal page, there is no need to pay via mollie to get this error message
    • the error not always appears.
    • this error appears since 2 weeks

    Current Behavior

    Possible Solution

    Steps to Reproduce (for bugs)

    1.I check SSL certificate and it works fine 2. 3. 4.

    Context

    just open the website

    Your Environment

    • Version used: laravel 5.2
    • Environment name and version (e.g. Chrome 39, node.js 5.4): laravvel 5.2
    • Operating System and version (desktop or mobile): all versions
    • Link to your project: asp-school.nl
    opened by ruteeb 17
  • Webhook url replaced with https://paymentlink.mollie.com

    Webhook url replaced with https://paymentlink.mollie.com

    I created a paymentlink via the Mollie client and provided a webhookUrl to my application, but instead a link to https://paymentlink.mollie.com/ is added in the created payment link. One note, I do not provide a custom redirectUrl. So the customer is redirected to the default Mollie payment success screen.

    Expected Behavior

    The created payment should have the provided webhook that was in the Payment link creation request.

    Current Behavior

    Instead of the link to my applications webhook URL, the https://paymentlink.mollie.com URL is used.

    Possible Solution

    Steps to Reproduce (for bugs)

    Create a payment link

    $paymentLink = mollie()->paymentLinks()->create([
    	"amount"      => [
    		"currency" => "EUR",
    		"value"    => number_format($this->appointment->price, 2, '.', ''),
    	],
    	"description" => $this->appointment->description,
    	"webhookUrl"  => config('app.url') . "/payments/status/{$this->appointment->id}",
    ]);
    

    Check the webhook url in the created request.

    Context

    Your Environment

    Laravel 8.54.0 Laravel Mollie: 2.15.0 Mollie API PHP 3.37.1

    • Version used:
    • Environment name and version (e.g. Chrome 39, node.js 5.4):
    • Operating System and version (desktop or mobile):
    • Link to your project:
    opened by sanderdewijs 16
  • The webhook URL is invalid because it is unreachable from Mollie's point of view

    The webhook URL is invalid because it is unreachable from Mollie's point of view

    Hello,

    I was testing Mollie in local. I was following the given example, but when I try to call mollie using the webhookUrl, I get this error:

    Error executing API call (422: Unprocessable Entity): The webhook URL is invalid because it is unreachable from Mollie's point of view

    Do I need to configure a local point for testing in Mollies Dashboard? Any ideas? Thanks

    opened by gabzon 16
  • Socialite not extending

    Socialite not extending

    MollieServiceProvider is not loading out of console. I've added a dd('test') in this file. but nothing shows up if i open the application, but if i run an artisan command it shows up.

    Expected Behavior

    Should load provider with socialite extension. because it shows now Driver [mollie] not supported.

    Your Environment

    Laravel 5.7.10 Socialite 3.2 Laravel-mollie 2.3.0

    bug v2 socialite 
    opened by sweebee 13
  • 422: Unprocessable Entity: No suitable payment methods found

    422: Unprocessable Entity: No suitable payment methods found

    I'm testing the mollie api. Payment methods like PayPal is activated but has to be reviewed. The review is not possible because the project is not online yet... How i can test the payment?

    opened by divdax 12
  • Failed calling webhook statuscode 500 (Internal Server Error)

    Failed calling webhook statuscode 500 (Internal Server Error)

    Mollie suddenly is not able to call the webhook

    The webhook was fully functional. but suddenly it doesn't do anything and I am not getting a single output in my logs. I include metadata with my orders, but there is nothing wrong with that. It is the exact same as when it worked

    Hopefully anyone can help?

    opened by XavegX367 12
  • Redirect url called twice in the same second

    Redirect url called twice in the same second

    We are sending the order confirmation mail job and order job from the controller that is connected to the redirect url. Normally every job in the controller is carried out once. But this time the jobs were carried out twice. This couldn't be possible with a refresh because we added checks, this is also the first time it happend in like 40 orders. 4807873afeeb452f51cf5c03e52d631e

    Specs:

    • PHP 7.4.2
    • Laravel Framework 6.18.0
    • mollie/laravel-mollie v2.8.0.
    opened by jesse-dijkstra 11
  • Webhook : how to catch cancelled refund ?

    Webhook : how to catch cancelled refund ?

    Hello, I'm testing Mollie and I saw that when I cancel a refund from the dashboard, the webhook is called. I can not find any documentation to know how I can capture the canceled refund.

    I need this to cancel transactions and credit notes on my server.

    If I cancel a refund to the customer, the webhook displays a 500 error because it treats mollie's call as a payment and not a refund (it seems to me).

    Here is a summary of the code used in the webhook. How can I capture canceled refunds?

    Thank you

    try {
    
                if (! $request->has('id')) {
                    return;
                }
                
                $payment = Mollie::api()->payments()->get($request->id);
                
                if($payment->isPaid() && !$payment->hasRefunds() && !$payment->hasChargebacks()) {
    
                    //Create transaction
    
                } elseif($payment->hasRefunds()) {
    
                    //Create refund transaction
    
                } elseif($payment->hasChargebacks()) {
    
                    //Catch user bank charge back request
                }
    
            } catch (ApiException $e) {
                echo "API call failed: " . htmlspecialchars($e->getMessage());
            }
    
    opened by visualight 11
  • webhookUrl is not saved in mollie dashboard when creating mollie order

    webhookUrl is not saved in mollie dashboard when creating mollie order

    The webhookUrl is shown in the Mollie order resource but not in the Mollie dashboard. Therefore Mollie isn't calling the webhook. The documentation states the following : The Orders API invokes a webhook when an order reaches paid or authorized status

    The Order resource status is not being updated aswell. example: the order status in Mollie dashboard is : Canceled while the status in the order resource is still created

    opened by jesse-dijkstra 9
  • Preparing Laravel-Mollie v3

    Preparing Laravel-Mollie v3

    This issue is for discussing / listing v3 features.

    These features are intended to be included:

    • [ ] MIT license (replaces BSD-2)
    • [ ] resolve socialite binding issues (probably a breaking change) by using a dedicated MollieConnectServiceProvider.
    • [ ] provide default webhook route with controller and events. All configurable.

    Also, don't forget:

    • [ ] migration guide (if required)
    • [ ] update roadmap
    enhancement socialite v3 
    opened by sandervanhooft 4
Releases(v2.21.1)
  • v2.21.1(Dec 15, 2022)

    What's Changed

    • Fixes #653 MollieLaravelHttpClientAdapter::send when returning a null value by @sandervanhooft in https://github.com/mollie/laravel-mollie/pull/217

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.21.0...v2.21.1

    Source code(tar.gz)
    Source code(zip)
  • v2.21.0(Dec 13, 2022)

  • v2.20.2(Dec 6, 2022)

    What's Changed

    • Fixed issue with double headers by @Skullbock in https://github.com/mollie/laravel-mollie/pull/213

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.20.1...v2.20.2

    Source code(tar.gz)
    Source code(zip)
  • v2.20.1(Dec 5, 2022)

    What's Changed

    • Temporarily revert Laravel http client resolution by @sandervanhooft in https://github.com/mollie/laravel-mollie/pull/214

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.20.0...v2.20.1

    Source code(tar.gz)
    Source code(zip)
  • v2.20.0(Dec 5, 2022)

    :clap: Special thanks to @Skullbock for refactoring to the Laravel Http adapter!

    What's Changed

    • Http client adapter by @Skullbock in https://github.com/mollie/laravel-mollie/pull/202
    • Update tests.yml by @ciungulete in https://github.com/mollie/laravel-mollie/pull/205
    • Move "symfony/finder": "^5.0|^6.0" to require-dev by @ciungulete in https://github.com/mollie/laravel-mollie/pull/207
    • Added missing endpoints related to Payments, Orders and Shipments by @wesselperik in https://github.com/mollie/laravel-mollie/pull/209
    • Remove misplaced space character in composer.json by @jnoordsij in https://github.com/mollie/laravel-mollie/pull/208

    New Contributors

    • @Skullbock made their first contribution in https://github.com/mollie/laravel-mollie/pull/202
    • @wesselperik made their first contribution in https://github.com/mollie/laravel-mollie/pull/209
    • @jnoordsij made their first contribution in https://github.com/mollie/laravel-mollie/pull/208

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.19.2...v2.20.0

    Source code(tar.gz)
    Source code(zip)
  • v2.19.2(Sep 13, 2022)

    What's Changed

    • Allow empty mollie key by @sandervanhooft in https://github.com/mollie/laravel-mollie/pull/200
    • Fix tests and replace php-cs-fixer with Laravel Pint by @ciungulete in https://github.com/mollie/laravel-mollie/pull/199

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.19.1...v2.19.2

    Source code(tar.gz)
    Source code(zip)
  • v2.19.1(Jul 11, 2022)

    What's Changed

    • Add docblock to mollie() helper method by @MSnoeren in https://github.com/mollie/laravel-mollie/pull/195
    • Update readme for easier copy of code snippets by @robindirksen1 in https://github.com/mollie/laravel-mollie/pull/193

    New Contributors

    • @MSnoeren made their first contribution in https://github.com/mollie/laravel-mollie/pull/195

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.19.0...v2.19.1

    Source code(tar.gz)
    Source code(zip)
  • v2.19.0(Feb 17, 2022)

    What's Changed

    • Added enable- and disable debugging mode API client by @edwinvdpol in https://github.com/mollie/laravel-mollie/pull/186

    New Contributors

    • @edwinvdpol made their first contribution in https://github.com/mollie/laravel-mollie/pull/186

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.18.0...v2.19.0

    Source code(tar.gz)
    Source code(zip)
  • v2.18.0(Jan 31, 2022)

    What's Changed

    • Added support for Laravel 9 by @ciungulete in https://github.com/mollie/laravel-mollie/pull/183

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.17.0...v2.18.0

    Source code(tar.gz)
    Source code(zip)
  • v2.17.0(Jan 18, 2022)

    What's Changed

    • Added Client and Partner endpoints by @ag84ark in https://github.com/mollie/laravel-mollie/pull/182

    New Contributors

    • @ag84ark made their first contribution in https://github.com/mollie/laravel-mollie/pull/182

    Full Changelog: https://github.com/mollie/laravel-mollie/compare/v2.16.0...v2.17.0

    Source code(tar.gz)
    Source code(zip)
  • v2.16.0(Nov 2, 2021)

  • v2.15.0(Jun 28, 2021)

    πŸš€ Mollie introduces Payment Links.

    A payment link by default does not expire and can be easily shared with your customers. More information here.

    • Added the mollie()->paymentLinks() endpoint (thanks @ciungulete!)
    Source code(tar.gz)
    Source code(zip)
  • v2.14.0(Jan 19, 2021)

  • v2.13.0(Dec 3, 2020)

    • Added support for php 8 (Thanks @ciungulete !)
    • Added paymentRefunds endpoint, for directly accessing refunds.
    • Switched CI to GitHub Actions (Thanks @ciungulete !)
    Source code(tar.gz)
    Source code(zip)
  • v2.12.0(Nov 30, 2020)

  • v2.11.0(Sep 8, 2020)

  • v2.10.0(May 18, 2020)

  • v2.9.0(Mar 5, 2020)

  • v2.8.0(Sep 20, 2019)

    Adding support for Mollie's wallet endpoint.

    Using the wallet endpoint your customer can pay using Apple Pay directly, without going through Mollie's checkout.

    More info here.

    Source code(tar.gz)
    Source code(zip)
  • v2.7.1(Sep 16, 2019)

  • v2.7.0(Sep 4, 2019)

  • v2.6.0(Apr 24, 2019)

    Added support for the new Onboarding Endpoint, which you can use to check the Onboarding status of the authenticated organization.

    Learn more about the Onboarding Endpoint here.

    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Mar 3, 2019)

    If you're integrating this package within another package, this one is for you.

    Added a method to record the User Agent (UA) string when calling the Mollie API:

    mollie()->addVersionString('YourPackage/1.2.1').

    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Dec 3, 2018)

  • v2.4.0(Nov 22, 2018)

  • v2.3.1(Nov 10, 2018)

  • v2.3.0(Oct 4, 2018)

    You can now process your Orders, Shipments and Captures using the latest Laravel Mollie client.

    Orders allow you to use Mollie for your order management and the cool new "Pay after delivery" payment methods.

    See Mollie's Order guides for more information about these brand new features.

    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Sep 18, 2018)

  • v2.1.0(Jul 30, 2018)

  • v2.0.0(Jul 9, 2018)

Owner
Mollie
Making payments better.
Mollie
Official Mollie integration for Laravel Cashier

Subscription billing with Laravel Cashier for Mollie Laravel Cashier provides an expressive, fluent interface to subscriptions using Mollie's billing

Mollie 80 Dec 31, 2022
A OpenID connect client for Laravel framework.

Introduction A OpenID connect client for Laravel framework. Install composer require package/oidc:^1.0 Configuration php artisan vendor:publish --tag=

Betterde 2 Sep 17, 2022
A simple Socialite implementation for Laravel Jetstream.

Introduction Socialstream is a third-party package for Laravel Jetstream. It replaces the published authentication and profile scaffolding provided by

Joel Butcher 334 Jan 2, 2023
Social login for Filament through Laravel Socialite

Social login for Filament through Laravel Socialite Add OAuth login through Laravel Socialite to Filament. Installation You can install the package vi

Dutch Coding Company 44 Dec 26, 2022
A simple Laravel service provider for easily using HTMLPurifier inside Laravel

HTMLPurifier for Laravel 5/6/7/8 A simple Laravel service provider for easily using HTMLPurifier inside Laravel. From their website: HTML Purifier is

MeWebStudio - Muharrem ERΔ°N 1.7k Jan 6, 2023
A laravel service provider for the netsuite-php library service

netsuite-laravel A PHP supplemental package to the ryanwinchester/netsuite-php package to add the NetSuite service client to the service container of

NetsuitePHP 6 Nov 9, 2022
Laravel Lumen service provider for Understand.io

The service provider is deprecated - it does not support error grouping. Laravel Lumen service provider for Understand.io You may also be interested i

null 6 May 30, 2019
Driver for managing cash payments in the Cashier Provider ecosystem

Cash Driver Provider Installation To get the latest version of Cash Driver Provider, simply require the project using Composer: $ composer require cas

Cashier Provider 4 Aug 30, 2022
UnifiedPush provider for Nextcloud - server application

NextPush - Server App UnifiedPush provider for Nextcloud - server application This is still a WIP version Requirement It require the nextcloud server

NextPush 38 Jan 5, 2023
Laravel wrapper package for the Aimon.it API

Laravel Aimon Package A laravel wrapper package for the Aimon.it API. For more information see Aimon Requirements Laravel 6 or later Installation Inst

Ruslan 3 Aug 7, 2022
Laravel API wrapper to interact fluently with your Janus Media Server

Laravel API wrapper to interact fluently with your Janus Media Server. Core server interactions, as well as the video room plugin included.

Richard  Tippin 11 Aug 21, 2022
Open Food Facts API wrapper for Laravel

Laravel Open Food Facts API This package provides a convenient wrapper to the Open Food Facts API for Laravel applications (5.7+). Installation You ca

Open Food Facts 112 Jan 4, 2023
a Google API v3 wrapper for Laravel 4.x

A Google API v3 wrapper for Laravel 4 This package enables a Laravel flavoured way to manage Google services through its API interface (v3) Installati

null 4 Nov 29, 2022
Laravel wrapper for Sentry Official API

Laravel Sentry API Provides a simple laravel wrapper to some of the endpoints listed on (Official Sentry API)[https://docs.sentry.io/api/]. **Note: Th

Pedro Santiago 1 Nov 1, 2021
Laravel wrapper for the Gmail API

Laravel Gmail Gmail Gmail API for Laravel 8 You need to create an application in the Google Console. Guidance here. if you need Laravel 5 compatibilit

Daniel Castro 244 Jan 3, 2023
Simple and ready to use API response wrapper for Laravel.

Laravel API Response Simple Laravel API response wrapper. Installation Install the package through composer: $ composer require obiefy/api-response Re

Obay Hamed 155 Dec 14, 2022
A simple API wrapper to Gigapay's APIs for Laravel Framework

Laravel-Gigapay A simple API wrapper for Gigapay's APIs. It gives you helper methods that will make your work with gigapay's API easy, fast and effici

Asif Patel 3 May 23, 2022
PHP API for GeoIP2 webservice client and database reader

GeoIP2 PHP API Description This package provides an API for the GeoIP2 and GeoLite2 web services and databases. Install via Composer We recommend inst

MaxMind 2.1k Jan 6, 2023
PHP API for GeoIP2 webservice client and database reader

GeoIP2 PHP API Description This package provides an API for the GeoIP2 and GeoLite2 web services and databases. Install via Composer We recommend inst

MaxMind 2.1k Jan 1, 2023