# Webhooks Integrados: Mercado Pago com SprintHub

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

{% hint style="danger" %}
Pré-Requisito: Ter estudado e testado os tutoriais de Webhooks integrados: <https://docs.sprinthub.com/topicos/analisar/webhooks-integrados>
{% endhint %}

### Fluxograma da integração.

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

Para melhor entendimento deste passo a passo, assista ao vídeo acima.

\
\ <br>

### Passo 1:<br>

Se cadastre e acesse a área de Developers do Mercado Pago:

<br>

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

<br>

Na tela de Apps, crie um novo app “Criar aplicação”.

\ <br>

### Passo 2:

\
No SprintHub, em Campos Customizados, crie os campos que deseja trazer do Mercado Pago. No exemplo deste tutorial, além do Client ID e Merchand Order, estou trazendo somente o campo Order ID.

<br>

<https://SUA\\_INSTANCIA.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>

\
Mantenha o Client ID como Identificador único.

\ <br>

### Passo 3:

Vá para Webhooks de Integração e crie um novo webhook Passivo.

<https://SUA\\_INSTANCIA.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>

Faça o mapeamento automático, mas depois crie um novo campo chamado ID pois o que vem na produção em vendas reais é diferente do que vem no envio de teste durante o mapeamento.

\ <br>

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

**Ações Extras:** Crie uma ação extra de “Enviar webhook de integração”. Essa etapa somente depois que você criar os webhooks ativos 02 e 03 conforme o video e conforme telas abaixo.

<br>

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

Configure o token conforme abaixo. Assista ao video para saber onde pegar o token.

\
\ <br>

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

**Criação Automática de Leads:** Atualize e crie automaticamente o Lead mapeando esses campos.

\ <br>

### Passo 04:

<br>

Crie um Webhook Ativo chamado 02 - MP - Buscar 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>

Mapeie conforme acima. É o que iremos buscar neste endpoint:

<br>

URL de destino:

[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>

Na configuração do Array, estou buscando somente id e status, mas você poderá buscar outros dados dentro do objeto payment.

\
\ <br>

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

**Validação de retorno:** No exemplo, quero trazer somente o que tiver status approved.

\
\ <br>

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

**Ações Extras:** Estou adicionando o ID do pagamento no campo 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>

Estou chamando o webhook 03, onde irei passar o ID do Payment para trazer os dados do comprador.

### Passo 05:

Crie um novo webhook ativo, chamado 03 - MP - Busca Dados Pagamento com Order ID

<br>

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

URL de destino: [https://api.mercadopago.com/v1/payments/{contactfield=id\_da\_compra](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>

**Ações Extras:** Essa chamada irá atualizar os campos do Contato, Nome e 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/topicos/analisar/webhooks-integrados/webhooks-integrados-videos-tutoriais/webhooks-integrados-mercado-pago-com-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.
