amostajo/laravel-shop-gateway-omnipay
Composer 安装命令:
composer require amostajo/laravel-shop-gateway-omnipay
包简介
Omnipay gateway for Laravel Shop package.
关键字:
README 文档
README
Omnipay Gateway solution for Laravel Shop.
Enables multiple gateway payment, like PayPal, 2Checkout, Stripe and others. See the full list at Omnipay's page.
Gateways
This package comes with:
- Omnipay
Contents
Installation
Add
"amostajo/laravel-shop-gateway-omnipay": "1.0.*"
to your composer.json. Then run composer install or composer update.
Then in your config/shop.php add
'omnipay' => Amostajo\LaravelShopGatewayOmnipay\GatewayOmnipay::class,
in the gateways array.
Adding a service
Once installed, the next step will be to add the service of your choice in composer.json file.
The services available are listed here:
https://github.com/thephpleague/omnipay#payment-gateways
For example, the following dependency must be added to use Stripe:
"omnipay/stripe": "~2.0"
Gateway Usage
The following example will give you an idea of how use and access omnipay:
// (1) - Set gateway Shop::setGateway('omnipay'); // (2) - Indicate service to use Shop::gateway()->create('PayPal_Rest'); // (3) - Initialize your service (varies from service) Shop::gateway()->omnipay->initialize([ 'clientId' => '...', 'secret' => '...', 'testMode' => true, ]); // (4) - Add credit card for validation (optional depending service) Shop::gateway()->setCreditCard([ 'number' => '4111111111111111', 'expiryMonth' => '1', 'expiryYear' => '2019', 'cvv' => '123', 'firstName' => 'John', 'lastName' => 'Doe', 'billingAddress1' => '666 grand canyon', 'billingCountry' => 'US', 'billingCity' => 'TX', 'billingPostcode' => '12345', 'billingState' => 'TX', ]); // (5) - Call checkout if (!Shop::checkout()) { echo Shop::exception()->getMessage(); // echos: card validation error. } // (6) - Create order $order = Shop::placeOrder(); // (7) - Review payment if ($order->hasFailed) { echo Shop::exception()->getMessage(); // echos: payment error. }
The lines may vary depending on the service chosen.
NOTE: Checkout and placing order shouldn't vary from standard Laravel Shop flow.
Accessing Omnipay
You can always access the omnipay object if you need to set or call any specific method required by a service:
// (1) - Set gateway Shop::setGateway('omnipay'); Shop::gateway()->create('Stripe'); // (2) - Setting method / calling specific method Shop::gateway()->omnipay->setSpecific();
Adding Options
You can add more options, apart from amount, currency and card, to the authorization and purchase methods:
// (1) - Set gateway Shop::setGateway('omnipay'); Shop::gateway()->create('Stripe'); // (2) - Adding an option Shop::gateway()->addOption('token', $stripetoken); // (3) - Any operation that follows Shop::checkout();
Callbacks
Use the following example when callbacks are needed:
// (1) - Set gateway Shop::setGateway('omnipay'); Shop::gateway()->create('PayPal_Express'); // (2) - Authentication Shop::gateway()->omnipay->setUsername('...'); Shop::gateway()->omnipay->setPassword('...'); // (2) - Call checkout / OPTIONAL Shop::checkout(); // (3) - Create order $order = Shop::placeOrder(); // (4) - Review order and redirect to payment if ($order->isPending) { // PayPal URL to redirect to proceed with payment $approvalUrl = Shop::gateway()->getApprovalUrl(); // Redirect to url return redirect($approvalUrl); } // (5) - Callback // You don't have to do anything. // Laravel Shop will handle the callback and redirect the customer to the configured route.
Tested Services
- PayPal
- Stripe
License
This package is free software distributed under the terms of the MIT license.
Additional Information
This package uses Omnipay.
amostajo/laravel-shop-gateway-omnipay 适用场景与选型建议
amostajo/laravel-shop-gateway-omnipay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.18k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 10 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「gateway」 「paypal」 「stripe」 「laravel」 「authorize.net」 「2checkout」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 amostajo/laravel-shop-gateway-omnipay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 amostajo/laravel-shop-gateway-omnipay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 amostajo/laravel-shop-gateway-omnipay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.
repository php library
Payyo Gateway for the Omnipay payment processing library
Flexible payment integration for Laravel, lunarphp, supporting multiple payment providers.
A PayPal IPN (Instant Payment Notification) listener for PHP
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
统计信息
- 总下载量: 1.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-10-13