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

AbandonedArchivedLibrary[Payment Processing](/categories/payments)

mercadopago/sdk
===============

MercadoPago SDK module for Payments integration.

v0.5.6(7y ago)21.0M↓18.9%10[26 issues](https://github.com/mercadopago/DEPRECATED-sdk-php/issues)[1 PRs](https://github.com/mercadopago/DEPRECATED-sdk-php/pulls)11PHP

Since Oct 3Pushed 7y ago25 watchersCompare

[ Source](https://github.com/mercadopago/DEPRECATED-sdk-php)[ Packagist](https://packagist.org/packages/mercadopago/sdk)[ RSS](/packages/mercadopago-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (16)Used By (11)

**Warning:** We recommend try to use our new SDK [dx-php](https://github.com/mercadopago/dx-php)

MercadoPago SDK
===============

[](#mercadopago-sdk)

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

Install
-------

[](#install)

### With Composer

[](#with-composer)

From command line

```
composer require mercadopago/sdk:0.5.3

```

As a dependency in your project's composer.json

```
{
    "require": {
        "mercadopago/sdk": "0.5.3"
    }
}
```

### By downloading

[](#by-downloading)

1. Clone/download this repository
2. Copy `lib/mercadopago.php` to your project's desired folder.

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:

```
require_once ('mercadopago.php');

$mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
```

### Preferences

[](#preferences)

#### Get an existent Checkout preference

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

```
$preference = $mp->get_preference("PREFERENCE_ID");

print_r ($preference);
```

#### Create a Checkout preference

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

```
$preference_data = array (
    "items" => array (
        array (
            "title" => "Test",
            "quantity" => 1,
            "currency_id" => "USD",
            "unit_price" => 10.4
        )
    )
);

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

print_r ($preference);
```

#### Update an existent Checkout preference

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

```
$preference_data = array (
    "items" => array (
        array (
            "title" => "Test Modified",
            "quantity" => 1,
            "currency_id" => "USD",
            "unit_price" => 20.4
        )
    )
);

$preference = $mp->update_preference("PREFERENCE_ID", $preference_data);

print_r ($preference);
```

### Payments/Collections

[](#paymentscollections)

#### Search for payments

[](#search-for-payments)

```
$filters = array (
        "id"=>null,
        "external_reference"=>null
    );

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

print_r ($searchResult);
```

#### Get payment data

[](#get-payment-data)

```
require_once ('mercadopago.php');

$mp = new MP ("CLIENT_ID", "CLIENT_SECRET");
$paymentInfo = $mp->get_payment ("PAYMENT_ID");

print_r ($paymentInfo);
```

#### Cancel (only for pending payments)

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

```
$result = $mp->cancel_payment("PAYMENT_ID");

print_r ($result);
```

#### Refund (only for accredited payments)

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

```
$result = $mp->refund_payment("PAYMENT_ID");

print_r ($result);
```

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

[](#customized-checkout)

### Configure your credentials

[](#configure-your-credentials-1)

- Get your **ACCESS\_TOKEN** in the following address:
    - Argentina:
    - Brazil:
    - Mexico:
    - Venezuela:
    - Colombia:

```
require_once ('mercadopago.php');

$mp = new MP ("ACCESS_TOKEN");
```

### Create payment

[](#create-payment)

```
$mp->post (
    array(
        "uri" => "/v1/payments",
        "data" => [payment_data]
    )
);
```

### Create customer

[](#create-customer)

```
$mp->post (
    array(
        "uri" => "/v1/customers",
        "data" => array(
            "email" => "email@test.com"
        )
    )
);
```

### Get customer

[](#get-customer)

```
$mp->get (
    array(
        "uri" => "/v1/customers/CUSTOMER_ID"
    )
);
```

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

Generic methods
---------------

[](#generic-methods)

You can access any resource from the [MercadoPago API](https://api.mercadopago.com) using the generic methods. The basic structure is:

`$mp->[method]($request)`

where `request` can be:

```
array(
    "uri" => "The resource URI, relative to https://api.mercadopago.com",
    "params" => "Optional. Key=>Value array with parameters to be appended to the URL",
    "data" => "Optional. Object or String to be sent in POST and PUT requests",
    "headers" => "Optional. Key => Value array with custom headers, like content-type: application/x-www-form-urlencoded",
    "authenticate" => "Optional. Boolean to specify if the GET method has to authenticate with credentials before request. Set it to false when accessing public APIs"
)
```

Examples:

```
// Get a resource, with optional URL params. Also you can disable authentication for public APIs
$mp->get (
    array(
        "uri" => "/resource/uri",
        "params" => array(
            "param" => "value"
        ),
        "headers" => array(
            "header" => "value"
        ),
        "authenticate" => true
    )
);

// Create a resource with "data" and optional URL params.
$mp->post (
    array(
        "uri" => "/resource/uri",
        "params" => array(
            "param" => "value"
        ),
        "headers" => array(
            "header" => "value"
        ),
        "data" => [data]
    )
);

// Update a resource with "data" and optional URL params.
$mp->put (
    array(
        "uri" => "/resource/uri",
        "params" => array(
            "param" => "value"
        ),
        "headers" => array(
            "header" => "value"
        ),
        "data" => [data]
    )
);

// Delete a resource with optional URL params.
$mp->delete (
    array(
        "uri" => "/resource/uri",
        "params" => array(
            "param" => "value"
        ),
        "headers" => array(
            "header" => "value"
        )
    )
);
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 81.9% 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 ~118 days

Recently: every ~320 days

Total

15

Last Release

2590d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b3f4a82eda56d040602f57af2434111152a526d8dabeafd282b18937c8ce7b9c?d=identicon)[mpb\_desenvolvimento](/maintainers/mpb_desenvolvimento)

![](https://www.gravatar.com/avatar/7b815e567ff2ac854b47dad207d0192e8bff65275633b02e98f15d0d0be07d5c?d=identicon)[delias](/maintainers/delias)

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

![](https://www.gravatar.com/avatar/78c55fdf4842b99f70214245c6649d5501a6168f2875534f0e82a8b41f756d4d?d=identicon)[hcasatti](/maintainers/hcasatti)

![](https://www.gravatar.com/avatar/9e8634f257bb973d00a4c3cef5f6242b066b21ebaecc5db7a3a49d7d259a51c3?d=identicon)[joelibaceta](/maintainers/joelibaceta)

![](https://www.gravatar.com/avatar/7977fdb712a3cc41d7387b5b9b3116325f05f202e779717b5fc1d98d096c54e8?d=identicon)[victorgodinho-meli](/maintainers/victorgodinho-meli)

---

Top Contributors

[![hcasatti](https://avatars.githubusercontent.com/u/899094?v=4)](https://github.com/hcasatti "hcasatti (77 commits)")[![aleiva-l](https://avatars.githubusercontent.com/u/124067762?v=4)](https://github.com/aleiva-l "aleiva-l (4 commits)")[![sebagun](https://avatars.githubusercontent.com/u/927803?v=4)](https://github.com/sebagun "sebagun (3 commits)")[![gmatsuoka](https://avatars.githubusercontent.com/u/1392359?v=4)](https://github.com/gmatsuoka "gmatsuoka (3 commits)")[![fpiruzi](https://avatars.githubusercontent.com/u/3010798?v=4)](https://github.com/fpiruzi "fpiruzi (2 commits)")[![matiascompiano](https://avatars.githubusercontent.com/u/2538343?v=4)](https://github.com/matiascompiano "matiascompiano (1 commits)")[![dimrsilva](https://avatars.githubusercontent.com/u/382789?v=4)](https://github.com/dimrsilva "dimrsilva (1 commits)")[![tomylucadamo](https://avatars.githubusercontent.com/u/10680512?v=4)](https://github.com/tomylucadamo "tomylucadamo (1 commits)")[![CodeLingoBot](https://avatars.githubusercontent.com/u/45469328?v=4)](https://github.com/CodeLingoBot "CodeLingoBot (1 commits)")[![lucasdealmeida](https://avatars.githubusercontent.com/u/1371269?v=4)](https://github.com/lucasdealmeida "lucasdealmeida (1 commits)")

---

Tags

sdkmercadopago

### Embed Badge

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

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

###  Alternatives

[santigraviano/laravel-mercadopago

Mercado Pago SDK v0.5.2 for Laravel

47145.9k](/packages/santigraviano-laravel-mercadopago)[livepixel/mercado-pago

Mercado Pago API SDK for Laravel

2216.2k](/packages/livepixel-mercado-pago)[cryptonator/merchant-php-sdk

Cryptonator.com Merchant API SDK for PHP

2713.7k](/packages/cryptonator-merchant-php-sdk)[lucassmacedo/omnipay-mercadopago

MercadoPago gateway for OmniPay

154.6k](/packages/lucassmacedo-omnipay-mercadopago)

PHPackages © 2026

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