Configure development environment - Stages of integration - Mercado Pago Developers
AI resources

Configure development environment

To start integrating Mercado Pago's payment solutions, it is necessary to prepare your development environment with a series of configurations that will allow you to access Mercado Pago's functionalities from the backend.

Next, you will need to install and configure the official Mercado Pago SDK:

Install the Mercado Pago SDK

Server-Side

The backend SDK is designed to handle server-side operations, allowing you to create and manage payment preferencesA payment preference is an object or set of information that represents the product or service you want to charge for. Within the Mercado Pago ecosystem, this object is known as `preference`., process transactions, and perform other critical operations securely.

If you prefer, you can download the Mercado Pago SDKs from our official libraries.

Install the Mercado Pago SDK in the language that best fits your integration using a dependency manager, as shown below.

To install the SDK, you must run the following code in your terminal's command line using Composer:

php composer.phar require "mercadopago/dx-php"

To install the SDK, you must run the following code in your terminal's command line using npm:

npm install mercadopago

To install the SDK in your Maven project, you must add the following dependency to your <code>pom.xml</code> file and run <code>maven install</code> in your terminal's command line:

<dependency>
   <groupId>com.mercadopago</groupId>
   <artifactId>sdk-java</artifactId>
   <version>2.1.7</version>
</dependency>

To install the SDK, you must run the following code in your terminal's command line using Gem:

gem install mercadopago-sdk

To install the SDK, you must run the following code in your terminal's command line using NuGet:

nuget install mercadopago-sdk

To install the SDK, you must run the following code in your terminal's command line using Pip:

pip3 install mercadopago
go get -u github.com/mercadopago/sdk-go

Initialize Mercado Pago library

Server-Side

Next, create a main file (main) in the backend of your project with the programming language you are using. There, place the following code replacing the value TEST_ACCESS_TOKEN with the test Access TokenTesting private key of the application created in Mercado Pago, that is used in the backend. You can access it through Your integrations in the Integration data section, by going to the Credentials section located on the right side of the screen and clicking on Testing. Alternatively, you can access it through Your integrations > Application details > Testing > Testing credentials..

<?php
// Mercado Pago SDK
use MercadoPago\MercadoPagoConfig;
// Add credentials
MercadoPagoConfig::setAccessToken("TEST_ACCESS_TOKEN");
?>
// Mercado Pago SDK
import { MercadoPagoConfig, Preference } from 'mercadopago';
// Add credentials
const client = new MercadoPagoConfig({ accessToken: 'YOUR_ACCESS_TOKEN' });
// Mercado Pago SDK
import com.mercadopago.MercadoPagoConfig;
// Add credentials
MercadoPagoConfig.setAccessToken("TEST_ACCESS_TOKEN");
# Mercado Pago SDK
require 'mercadopago'
# Add credentials
sdk = Mercadopago::SDK.new('TEST_ACCESS_TOKEN')
// Mercado Pago SDK
 using MercadoPago.Config;
 // Add credentials
MercadoPagoConfig.AccessToken = "TEST_ACCESS_TOKEN";
# Mercado Pago SDK
import mercadopago
# Add credentials
sdk = mercadopago.SDK("TEST_ACCESS_TOKEN")
import (
	"github.com/mercadopago/sdk-go/pkg/config"
)

cfg, err := config.New("{{ACCESS_TOKEN}}")
if err != nil {
	fmt.Println(err)
}

After completing these configurations, your development environment is ready to proceed with setting up a payment preference.