Integrate the Device ID - Captura payment - Mercado Pago Developers
Which documentation are you looking for?

Do not know how to start integrating? 

Check the first steps

Integrate the Device ID

The Device ID is an important piece of information to ensure better security and, consequently, a better payment approval rate. It's a unique number that's used to identify a customer's device when they are buying.

If a customer makes a purchase on a different device than usual, this may represent an atypical behavior. The Device ID could help us to make a correct assessment and avoid legitimate payment rejections.

Get and send the Device ID

You can add the Mercado Pago security code to your website by replacing the value view with the name of the section of your website where you want to add it.

In case of unavailable value for a section, leave it empty.

Implement the Device ID in your site

To use the Device ID on your web and prevent possible fraudulent purchases, follow the steps below:

1. Add the security code

To generate Device IDs on your website, add the following code to your Checkout page:


<script src="" view="checkout"></script>

2. Getting the Device ID

When you add the Mercado Pago security code to your site, a global JavaScript variable is automatically created with the name MP_DEVICE_SESSION_ID, whose value is the Device ID.

If you prefer that we assign it to another variable, indicate the name by adding the attribute output, as in the following example:


<script src="" view="checkout" output="deviceId"></script>

You can also create your own variable by adding an HTML tag on your site as id="deviceId" and the code will automatically assign the value device_id.


<input type="hidden" id="deviceId">

3. Use the Device ID

Once you have the Device ID, you must send it to our servers when creating a payment. To do so, simply add the following header to the request:


X-meli-session-id: device_id
Remember to replace device_id with the name of the variable that contains your Device ID value.