artesaos/moip
最新稳定版本:v1.0.3
Composer 安装命令:
composer require artesaos/moip
包简介
Integration of MoIP payment intermediary with Laravel 5
README 文档
README
Current Status Package
Statistics
Version
Tips
License
Installation
Composer
Start by adding the package to require your composer.json
composer require artesaos/moip
Having loaded dependencies and installed on your project, we will add ServiceProvider and facade.
ServiceProvider
You need to update your application configuration in order to register the package so it can be loaded by Framework.
Laravel
Just update your config/app.php file adding the following code at the end of your 'providers' section:
'providers' => array( Illuminate\Foundation\Providers\ArtisanServiceProvider::class, Illuminate\Auth\AuthServiceProvider::class, ... Artesaos\Moip\Providers\MoipServiceProvider::class, ... ),
Lumen
Go to /bootstrap/app.php file and add this line:
// file START ommited $app->register(Artesaos\Moip\Providers\MoipServiceProvider::class); // file END ommited
Facade
Adding a new item on its facade
'aliases' => array( 'App' => Illuminate\Support\Facades\App::class, 'Artisan' => Illuminate\Support\Facades\Artisan::class, ... 'Moip' => Artesaos\Moip\Facades\Moip::class, ),
Settings
To move the MoIP settings file to the Settings folder of your application, simply perform the following command:
php artisan vendor:publish
or
php artisan vendor:publish --provider="Artesaos\Moip\Providers\MoipServiceProvider"
If you have already published the files, but for some reason need to override them, add the flag '--force' at the end of the previous command.
php artisan vendor:publish --provider="Artesaos\Moip\Providers\MoipServiceProvider" --force
His .env file, add the following values
MOIP_KEY=yourkeyfortheservice
MOIP_TOKEN=yourtokefortheservice
MOIP_HOMOLOGATED=keyshomologatedtrueorfalse
Using
$moip = Moip::start();
Creating a buyer
In this example we will create a request with customer data - With delivery and payment address.
try { $customer = $moip->customers()->setOwnId(uniqid()) ->setFullname('Fulano de Tal') ->setEmail('fulano@email.com') ->setBirthDate('1988-12-30') ->setTaxDocument('22222222222') ->setPhone(11, 66778899) ->addAddress('BILLING', 'Rua de teste', 123, 'Bairro', 'Sao Paulo', 'SP', '01234567', 8) ->addAddress('SHIPPING', 'Rua de teste do SHIPPING', 123, 'Bairro do SHIPPING', 'Sao Paulo', 'SP', '01234567', 8) ->create(); dd($customer); } catch (Exception $e) { dd($e->__toString()); }
Creating an application with the buyer we just created
In this example with various products and also specifying freight value, additional value and further discount amount.
try { $order = $moip->orders()->setOwnId(uniqid()) ->addItem("bicicleta 1",1, "sku1", 10000) ->addItem("bicicleta 2",1, "sku2", 11000) ->addItem("bicicleta 3",1, "sku3", 12000) ->addItem("bicicleta 4",1, "sku4", 13000) ->addItem("bicicleta 5",1, "sku5", 14000) ->addItem("bicicleta 6",1, "sku6", 15000) ->addItem("bicicleta 7",1, "sku7", 16000) ->addItem("bicicleta 8",1, "sku8", 17000) ->addItem("bicicleta 9",1, "sku9", 18000) ->addItem("bicicleta 10",1, "sku10", 19000) ->setShippingAmount(3000)->setAddition(1000)->setDiscount(5000) ->setCustomer($customer) ->create(); dd($order); } catch (Exception $e) { dd($e->__toString()); }
Creating payment
After creating the application simply create a payment request. In this example we are paying by credit card.
try { $payment = $order->payments()->setCreditCard(12, 21, '4073020000000002', '123', $customer) ->execute(); dd($payment); } catch (Exception $e) { dd($e->__toString()); }
Package for MoIP API v1 - Laravel 4
To use the package with Laravel 4 clique aqui, This package is integrated only with the V1 API MoIP
Documentation
License
artesaos/moip 适用场景与选型建议
artesaos/moip 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.18k 次下载、GitHub Stars 达 38, 最近一次更新时间为 2015 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payment」 「checkout」 「gateway」 「laravel」 「moip」 「intermediary」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 artesaos/moip 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 artesaos/moip 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 artesaos/moip 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Payyo Gateway for the Omnipay payment processing library
Adds a 'checkout' to a SilverStripe site which links to an Estimate and adds the ability to setup and pay
Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
Client library to send SMS using Comilio SMS Gateway API (https://www.comilio.it)
Add a simple webshop to your Laravel project
统计信息
- 总下载量: 11.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 38
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-14