Suggest edit
Help us improve the documentation
Did you see wrong information and would you like us to explain something else or improve our manuals? Please leave your suggestions on GitHub.

Mercado Pago SDK for PHP

This library provides developers with a simple set of bindings to the Mercado Pago API.

Supported PHP Versions:

This SDK supports PHP version 5.6 or newer.


Using Composer

  1. Download Composer if not already installed
  2. Go to your project directory and run composer require "mercadopago/dx-php" on the command line.
  3. This how your directory structure would look like.

Structure of the Mercado Pago SDK for PHP

  1. Thats all, you have Mercado Pago SDK installed.

Quick Start

  1. You have to require the library from your Composer vendor folder.


  require __DIR__  . '/vendor/autoload.php';
  1. Setup your credentials

You have two types of credentials:

  • For Checkout Mercado Pago:


  • For API or custom checkout:


    MercadoPago\SDK::setAccessToken("ACCESS_TOKEN");      // On Production
    MercadoPago\SDK::setAccessToken("TEST_ACCESS_TOKEN"); // On Sandbox
  1. Using resource objects.

You can interact with all the resources available in the public API, to this each resource is represented by classes according to the following diagram:

SDK resource structure of Mercado Pago




    require_once 'vendor/autoload.php';


    $payment = new MercadoPago\Payment();

    $payment->transaction_amount = 141;
    $payment->token = "YOUR_CARD_TOKEN";
    $payment->description = "Ergonomic Silk Shirt";
    $payment->installments = 1;
    $payment->payment_method_id = "visa";
    $payment->payer = array(
      "email" => ""


    echo $payment->status;


Your search returns no results.

Verifique a ortografia de termos de pesquisa ou teste com outras palavras-chave.