mollie / laravel-mollie
Mollie API客户端包装器,适用于Laravel,Mollie Connect提供程序适用于Laravel Socialite
Requires
- php: ^8.1|^8.2
- ext-json: *
- illuminate/support: ^10.0|^11.0
- mollie/mollie-api-php: ^2.60
Requires (Dev)
- laravel/pint: ^1.1
- laravel/socialite: ^5.5
- mockery/mockery: ^1.4
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
Suggests
- laravel/socialite: Use Mollie Connect (OAuth) to authenticate via Laravel Socialite with the Mollie API. This is needed for some endpoints.
- dev-master
- v3.0.0
- v2.25.0
- v2.24.0
- v2.24.0-beta
- v2.23.0
- v2.22.0
- v2.21.1
- v2.21.0
- v2.20.2
- v2.20.1
- v2.20.0
- v2.19.2
- v2.19.1
- v2.19.0
- v2.18.0
- v2.17.0
- v2.16.0
- v2.15.0
- v2.14.0
- v2.13.0
- v2.12.0
- v2.11.0
- v2.10.0
- v2.9.0
- v2.8.0
- v2.7.1
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.1
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v2.0.0-beta1
- v1.5.1
- v1.5.0
- v1.4.2
- v1.4.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- dev-provide-laravel-11-compatibiity
- dev-pr-237
- dev-add-create-client-endpoint
- dev-ZsoltMollie-patch-1
This package is auto-updated.
Last update: 2024-09-16 09:02:28 UTC
README
Laravel的Mollie
Laravel-Mollie将Mollie API和Mollie Connect集成到您的Laravel项目中。
支持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和Przelewy24在线支付,无需固定月费或任何惩罚性注册程序。只需使用Mollie API即可直接在您的网站上接收支付,或轻松退还客户的交易。
正在寻找完整的周期性账单解决方案?请查看Laravel Cashier for Mollie。
要求
- 注册一个免费的Mollie账户。无需注册费用。
- 现在您可以使用Mollie API客户端进行测试模式。
- 按照几个步骤启用实时模式下的支付方式,其余的交给我们处理。
- 更新的OpenSSL(或其他SSL/TLS工具包)
- PHP >= 8.1
- Laravel >= 10.0
- Laravel Socialite >= 5.0(如果您打算使用Mollie Connect)
从v2.x升级?
为了支持增强的Mollie API,引入了一些破坏性变更。请确保按照升级指南中的说明进行操作。
全新安装?请继续以下安装指南。
安装
使用composer require
命令将Laravel-Mollie添加到您的composer文件中
composer require mollie/laravel-mollie
或将它手动添加到composer.json
"require": { "mollie/laravel-mollie": "^3.0" }
Laravel-Mollie的服务提供程序将使用Laravel的自动发现功能自动注册。
配置
您只需将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", ], ]); // 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 ... } }
其他示例
- 使用 webhook 处理实时状态更新
- 周期性支付和直接扣款
- 使用 Laravel Socialite (OAuth) 配置 Mollie Connect (利用 Mollie 平台进行高级支付用例)
想帮助我们使我们的 Laravel 模块变得更好吗?
想帮助我们使我们的 Laravel 模块变得更好?当然,我们可以接受 pull requests。但您如何想为一个技术导向的组织做出贡献?Mollie 正在招聘开发人员和系统工程师。请查看我们的职位空缺或联系我们。
许可
MIT 许可证。版权所有 (c) 2024, Mollie B.V.