PHPackages                             boreistudio/filament-mercado-pago - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. boreistudio/filament-mercado-pago

ActiveLibrary[Payment Processing](/categories/payments)

boreistudio/filament-mercado-pago
=================================

Seamless Mercado Pago integration

1.0.1(10mo ago)215MITPHP

Since Jun 27Pushed 6mo agoCompare

[ Source](https://github.com/BoreiStudio/Filament-MercadoPago)[ Packagist](https://packagist.org/packages/boreistudio/filament-mercado-pago)[ RSS](/packages/boreistudio-filament-mercado-pago/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Filament Mercado Pago Package
=============================

[](#filament-mercado-pago-package)

This package provides a seamless integration of Mercado Pago payments within your Filament PHP application, allowing you to connect Mercado Pago accounts and manage their credentials securely.

1. Introduction
---------------

[](#1-introduction)

The `FilamentMercadoPago` package simplifies the process of integrating Mercado Pago into your Filament projects. It handles the OAuth connection flow, securely stores Mercado Pago credentials (Access Token, Public Key, Refresh Token), and provides a convenient service to access these credentials throughout your application.

2. Installation
---------------

[](#2-installation)

To get started with the Filament Mercado Pago package, follow these steps:

### 2.1 Install the Package

[](#21-install-the-package)

Install the package via Composer:

```
composer require boreistudio/filament-mercado-pago
```

### 2.2 Publish Assets (Configuration and Migrations)

[](#22-publish-assets-configuration-and-migrations)

After installing the package, you need to publish its assets. You have two options:

#### Option 1: Use the Installation Command (Recommended)

[](#option-1-use-the-installation-command-recommended)

This command will publish both the configuration file and the necessary database migrations:

```
php artisan filament-mercado-pago:install
```

#### Option 2: Publish Manually

[](#option-2-publish-manually)

Alternatively, you can publish the assets individually:

To publish the migrations:

```
php artisan vendor:publish --tag="filament-mercado-pago-migrations"
```

To publish the configuration file (optional, if you need to customize settings):

```
php artisan vendor:publish --tag="filament-mercado-pago-config"
```

After publishing the assets (using either option), remember to execute your database migrations:

```
php artisan migrate
```

**Note on Column Length:** If you encounter a `SQLSTATE[22001]: String data, right truncated` error after migration, it means the encrypted tokens are too long for the default column sizes. You might need to manually adjust the `access_token` and `public_key` columns to `TEXT` type in your migration or modify the existing `mercado_pago_accounts` table migration.

3. Configuration
----------------

[](#3-configuration)

After publishing the configuration, you'll find `config/filament-mercado-pago.php`. Update the following values with your Mercado Pago application credentials:

```
// config/filament-mercado-pago.php
return [
    'client_id' => env('MERCADO_PAGO_CLIENT_ID'),
    'client_secret' => env('MERCADO_PAGO_CLIENT_SECRET'),
    'redirect_uri' => env('MERCADO_PAGO_REDIRECT_URI', 'http://localhost/mercadopago/callback'),
];
```

Ensure you have these environment variables set in your `.env` file:

```
MERCADO_PAGO_CLIENT_ID=your_client_id
MERCADO_PAGO_CLIENT_SECRET=your_client_secret
MERCADO_PAGO_REDIRECT_URI=https://your-domain.com/mercadopago/callback
```

The `redirect_uri` should match the one configured in your Mercado Pago application.

4. Usage
--------

[](#4-usage)

### 4.1 Connecting Mercado Pago Account

[](#41-connecting-mercado-pago-account)

The package provides a `ConnectController` to handle the OAuth redirection and callback from Mercado Pago.

**Redirection to Mercado Pago:**

```
// packages/BoreiStudio/FilamentMercadoPago/src/Http/Controllers/ConnectController.php
public function redirect()
{
    // ...
}
```

This method constructs the authorization URL and redirects the user to Mercado Pago for authentication.

**Handling the Callback:**

```
// packages/BoreiStudio/FilamentMercadoPago/src/Http/Controllers/ConnectController.php
public function callback(Request $request)
{
    // ...
}
```

This method processes the callback from Mercado Pago, exchanges the authorization code for access and refresh tokens, encrypts them, and saves them to the `mercado_pago_accounts` table.

### 4.2 Accessing Credentials Globally

[](#42-accessing-credentials-globally)

The package provides a `MercadoPagoService` to conveniently access and decrypt the stored Mercado Pago credentials.

**Registering the Service:**The `FilamentMercadoPagoServiceProvider` automatically registers the `MercadoPagoService` as a singleton in Laravel's service container.

```
// packages/BoreiStudio/FilamentMercadoPago/src/FilamentMercadoPagoServiceProvider.php
namespace BoreiStudio\FilamentMercadoPago;

use Illuminate\Support\ServiceProvider;
use BoreiStudio\FilamentMercadoPago\Services\MercadoPagoService;

class FilamentMercadoPagoServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->singleton(MercadoPagoService::class, function ($app) {
            return new MercadoPagoService();
        });
    }

    public function boot()
    {
        //
    }
}
```

**Using the Service:**

You can inject the `MercadoPagoService` into your controllers, services, or any other class:

```
// Example: In a controller
use BoreiStudio\FilamentMercadoPago\Services\MercadoPagoService;

class YourController extends Controller
{
    protected $mercadoPagoService;

    public function __construct(MercadoPagoService $mercadoPagoService)
    {
        $this->mercadoPagoService = $mercadoPagoService;
    }

    public function someMethod()
    {
        $accessToken = $this->mercadoPagoService->getAccessToken();
        $publicKey = $this->mercadoPagoService->getPublicKey();
        $refreshToken = $this->mercadoPagoService->getRefreshToken();
        $allCredentials = $this->mercadoPagoService->getCredentials();

        // Use the credentials here (e.g., make API calls to Mercado Pago)
        // ...
    }
}
```

Alternatively, you can resolve it from the container using the `app()` helper:

```
use BoreiStudio\FilamentMercadoPago\Services\MercadoPagoService;

$mercadoPagoService = app(MercadoPagoService::class);
$accessToken = $mercadoPagoService->getAccessToken();
```

The methods `getAccessToken()`, `getPublicKey()`, `getRefreshToken()`, and `getCredentials()` will automatically decrypt the stored values. You can also pass a `user_id` to these methods if you need to retrieve credentials for a specific user other than the currently authenticated one.

5. Security Notes
-----------------

[](#5-security-notes)

- **Encryption:** `access_token` and `public_key` are encrypted before being stored in the database.
- **Access Token:** The `access_token` is a sensitive private key and should only be used on your backend. Never expose it in your frontend.
- **Public Key:** While `public_key` is designed for frontend use (e.g., for card data encryption), it is still stored encrypted for consistency and added security.
- **PKCE:** The integration uses PKCE (Proof Key for Code Exchange) for enhanced security during the OAuth flow.

---

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance61

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

320d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f4a3f555e28dae7c21b26d5847345e994210c8b6bf86a10c0e933b62d17e262?d=identicon)[MrMardel](/maintainers/MrMardel)

---

Top Contributors

[![MrMardel](https://avatars.githubusercontent.com/u/25154756?v=4)](https://github.com/MrMardel "MrMardel (1 commits)")

### Embed Badge

![Health badge](/badges/boreistudio-filament-mercado-pago/health.svg)

```
[![Health](https://phpackages.com/badges/boreistudio-filament-mercado-pago/health.svg)](https://phpackages.com/packages/boreistudio-filament-mercado-pago)
```

###  Alternatives

[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
