omnipay/mollie
Composer 安装命令:
composer require omnipay/mollie
包简介
Mollie driver for the Omnipay payment processing library
README 文档
README
Mollie driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Mollie support for Omnipay.
Installation
Omnipay is installed via Composer. To install, simply require league/omnipay and omnipay/mollie with Composer:
composer require league/omnipay omnipay/mollie
Basic Usage
The following gateways are provided by this package:
- Mollie
For general usage instructions, please see the main Omnipay repository.
Basic purchase example
$gateway = \Omnipay\Omnipay::create('Mollie'); $gateway->setApiKey('test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'); $response = $gateway->purchase( [ "amount" => "10.00", "currency" => "EUR", "description" => "My first Payment", "returnUrl" => "https://webshop.example.org/mollie-return.php" ] )->send(); // Process response if ($response->isSuccessful()) { // Payment was successful print_r($response); } elseif ($response->isRedirect()) { // Redirect to offsite payment gateway $response->redirect(); } else { // Payment failed echo $response->getMessage(); }
Example using the Order API
- Create the order and pass the order items in the parameters.
$response = $gateway->createOrder( [ 'amount' => '1027.99', 'currency' => 'EUR', 'orderNumber' => '1337', 'lines' => [ [ 'type' => 'physical', 'sku' => '5702016116977', 'name' => 'LEGO 42083 Bugatti Chiron', 'productUrl' => 'https://shop.lego.com/nl-NL/Bugatti-Chiron-42083', 'imageUrl' => 'https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$', 'quantity' => 2, 'vatRate' => '21.00', 'unitPrice' => '399.00', 'totalAmount' => '698.00', 'discountAmount' => '100.00', 'vatAmount' => '121.14', ], [ 'type' => 'physical', 'sku' => '5702015594028', 'name' => 'LEGO 42056 Porsche 911 GT3 RS', 'productUrl' => 'https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056', 'imageUrl' => 'https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$', 'quantity' => 1, 'vatRate' => '21.00', 'unitPrice' => '329.99', 'totalAmount' => '329.99', 'vatAmount' => '57.27', ] ], 'card' => [ 'company' => 'Mollie B.V.', 'email' => 'norris@chucknorrisfacts.net', 'birthday' => '1958-01-31', 'billingTitle' => 'Dhr', 'billingFirstName' => 'Piet', 'billingLastName' => 'Mondriaan', 'billingAddress1' => 'Keizersgracht 313', 'billingCity' => 'Amsterdam', 'billingPostcode' => '1234AB', 'billingState' => 'Noord-Holland', 'billingCountry' => 'NL', 'billingPhone' => '+31208202070', 'shippingTitle' => 'Mr', 'shippingFirstName' => 'Chuck', 'shippingLastName' => 'Norris', 'shippingAddress1' => 'Prinsengracht 313', 'shippingAddress2' => '4th floor', 'shippingCity' => 'Haarlem', 'shippingPostcode' => '5678AB', 'shippingState' => 'Noord-Holland', 'shippingCountry' => 'NL', ], 'metadata' => [ 'order_id' => '1337', 'description' => 'Lego cars', ], 'locale' => 'nl_NL', 'returnUrl' => 'https://example.org/redirect', 'notifyUrl' => 'https://example.org/webhook', 'paymentMethod' => 'klarnapaylater', 'billingEmail' => 'piet@mondriaan.com', ] )->send(); // Process response if ($response->isSuccessful()) { // Payment was successful print_r($response); } elseif ($response->isRedirect()) { // Redirect to offsite payment gateway $response->redirect(); } else { // Payment failed echo $response->getMessage(); }
- On return/notify, complete the order. This will not always be completed, because for Klarna the shipments needs to be created first.
$response = $gateway->completeOrder( [ "transactionReference" => "ord_xxxx", ] )->send();
- When shipping the items, create the shipment for this order. You can leave the
itemsemtpy to ship all items.
$response = $gateway->createShipment( [ "transactionReference" => "ord_xxx", 'items' => [ [ 'id' => 'odl_xxx', 'quantity' => 1, ] ] ] )->send();
- As long as the order is
created,authorizedorshipping, it may be cancelled (voided)
$response = $gateway->void(["transactionReference" => "ord_xxx"])->send();
Support
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
omnipay/mollie 适用场景与选型建议
omnipay/mollie 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.84M 次下载、GitHub Stars 达 63, 最近一次更新时间为 2013 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「pay」 「gateway」 「mollie」 「merchant」 「omnipay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 omnipay/mollie 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 omnipay/mollie 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 omnipay/mollie 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
Библиотека для приема платежей через Альфабанк.
Some pre-defined rules for validation in Omnipay payment processing library.
BluePay gateway for the Omnipay payment processing library
支付宝接口扩展包
统计信息
- 总下载量: 1.84M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 63
- 点击次数: 29
- 依赖项目数: 10
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-11-16