Package Data | |
---|---|
Maintainer Username: | petericebear |
Maintainer Contact: | psteenbergen@gmail.com (Peter Steenbergen) |
Package Create Date: | 2016-03-10 |
Package Last Update: | 2019-09-06 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:17:32 |
Package Statistics | |
---|---|
Total Downloads: | 1,883 |
Monthly Downloads: | 5 |
Daily Downloads: | 3 |
Total Stars: | 12 |
Total Watchers: | 3 |
Total Forks: | 2 |
Total Open Issues: | 0 |
This is a package to integrate Mollie with Laravel 5.x. You can use it to easily manage your configuration, and use the Facade to provide shortcuts to the Mollie Client.
To use the Mollie API client, the following things are required:
Via Composer
$ composer require petericebear/laravel-mollie
After updating composer, add the MollieServiceProvider to the providers array in config/app.php
PeterIcebear\Mollie\Providers\MollieServiceProvider::class,
You need to publish the config for this package. A sample configuration is provided. The defaults will be merged with gateway specific configuration.
$ php artisan vendor:publish --provider="PeterIcebear\Mollie\Providers\MollieServiceProvider"
To use the Facade (\Mollie::getMethods()
instead of App::make('mollie')->getMethods()
), add that to the facades array.
'Mollie' => PeterIcebear\Mollie\Facades\Mollie::class,
Creating a new payment.
$payment = Mollie::getPayments()->create([
"amount" => 10.00,
"description" => "My first API payment",
"redirectUrl" => "https://webshop.example.org/order/12345/",
]);
After creation, the payment id is available in the $payment->id
property. You should store this id with your order.
Retrieving a payment.
$payment = Mollie::getPayments()->get($payment->id);
if ($payment->isPaid())
{
echo "Payment received.";
}
If you want to fully integrate iDEAL payments in your web site, some additional steps are required. First, you need to retrieve the list of issuers (banks) that support iDEAL and have your customer pick the issuer he/she wants to use for the payment.
Retrieve the list of issuers:
$issuers = Mollie::getIssuers()->all();
_$issuers
will be a list of Mollie_API_Object_Issuer
objects. Use the property $id
of this object in the
API call, and the property $name
for displaying the issuer to your customer.
Create a payment with the selected issuer:
$payment = Mollie::getPayments()->create(array(
"amount" => 10.00,
"description" => "My first API payment",
"redirectUrl" => "https://webshop.example.org/order/12345/",
"method" => Mollie_API_Object_Method::IDEAL,
"issuer" => $selected_issuer_id, // e.g. "ideal_INGBNL2A"
));
The links
property of the $payment
object will contain a string paymentUrl
, which is a URL that points directly to the online banking environment of the selected issuer.
The API also supports refunding payments. Note that there is no confirmation and that all refunds are immediate and definitive. Refunds are only supported for iDEAL, credit card, Bancontact/Mister Cash, SOFORT Banking and bank transfer payments. Other types of payments cannot be refunded through our API at the moment.
$payment = Mollie::getPayments()->get($payment->id);
// Refund € 15 of this payment
$refund = Mollie::getPayments()->refund($payment, 15.00);
Please use the official documentation of Mollie of one off the following resources: