1. Go to this page and download the library: Download flowcoders/maestro library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
flowcoders / maestro example snippets
// This same code works with MercadoPago, Stripe, or any other provider
$money = new Money(10000, Currency::BRL); // R$ 100.00 in cents
$pix = new Pix(expiresAt: 60); // 1 hour expiration
$payment = Maestro::createPayment(new PaymentRequest(
money: $money,
paymentMethod: $pix,
description: 'Product purchase',
customer: new Customer(/* ... */),
));
use Flowcoders\Maestro\Facades\Maestro;
use Flowcoders\Maestro\ValueObjects\Money;
use Flowcoders\Maestro\ValueObjects\PaymentMethod\Pix;
$payment = Maestro::createPayment(/* ... */);
use Flowcoders\Maestro\Facades\Maestro;
use Flowcoders\Maestro\DTOs\PaymentRequest;
use Flowcoders\Maestro\DTOs\Customer;
use Flowcoders\Maestro\ValueObjects\Money;
use Flowcoders\Maestro\ValueObjects\Email;
use Flowcoders\Maestro\ValueObjects\PaymentMethod\Pix;
use Flowcoders\Maestro\Enums\Currency;
// Create payment components
$money = new Money(10000, Currency::BRL); // R$ 100.00 in cents
$pix = new Pix(expiresAt: 60); // Expires in 1 hour
$customer = new Customer(
firstName: 'John',
lastName: 'Doe',
email: new Email('[email protected]')
);
// Create the payment
$payment = Maestro::createPayment(new PaymentRequest(
money: $money,
paymentMethod: $pix,
description: 'Product purchase',
customer: $customer
));
// Get payment details
echo $payment->id; // Payment ID from provider
echo $payment->status->value; // 'pending', 'approved', etc.
// Create payment
$payment = Maestro::createPayment($paymentRequest);
// Get payment status
$payment = Maestro::getPayment('payment_id');
// Cancel payment
$payment = Maestro::cancelPayment('payment_id');
// Refund payment (full or partial)
$refundMoney = new Money(5000, Currency::BRL); // Partial refund
$payment = Maestro::refundPayment(new RefundRequest(
paymentId: 'payment_id',
money: $refundMoney, // Optional: leave null for full refund
reason: 'Customer request'
));
// ✅ Correct
$money = new Money(10000, Currency::BRL); // R$ 100.00
// ❌ Wrong
amount: 100.00 // This field doesn't exist
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.