paradox-nl/laravel-mollie

Laravel Wrapper for the Mollie API

0.1.2 2016-04-08 11:36 UTC

This package is not auto-updated.

Last update: 2025-01-10 20:22:08 UTC


README

This package allows you to use Mollie within Laravel 5.X.

Installation

To install this library use the following command

composer require paradox-nl/laravel-mollie

Next up register the ServiceProvider

\ParadoxNL\Mollie\MollieServiceProvider::class

And register the alias (optional)

'Mollie' => \ParadoxNL\Mollie\Facades\Mollie::class,

To publish the config:

php artisan vendor:publish

The config is now located in config/mollie.php. Here you can set an API key and the webhooks url

Original documentation

https://www.mollie.com/en/docs/overview

Methods

This package provides a couple methods straight out of the box, however if you wish to use the native methods you can use the getClient() and use the native Mollie API client.

Create payment

Method to create a new payment

Example:

Mollie::createPayment(
	time(),
	10.00,
	'Some description',
	Mollie_API_Object_Method::IDEAL,
	['issuer' => "ideal_INGNL2A"],
	['extra' => 'data']
);

Returns

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "id":              "tr_7UhSN1zuXS",
    "mode":            "test",
    "createdDatetime": "2014-06-05T08:29:39.0Z",
    "status":          "open",
    "expiryPeriod":    "PT15M",
    "amount":          10.00,
    "description":     "My first payment",
    "metadata": {
        "order_id": "12345"
    },
    "locale": "nl",
    "profileId": "pfl_QkEhN94Ba",
    "links": {
        "paymentUrl":  "https://www.mollie.com/payscreen/select-method/7UhSN1zuXS",
        "redirectUrl": "https://webshop.example.org/order/12345/"
    }
}

isPaid

Method to check whether an order is paid or not.

Mollie::isPaid(Illuminate\Http\Request $request)

Returns

boolean

isOpen

Method to check whether an order is open.

Mollie::isOpen(Illuminate\Http\Request $request)

Returns

boolean

History

Method to list all transactions with a pagination, configurable by config.

Mollie::history()

Returns

Array containing list of past transactions.

getClient

Returns the native Mollie API client

Mollie::getClient()->nativeMethod()

Returns

Mollie_API_Client