> For the complete documentation index, see [llms.txt](https://docs.mavibot.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mavibot.ai/integrations/payment/mercado-pago.md).

# Mercado Pago

To use the Mercado Pago payment system, complete the settings below in your Mercado Pago Developers dashboard and then enter the details in the integration settings.

## Application and Access Token

1. Sign in to Mercado Pago and open the Developers section (**Developers / Suas integrações**).
2. Create an application (**Your integrations → Create application**) if you don’t have one yet.
3. Copy your **Production Access Token** or **Test Access Token** — this token will be used as the main API token.

<div data-with-frame="true"><figure><img src="/files/yAlR2tiGspSa5OuWf5Oh" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
For information about token types and where to find them, see: [Credentials.](https://www.mercadopago.com.br/developers/en/docs/your-integrations/credentials)
{% endhint %}

## Webhooks (payment notifications)

1. In the integration settings, open the **Webhooks / уведомления** section (see: [**Webhooks**](https://www.mercadopago.com.br/developers/en/docs/your-integrations/notifications/webhooks)).
2. Set the notification URL:

`https://chatter.mavibot.ai/mercado_pago_callback/result`

3. Subscribe to **Payments** events so you can receive notifications about payment creation and status updates.
4. Save the **Webhook secret** — it must be entered in the integration settings.

<div data-with-frame="true"><figure><img src="/files/JRXb6xy7TdUppOyMuGaJ" alt=""><figcaption></figcaption></figure></div>

## Connecting to Mavibot

In the Acquiring section, select **Mercado Pago**.

<div data-with-frame="true"><figure><img src="/files/3NtXFPxLeK98rtRGqcS6" alt=""><figcaption></figcaption></figure></div>

Then enter:

* **Access Token** — the token you copied.
* **Webhook secret** — the secret used to verify webhooks.

<div data-with-frame="true"><figure><img src="/files/2i9ZdXI0sUqreboF4f1O" alt=""><figcaption></figcaption></figure></div>

## Payment link generation

Calculator function:\
`get_mercado_pago_payment_url(amount, description, currency, customer_email, product_name)`

<table data-header-hidden><thead><tr><th width="241.3828125"></th><th></th></tr></thead><tbody><tr><td>Parameters</td><td>Description</td></tr><tr><td><mark style="color:$danger;"><strong>!</strong></mark><strong> amount</strong></td><td><p><strong>Payment amount.</strong></p><p>This is required parameter.</p></td></tr><tr><td><strong>description</strong></td><td><p><strong>Payment description.</strong> </p><p>This is optional parameter.</p></td></tr><tr><td><strong>currency</strong></td><td><strong>ISO currency code</strong> (e.g. BRL, ARS, MXN, USD, EUR, CLP, COP, PEN, UYU) — optional; default is BRL.</td></tr><tr><td><strong>customer_email</strong></td><td><strong>Customer email</strong> — optional.</td></tr><tr><td><strong>product_name</strong></td><td><p><strong>Alternative product name</strong> — optional; </p><p>if not provided, the description is used instead.</p></td></tr></tbody></table>

The function returns a payment link.

<div data-with-frame="true"><figure><img src="/files/kWsLzsjNb0K18jcApnOy" alt=""><figcaption><p>This example shows how to pass parameters into the function and send the payment link in a message.</p></figcaption></figure></div>

## Payment via button

To send a payment button via Mercado Pago, select a button type with payment support in the button builder and choose **Mercado Pago** as the payment system. Enter the amount, description, and currency if needed.

<div data-with-frame="true"><figure><img src="/files/aZ63DxYnX46uu7OdknCk" alt=""><figcaption></figcaption></figure></div>

## Callbacks in the dialog after payment

### **Successful payment**

After the client follows the link and completes a successful payment, a callback may be sent to the dialog in the following format:

`<first_10_characters_of_Webhook_secret>_success <amount>`

<div data-with-frame="true"><figure><img src="/files/xRJyC7KHCIbJTj6AbxrQ" alt="" width="524"><figcaption></figcaption></figure></div>

**Example:**\
`gltubgnDle_success 100` — where the prefix is the first 10 characters of your Webhook secret, and `100` is the payment amount.

### How to add a reaction to a successful payment

To send a message to your client after a successful payment (for example, “Payment completed successfully” or any other message), you need to set up a reaction using a block with a trigger and a callback.

#### Step 1

Create a block with a condition (Start block or Trigger block).

<div data-with-frame="true"><figure><img src="/files/Vv6LAwdUidoRI5b6TQjW" alt=""><figcaption><p>This is the Start block with a callback in the Trigger field</p></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/g2zGYOBKxoCm8oUcREdk" alt=""><figcaption><p>This is the Trigger block with a callback in the Trigger field</p></figcaption></figure></div>

#### Step 2

Specify part of the callback (if you need to react to all payments, e.g. when you have multiple different products), or the full callback (if you want to set up a reaction only for a specific product sale).

<div data-with-frame="true"><figure><img src="/files/TGsLpfbd0IEleHoRGy7A" alt=""><figcaption><p>If you need to set up a response to any payments in the project, <br>leave a part of the callback and select the type of matching "Keywords match"</p></figcaption></figure></div>

#### Step 3

Write the response message for a successful payment and save the block.Шаг 3. Пропишите сообщение-реакцию на успешную оплату и сохраните блок.

<div data-with-frame="true"><figure><img src="/files/8gHhJQpWSBBdmy2q58aQ" alt=""><figcaption></figcaption></figure></div>

### Failed payment

If the payment is not successful (declined, canceled, etc., depending on the status in the API), a callback may be sent in the following format:

`<first_10_characters_of_Webhook_secret>_fail <amount>`

<div data-with-frame="true"><figure><img src="/files/ERIaflwLIPkhqXvkgZxz" alt="" width="563"><figcaption></figcaption></figure></div>

**Example:**\
`gltubgnDle_fail 100` — where the prefix is the first 10 characters of your Webhook secret, and `100` is the amount.

#### How to add a reaction to a failed payment

To send a message to your client after an unsuccessful payment (for example, “Payment failed” or any other message), you need to set up a reaction using a block with a trigger and a callback.

{% hint style="info" %}
[A failed payment reaction is configured in the same way as a successful one.](#how-to-add-a-reaction-to-a-successful-payment)
{% endhint %}

#### Step 1

Create a block with a condition (Start block or Trigger block).

#### Step 2

Specify part of the callback (if you need to react to all payments, e.g. when you have multiple different products), or the full callback (if you want to set up a reaction only for a specific product sale).

#### Step 3

Write the response message for a failed payment and save the block.

### Client variables after successful payment

| Variables                         | Description                                            |
| --------------------------------- | ------------------------------------------------------ |
| mercado\_pago\_callback\_data     | Payment information received from the payment system.  |
| mercado\_pago\_payment\_completed | “True” — the payment has been processed as successful. |
| mercado\_pago\_payment\_id        | Mercado Pago payment ID                                |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.mavibot.ai/integrations/payment/mercado-pago.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.
