bvharen / mollie-laravel-7-plus-clone
Mollie API客户端包装器,用于Laravel和Mollie Connect提供者,适用于Laravel Socialite
Requires
- php: ^7.1.3|^7.2
- ext-json: *
- illuminate/support: ^5.8.0|^6.0|^7.0
- mollie/mollie-api-php: ^2.11
Requires (Dev)
- graham-campbell/testbench: ^5.0|^6.0
- laravel/socialite: ^3.0|^4.0
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.5|^8.0
Suggests
- laravel/socialite: Use Mollie Connect (OAuth) to authenticate via Laravel Socialite with the Mollie API. This is needed for some endpoints.
README
Laravel的Mollie
Laravel-Mollie将Mollie API和Mollie Connect整合到您的Laravel或Lumen项目中。
接受iDEAL、Apple Pay、Bancontact/Mister Cash、SOFORT Banking、信用卡、SEPA银行转账、SEPA直接借记、PayPal、Belfius Direct Net、KBC/CBC、paysafecard、ING Home'Pay、礼品卡、Giropay、EPS和Przelewy24在线支付,无需固定月费或任何惩罚性注册程序。只需使用Mollie API即可直接在您的网站上接收支付,或轻松退还客户的交易。
寻找完整的周期性收费解决方案?请查看laravel/cashier-mollie。
要求
- 注册一个免费的Mollie账户。无需注册费用。
- 现在您可以使用Mollie API客户端进行测试模式。
- 按照几个步骤启用实时模式下的支付方式,其余的由我们处理。
- 最新的OpenSSL(或其他SSL/TLS工具包)
- PHP >= 7.0
- Laravel(或Lumen)>= 5.5
- Laravel Socialite>= 3.0(如果您打算使用Mollie Connect)
从v1.x升级?
为了支持增强的Mollie API,引入了一些破坏性变更。请确保按照包迁移指南中的说明操作。
尚未准备好升级?Laravel-Mollie客户端v1将保持支持。
全新安装?请按照下面的安装指南继续。
安装
使用composer require
命令将Laravel-Mollie添加到您的composer文件中
$ composer require mollie/laravel-mollie:^2.0
或手动将其添加到composer.json
"require": { "mollie/laravel-mollie": "^2.0" }
Laravel-Mollie的服务提供程序将使用Laravel的自动发现功能自动注册。
注意:对于Lumen,您需要手动将Mollie门面和服务提供者添加到:bootstrap/app.php
$app->withFacades(true, ['Mollie\Laravel\Facades\Mollie' => 'Mollie']); $app->register(Mollie\Laravel\MollieServiceProvider::class);
配置
您只需将MOLLIE_KEY
变量添加到您的.env
文件中。
MOLLIE_KEY=test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
示例用法
在这里,您可以看到一个示例,说明这个包有多么简单易用。
使用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", ], ]); $payment = Mollie::api()->payments->get($payment->id); // 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. * (See the webhook docs for more information.) */ if ($payment->isPaid()) { echo 'Payment received.'; // Do your thing ... }
全局辅助方法
为了方便您使用,我们添加了全局的mollie()
辅助函数。它是一个轻松访问Mollie::api()
门面访问器的快捷方式。
// Using facade accessor $payment = \Mollie\Laravel\Facades\Mollie::api()->payments->get($payment_id); // Using global helper function $payment = mollie()->payments->get($payment_id);
其他示例
路线图
您可以在这里找到该包的最新开发路线图。如果您有功能请求,请随时提交问题。
想要帮助我们使我们的Laravel模块更加完善吗?
想要帮助我们使我们的Laravel模块更加完善?我们当然接受拉取请求。但是,您想如何为一家技术导向的组织做出贡献呢?Mollie正在招聘开发人员和系统工程师。查看我们的职位空缺或联系我们。
许可
BSD (伯克利软件发行版) 许可证。版权(c)2016,Mollie B.V。
支持
联系方式:www.mollie.com — info@mollie.com — +31 20-612 88 55