Moip
Pagamentos Moip
Install / Use
/learn @artesaos/MoipREADME
Package for API v2 MoIP
Current Status Package
Statistics
Version
Tips
<a href="http://zenhub.io" target="_blank"><img src="https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png" height="18px" alt="Powered by ZenHub"/></a>
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
Related Skills
node-connect
351.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。


