PHPackages                             fedeisas/mercadopago-sdk-php - 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. fedeisas/mercadopago-sdk-php

ActiveLibrary[Payment Processing](/categories/payments)

fedeisas/mercadopago-sdk-php
============================

MercadoPago PHP SDK https://developers.mercadopago.com/

v1.0.0(8y ago)095[1 issues](https://github.com/fedeisas/mercadopago-sdk-php/issues)MITPHPPHP ~5.6|~7.0

Since Jun 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/fedeisas/mercadopago-sdk-php)[ Packagist](https://packagist.org/packages/fedeisas/mercadopago-sdk-php)[ Docs](https://github.com/fedeisas/mercadopago-sdk-php)[ RSS](/packages/fedeisas-mercadopago-sdk-php/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (2)Used By (0)

mercadopago-sdk-php
===================

[](#mercadopago-sdk-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6d114095226f277b27c14881ae371041c2a287a93ea21175126e2bc3fa70bf77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66656465697361732f6d65726361646f7061676f2d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fedeisas/mercadopago-sdk-php)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/6301f6f8fff67fec554a77ab4011ea015b22ffda8fbb5f40cd3b1831027197f4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f66656465697361732f6d65726361646f7061676f2d73646b2d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/fedeisas/mercadopago-sdk-php)[![Coverage Status](https://camo.githubusercontent.com/4798618998131110aca8b5008a2695583164d87d864a17cc316b7534b81dcda6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f66656465697361732f6d65726361646f7061676f2d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/fedeisas/mercadopago-sdk-php/code-structure)[![Quality Score](https://camo.githubusercontent.com/7fabf0e73b21fda947d8e4df813acf908f8d93d886df551c88bdfc5cd3c3110d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f66656465697361732f6d65726361646f7061676f2d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/fedeisas/mercadopago-sdk-php)[![Total Downloads](https://camo.githubusercontent.com/5cb53d229889cd302f0bad744e5c299d40c7ccdc7c658c9787d55a6d43bbbef7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66656465697361732f6d65726361646f7061676f2d73646b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fedeisas/mercadopago-sdk-php)

- [Install](#install)
- [Basic checkout](#basic-checkout)
- [Customized checkout](#custom-checkout)

Install
-------

[](#install)

Via Composer

```
$ composer require fedeisas/mercadopago-sdk-php
```

Or as a dependency in your project's composer.json:

```
{
    "require": {
        "fedeisas/mercadopago-sdk-php": "1.0"
    }
}
```

Basic checkout
--------------

[](#basic-checkout)

### Configure your credentials

[](#configure-your-credentials)

- Get your **CLIENT\_ID** and **CLIENT\_SECRET** in the following address:
    - Argentina:
    - Brazil:
    - Mexico:
    - Venezuela:
    - Colombia:
    - Chile:

```
use MercadoPago\MercadoPago;
use MercadoPago\Http\GuzzleClient;

$mp = new MercadoPago(new GuzzleClient());
$mp->setCredentials('CLIENT_ID', 'CLIENT_SECRET');
```

### Preferences

[](#preferences)

#### Get an existent Checkout preference

[](#get-an-existent-checkout-preference)

```
$preference = $mp->getPreference('PREFERENCE_ID');

var_dump($preference);
```

#### Create a Checkout preference

[](#create-a-checkout-preference)

```
$preference_data = [
    'items' => [
        [
            'title' => 'Test',
            'quantity' => 1,
            'currency_id' => 'USD',
            'unit_price' => 10.4,
        ]
    ]
];

$preference = $mp->createPreference($preference_data);

var_dump($preference);
```

#### Update an existent Checkout preference

[](#update-an-existent-checkout-preference)

```
$preference_data = [
    'items' => [
        [
            'title' => 'Test Modified',
            'quantity' => 1,
            'currency_id' => 'USD',
            'unit_price' => 20.4,
        ]
    ]
];

$preference = $mp->updatePreference('PREFERENCE_ID', $preference_data);

var_dump($preference);
```

### Payments/Collections

[](#paymentscollections)

#### Search for payments

[](#search-for-payments)

```
$filters = [
    'id' => null,
    'site_id' => null,
    'external_reference' => null,
];

$searchResult = $mp->searchPayments($filters);

var_dump($searchResult);
```

#### Get payment data

[](#get-payment-data)

```
use MercadoPago\MercadoPago;
use MercadoPago\Http\GuzzleClient;

$mp = new MercadoPago(new GuzzleClient());
$mp->setCredentials('CLIENT_ID', 'CLIENT_SECRET');
$paymentInfo = $mp->getPayment('PAYMENT_ID');

var_dump($paymentInfo);
```

#### Cancel (only for pending payments)

[](#cancel-only-for-pending-payments)

```
$result = $mp->cancelPayment('PAYMENT_ID');

var_dump($result);
```

#### Refund (only for accredited payments)

[](#refund-only-for-accredited-payments)

```
$result = $mp->refundPayment('PAYMENT_ID');

var_dump($result);
```

Customized checkout
-------------------

[](#customized-checkout)

Use an access token:

```
use MercadoPago\MercadoPago;
use MercadoPago\Http\GuzzleClient;

$mp = new MercadoPago(new GuzzleClient());
$mp->setAccessToken('SOME_ACCESS_TOKEN');
```

### Create payment

[](#create-payment)

```
$mp->getClient()->post(
    '/v1/payments',
    $paymentData,
    ['access_token' => 'SOME_ACCESS_TOKEN']
);
```

### Create customer

[](#create-customer)

```
$mp->getClient()->post(
    '/v1/customers',
    ['email' => 'email@test.com'],
    ['access_token' => 'SOME_ACCESS_TOKEN']
);
```

### Get customer

[](#get-customer)

```
$mp->getClient()->get(
    '/v1/customers/CUSTOMER_ID',
    [],
    ['access_token' => 'SOME_ACCESS_TOKEN']
);
```

- View more Custom checkout related APIs in Developers Site
    - Argentina:
    - Brazil:
    - Mexico:
    - Venezuela:
    - Colombia:

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Fede Isas](https://github.com/fedeisas)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  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

Maturity58

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

Unknown

Total

1

Last Release

3243d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d1a4ac79561ed7edef104265d9cabcdbc936a701456d6c65d28ac29255f3bbf?d=identicon)[fedeisas](/maintainers/fedeisas)

---

Top Contributors

[![fedeisas](https://avatars.githubusercontent.com/u/251675?v=4)](https://github.com/fedeisas "fedeisas (17 commits)")

---

Tags

mercadopago-sdk-php

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/fedeisas-mercadopago-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/fedeisas-mercadopago-sdk-php/health.svg)](https://phpackages.com/packages/fedeisas-mercadopago-sdk-php)
```

###  Alternatives

[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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