# Integrated Webhooks: Mercado Pago with SprintHub

{% embed url="<https://www.youtube.com/watch?v=5wQWBMDhn_Y>" %}

{% hint style="danger" %}
Prerequisite: Have studied and tested the integrated Webhooks tutorials: <https://docs.sprinthub.com/topicos/analisar/webhooks-integrados>
{% endhint %}

### Integration flowchart.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfjA6fwZTDV2DCQbor2qMBev8GVxrHXXAsmJm1TyAHdh6l5juq950y5XMG1OC46IhoOgqIa4hw5s5Mtb3cI-02scVM7yDoGjXFcgvdbbLup8eugTesMv4Kxs-GATarO6mC9OYVGXg?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

For a better understanding of this step-by-step, watch the video above.

\
\ <br>

### Step 1:<br>

Register and access the Mercado Pago Developers area:

<br>

<https://www.mercadopago.com.br/developers/panel/app>

<br>

On the Apps screen, create a new app “Create application”.

\ <br>

### Step 2:

\
In SprintHub, under Custom Fields, create the fields you want to bring from Mercado Pago. In this tutorial example, besides the Client ID and Merchant Order, I am bringing only the Order ID field.

<br>

<https://YOUR\\_INSTANCE.sprinthub.app/sh/fields/panel/lead>

<br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeuyVJ80pX2skHnmhmP--_4AeOC7CFPadzlpPAK5vwcdIRK1tlvLIC0HBC1NfDlMBXI-eznH8_6Jbgfpt5LBgvdtClRO_yH7cs_tVES4kV-omHu2nBF7WyxPxai1Sai91jys_e_iQ?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

\
Keep the Client ID as the unique identifier.

\ <br>

### Step 3:

Go to Integration Webhooks and create a new Passive webhook.

<https://YOUR\\_INSTANCE.sprinthub.app/sh/advwebhooks/panel>?

<br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdiLnylvUcNl-hNvLhIjVDEMfvW4HXUVTRdb3SOm-CpFlWZGgzrg6n0pXi60-WrEV1KGSh9CtO-Kr4kasGKDKfwxQExri3H8stpAlBp8UXN7h_-X8tMsB0iKjj-agckrUkpJb1gPQ?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

Do the automatic mapping, but then create a new field called ID because what comes in production with real sales is different from what comes in the test send during mapping.

\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXct08odRI3s5N7tV84C9LY81awy3w0lPBqtnKeUbtvaHcsTTbjZ0WyDUUBRGVSfA3MoOE_rWRP51-56mCgnRlUKn0XSE0wdv_-HoRl4qgUycJvqKx3XBsaGsEtZ75G2ogVF0yhkcw?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

**Extra Actions:** Create an extra action to “Send integration webhook”. This step only after you create active webhooks 02 and 03 according to the video and the screens below.

<br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdN3alGPl1YiGOr1n6QVf8ao4qAMoZ7bTJQhJAx084-SsTkz7a83m887Na0Y-kcafl6hVJ8cvJKHpYeWgFBaVl__pLNk8fCJbLEVNubOkUme-Y6kjWpIgMe4vmkCceEvfySZ7WHCw?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

Configure the token as below. Watch the video to know where to get the token.

\
\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdtqWfghHJpb6M4Y3w1oR6IeoWyLw9UsyyRwCvZrkeESrXPjjsTPkVGmVgdlX_dT4daWyL-Cnp3YY_6vCzIx9GtOfxxSwZrFXoafOCAsWmfWTjAjKGWva65XNhMHjPHjWY_6_5C?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

**Automatic Lead Creation:** Update and automatically create the Lead by mapping these fields.

\ <br>

### Step 04:

<br>

Create an Active Webhook called 02 - MP - Fetch Order ID

\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcG80xAS2RUPWSYkP7hsTYKVGWFdBrLqsS-TFTsSS5LqbA_MeW2WPiMXiRuKexp4m_KGnzCxGtwwXRXyKmoYnJOdHQeiy_pDtO9c_at7wWUPIM8sr3ikGj9KQX-Qgjo4nAuf_PkXg?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

Map as above. This is what we will fetch at this endpoint:

<br>

Destination URL:

[https://api.mercadopago.com/merchant\_orders/{contactfield=mp\_merchant\_order](https://api.mercadopago.com/merchant_orders/%7Bcontactfield=mp_merchant_order)}

\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdUyRFNzQE0IBWzdtHWRmR1aSuxrKs6iEuNamcNFnhBjfa_TOZf6M_LJr4l74PIoSblSoIjxTymWEWDehqKg6mGiKwMNf7wsHpC1-ogEFuqL3knzwchw9OznoQOoVATgQeIjg8w4Q?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

In the Array configuration, I am fetching only id and status, but you can fetch other data within the payment object.

\
\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfI6aT6uOR8KUv-vgmN1pB0AdrRiqTQ8A4tfwdZkUKKx7k7qO2zG_GxGrh8btvl8cMqi1xY-folcqrXptOyQMBQaRIBppPEX4PAiP71mx3wBFlc2V2i1FcK_UAG3yBBehhiT0KuCQ?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

**Return validation:** In the example, I want to bring only those with status approved.

\
\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcjpjwY2VbNCzCrtjNU1b0RSQKk1WvD7obSICbuamhrPyMXzrt3Pg8zZZ3jlq-RUdWTL_rCWpBBiNRHdVtxUjnVN_T2W6iSXe7869laZAyLkJHdTM6m8uoWyWJihf2zecU3FyVaDg?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

**Extra Actions:** I am adding the payment ID to the field MP - Order ID.

\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf7iOLBJZU5misRoX6zxIFq_D-_nEPPvTGFN9ktxOiZA95zMAlMWScIeXv_Pgfn8DsGoKL_C8hpdP1qJaVv1DjE7KITRMbzA8ty91jVAx-YsB6aLp8xiwjtK1F2MlA-JoUFRi4K2g?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

I am calling webhook 03, where I will pass the Payment ID to retrieve the buyer's data.

### Step 05:

Create a new active webhook, called 03 - MP - Fetch Payment Data with Order ID

<br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfIIpUb4fMLaKfm_hhYwwYU8zBzoFyDkNNXXnmntbvouuUF5x96Wb_mZRbIAUAMmaj6d7syTsrnNeEWZNPHch60xzXxN8-hVRpkwGbSBIqbNfU5b5liTs02I99i7Z3FKCtdRMbsBg?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

Destination URL: [https://api.mercadopago.com/v1/payments/{contactfield=order\_id](https://api.mercadopago.com/v1/payments/%7Bcontactfield=id_da_compra)}

\
\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXeYOkeXH5oQljgdK5VpjcgZq9Dez4fbwqr0RZvoId1mgPBC9mGg5h0MfHAB6WhxMa9ZNshmxt9k-JSDMffxYsLwsounyI3e-m8cF3LQ_KLBRm6rJK-q1B7-mo18v3t7WjHWV2p9?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

\ <br>

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfa9kHS7f154mM8frnx0TYRim5ScOWtCps2XzFXw8xTLy8uvzUzGZ7hUOQLy0d6loJCkC8UyQOH93jDgqwMGXzvnTJyozLSCgQ-sa_Wo8Hp8vTwCoMl2TU0o9OKUraKqyklQH14?key=Jw68Uxl1cYC5LR1Xg2mfQg" alt=""><figcaption></figcaption></figure>

**Extra Actions:** This call will update the Contact fields, Name and Email.

\ <br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sprinthub.com/en/topics/analyze/integrated-webhooks/integrated-webhooks-tutorial-videos/integrated-webhooks-mercado-pago-with-sprinthub.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
