PHPackages                             crizprz/laravelmercadopago - 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. crizprz/laravelmercadopago

ActiveLibrary[Payment Processing](/categories/payments)

crizprz/laravelmercadopago
==========================

This package integrates Mercado Pago's Checkout Pro easily

v1.0.5(4y ago)225MITPHP

Since May 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/CRIZPRZ/Crizprz-MercadoPago-Larevel)[ Packagist](https://packagist.org/packages/crizprz/laravelmercadopago)[ RSS](/packages/crizprz-laravelmercadopago/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Checkout PRO for Laravel by CRIZPRZ
===================================

[](#checkout-pro-for-laravel-by-crizprz)

[![Laravel 5.x](https://camo.githubusercontent.com/5a1939c3fb1f6760124421638f59ab4ed15b6d03dbb30a6824df9af781880437/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e782d6f72616e67652e737667)](https://laravel.com/docs/5.8)[![Laravel 6.x](https://camo.githubusercontent.com/3a7d4d26bc9feba844a1e77c4c6b0d2587e13f9925f4a1bda796bd32f5c5b3d8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d362e782d626c75652e737667)](https://laravel.com/docs/6.x)[![Laravel 7.x](https://camo.githubusercontent.com/cb1a5f73220a771a314c8172f22a24beab337002200ad62c5b2d38e7d4d525c3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d372e782d7265642e737667)](https://laravel.com/docs/7.x)[![Laravel 8.x](https://camo.githubusercontent.com/ab3298aa7dabdd5c5225db3293c3e1940974373dfe1c60a3462ba53fc653edb8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d382e782d7265642e737667)](https://laravel.com)[![Latest Stable Version](https://camo.githubusercontent.com/97655839065ecada42d2b8dc69c4d8a921e2fef24ba6bccdedcfd9b62da225f2/68747470733a2f2f706f7365722e707567782e6f72672f6372697a70727a2f7077616372697a70727a2f762f737461626c65)](https://packagist.org/packages/crizprz/laravelmercadopago)[![Total Downloads](https://camo.githubusercontent.com/f58c05499df331276245444aa3f641a0f4f1f73f1748307c16d5db841296cd3f/68747470733a2f2f706f7365722e707567782e6f72672f6372697a70727a2f6c61726176656c6d65726361646f7061676f2f646f776e6c6f616473)](https://packagist.org/packages/crizprz/laravelmercadopago)[![License](https://camo.githubusercontent.com/031369c74cc5d103c875fd86d45a06c95caada867e358988c0622465b1aa45ba/68747470733a2f2f706f7365722e707567782e6f72672f636f6d706f7365722f636f6d706f7365722f6c6963656e7365)](//https://packagist.org/packages/crizprz/laravelmercadopago)

This package integrates Mercado Pago's [Checkout Pro](https://www.mercadopago.com.mx/developers/es/guides/online-payments/checkout-pro/introduction) very easily

REQUIREMENTS
============

[](#requirements)

Composer v.2 is recommended

guzzlehttp/guzzle

INSTALLATION
------------

[](#installation)

Install the package through [Composer](http://getcomposer.org/).

```
composer require crizprz/laravelmercadopago
```

Or add the following to your `composer.json` file :

```
"require": {
    "crizprz/laravelmercadopago": "^1.0",
},
```

CONFIGURATION
-------------

[](#configuration)

1. Open `config/app.php` and add this line to your Service Providers Array.

```
crizprz\laravelmercadopago\Providers\LaravelMercadoPagoProvider::class,
```

2. Open `config/app.php` and add this line to your aliases Array.

```
'MercadoPago' => crizprz\laravelmercadopago\Facades\MercadoPago::class,
```

3. publish the assets.

```
php artisan vendor:publish --provider="crizprz\laravelmercadopago\Providers\LaravelMercadoPagoProvider"
```

HOW TO USE
==========

[](#how-to-use)

Create User Test
----------------

[](#create-user-test)

1. To create users we must log in to [Mercado Pago developers](https://www.mercadopago.com.mx/developers/es/guides) with a real account
2. Go to the top right section, click and select [your integrations](https://www.mercadopago.com.mx/developers/panel)
3. once in your integrations click on test credentials, copy the Access Token and put it in the `.env` file in the variable called `ACCESS_TOKEN_MP =`
4. paste this code somewhere in your code either in a route or a running controller, this code will print two test users, the seller and the buyer

```
use crizprz\laravelmercadopago\Facades\MercadoPago;

MercadoPago::CreateUsersTest();

```

This will return an array with the two types of users, we must save these users very well since the paid market only allows creating 10 test users per account.

Note: Run only once.

example of what the previous code returns

```
 array:2 [▼
  0 => array:5 [▼
    "id" => 752892812
    "nickname" => "TESTE2VYDAPX"
    "email" => "test_user_84921269@testuser.com"
    "password" => "qatest3393"
    "type User" => "seller"
  ]
  1 => array:5 [▼
    "id" => 752890064
    "nickname" => "TETE9884170"
    "email" => "test_user_45814566@testuser.com"
    "password" => "qatest6713"
    "type User" => "payer"
  ]
]
```

create payment preference with test user
----------------------------------------

[](#create-payment-preference-with-test-user)

1. login with the test user in [Mercado Pago developers](https://www.mercadopago.com.mx/developers/es/guides)
2. Go to the top right section, click and select [your integrations](https://www.mercadopago.com.mx/developers/panel)
3. create new integration fill in the form and click on create application, click on production keys, copy the Access Token and put it in the `.env` file in the variable called `ACCESS_TOKEN_MP =`

Create Preference
-----------------

[](#create-preference)

1.paste the following code somewhere in your project where you want to implement the payment button

```
 use crizprz\laravelmercadopago\Facades\MercadoPago;

 $preference = MercadoPago::CreatePreference([
            'auto_return' => 'approved',
            'binary_mode' => true,
            'back_urls' => [
                "success" => route('mpsuccess'),
                "failure" => route('mpfailure'),
                "pending" => route('mppending')
            ],
            'notification_url' => route('webhook'),
            'items' => [
                'id' => '001',
                'title' => 'prod 1',
                'picture_url' => 'https://www.tusitio.com/images/products/prod1.jpg',
                'description' => 'this is descriptions',
                'category_id' => 'food',
                'quantity' => 1,
                'price' => 1000,
            ],
            'payment_methods' => [
                'excluded_payment_methods' => array(
                    array('id' => 'master'),
                    // array('id' => 'visa'),
                  ),
                  'excluded_payment_types' => array(
                    array('id' => 'ticket')
                  ),
                  'installments' => 12
                ],
                'payer' => [
                    'name' => 'Cristian',
                    'last_name' => 'Lira Perez',
                    'email' => 'al221711754@gmail.com',
                    'phone' => [
                        'area_code' => +52,
                        'number' => '7224738425'
                    ],
                    'address' => [
                        'zip_code' => 23492,
                        'street_name' => 'Calle cerrada de juerez',
                        'street_number' => '104'
                    ]
                ],
                'shipments' => [
                        'cost' => 100,
                ],
                'statement_descriptor' => 'Mi tienda online',

        ]);
```

2. visit the api reference, [Create a preference](https://www.mercadopago.com.mx/developers/es/reference/preferences/_checkout_preferences/post) to know what each of the properties of the array means
3. change the array values to those of your project

create payment button
---------------------

[](#create-payment-button)

1. return the variable `$preference` to some blade view, this variable has saved all the payment prefence For Example

```
return view('checkout',['preference' => $preference]);
```

2. in the view render the default button of the package

```
 {{ MercadoPago::ButtonPay($preference->init_point) }}
```

or create a custom payment button and pass it the init\_point, which is stored in the $ preference variable For Example

```
Pay Now
```

Test your integration
---------------------

[](#test-your-integration)

1. read the [Test your integration](https://www.mercadopago.com.mx/developers/es/guides/online-payments/checkout-pro/test-integration#bookmark_prueba_el_flujo_de_pago) documentation to get the test cards it provides

Payment status responses
------------------------

[](#payment-status-responses)

### payment success

[](#payment-success)

The code that is executed when returning to your website from a successful payment is in the `App\Http\Controllers\MercadoPagoController` controller in the success method

```
  public function success(Request $request)
   {
    // dd($request->all());
    if ($request->status === 'approved') {
        $response = Http::get("https://api.mercadopago.com/v1/payments/{$request->payment_id}", [
            'access_token' => env('ACCESS_TOKEN_MP'),
            ])->json();

        dd($response);
    }
   }
```

the payment returns a get request to your server so we will use the Request $request where all the payment data comes, what we are interested in is the payiment\_id

sample answer

```
 array:11 [▼
  "collection_id" => "14694550173"
  "collection_status" => "approved"
  "payment_id" => "14694550173"
  "status" => "approved"
  "external_reference" => "null"
  "payment_type" => "credit_card"
  "merchant_order_id" => "2621979593"
  "preference_id" => "752892812-d318bf82-4eea-4748-af60-cd4ade381491"
  "site_id" => "MLM"
  "processing_mode" => "aggregator"
  "merchant_account_id" => "null"
]
```

We are going to do a get request with guzzle / huzzlehttp to find the payment that was made and thus obtain the details, such as amount, type of currency, buyer data etc ...

```
 if ($request->status === 'approved') {
        $response = Http::get("https://api.mercadopago.com/v1/payments/{$request->payment_id}", [
            'access_token' => env('ACCESS_TOKEN_MP'),
            ])->json();

        dd($response);
    }
```

In the $ response variable we have all the data of the payment made successfully, with this information we can send emails, push notifications, show session messages in laravel, etc.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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 ~4 days

Total

6

Last Release

1815d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f285ce6738482a350d8d6c9699c0cac2bc20aeb600140905dbfc97045949248c?d=identicon)[CRIZPRZ](/maintainers/CRIZPRZ)

---

Top Contributors

[![CRIZPRZ](https://avatars.githubusercontent.com/u/50276449?v=4)](https://github.com/CRIZPRZ "CRIZPRZ (8 commits)")

---

Tags

phpmercadopagoWeb Checkout

### Embed Badge

![Health badge](/badges/crizprz-laravelmercadopago/health.svg)

```
[![Health](https://phpackages.com/badges/crizprz-laravelmercadopago/health.svg)](https://phpackages.com/packages/crizprz-laravelmercadopago)
```

###  Alternatives

[omalizadeh/laravel-multi-payment

A driver-based laravel package for online payments via multiple gateways

491.1k](/packages/omalizadeh-laravel-multi-payment)

PHPackages © 2026

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