> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jelou.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tutorial: Implementing your first payment from WhatsApp

> Implement your first payment from WhatsApp step by step with Mercado Pago.

In this guide you will implement [real payments](/guides/integraciones/pagos/introduccion) within a conversational app on WhatsApp using **Mercado Pago**.

<Note>
  **Prerequisites:**

  * A flow in Brain Studio ready (for example, an AI Agent handling a sale).
  * A Mercado Pago account with test and production credentials.
</Note>

We will use a **tour tickets** app: the user picks a tour, date, quantity, and email; then you charge with Mercado Pago in the same flow.

This tutorial has three parts:

1. **Implementation in test mode (Development)**
2. **Testing on WhatsApp**
3. **Go to production**

***

## 1. Implementation in test mode (Development)

### Video 1: Installation and configuration in Brain Studio

<Frame caption="Video 1 – Mercado Pago installation + node setup in test mode">
  <iframe className="mx-auto w-full max-w-3xl aspect-video rounded-xl" src="https://www.youtube.com/embed/UsZsRWtk55c" title="Video 1 – Mercado Pago installation + node setup in test mode" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
</Frame>

<Note>
  The video may show an older UI. For the current installation flow and node fields, use [Connect in Brain Studio](/guides/integraciones/pagos/proveedores/mercado-pago/conectar-en-brain-studio) and [Usage and configuration](/guides/integraciones/pagos/proveedores/mercado-pago/uso-y-configuracion).
</Note>

***

### Install the integration and add the node

<Steps>
  <Step title="Get test credentials">
    Copy the **Access Token** from **Test credentials** in Mercado Pago.

    Follow [Obtaining credentials](/guides/integraciones/pagos/proveedores/mercado-pago/obtener-credenciales) if this is your first time.

    <Frame caption="Your integrations in Mercado Pago">
      <img src="https://mintcdn.com/jelouai/nCvuucLdA-_D8bXJ/assets/images/integraciones/pagos/dashboard-mercado-pago-tus-integraciones.png?fit=max&auto=format&n=nCvuucLdA-_D8bXJ&q=85&s=1d04d517b6a5ed72cce8485281e83501" alt="Mercado Pago dashboard showing Your integrations and Test credentials" width="2048" height="951" data-path="assets/images/integraciones/pagos/dashboard-mercado-pago-tus-integraciones.png" />
    </Frame>
  </Step>

  <Step title="Connect Mercado Pago in Brain Studio">
    Install the integration with **test** credentials following [Connect in Brain Studio](/guides/integraciones/pagos/proveedores/mercado-pago/conectar-en-brain-studio).

    You can start from **Marketplace**, **Jelou Agent**, the **Payments** node in Canvas, or a **template**. The shared modal has four steps: environment, API Key, VAT/currency, and confirmation.

    <Frame caption="Modal step 2: enter your Mercado Pago API Key">
      <img src="https://mintcdn.com/jelouai/BJIoathnR7ANCT6N/assets/images/integraciones/pagos/mercado-pago-conectar-credenciales.png?fit=max&auto=format&n=BJIoathnR7ANCT6N&q=85&s=fc96c1df5cca0f83298a0a521ef0f80e" alt="Connect Mercado Pago modal with API Key field" className="w-full max-w-2xl mx-auto rounded-xl shadow-sm" width="1024" height="566" data-path="assets/images/integraciones/pagos/mercado-pago-conectar-credenciales.png" />
    </Frame>
  </Step>

  <Step title="Add the node to your flow">
    Add **Mercado Pago** from the **Payments** node in Canvas and connect it after the user confirms the purchase.

    Step-by-step detail in [Usage and configuration — Add the node to Canvas](/guides/integraciones/pagos/proveedores/mercado-pago/uso-y-configuracion#add-the-node-to-canvas).
  </Step>
</Steps>

***

### Configure the node (tours example)

Complete the minimum for the tours case. Full field reference in [Usage and configuration](/guides/integraciones/pagos/proveedores/mercado-pago/uso-y-configuracion).

<Frame caption="Mercado Pago node with Payment data tab and outputs on Canvas">
  <img src="https://mintcdn.com/jelouai/BJIoathnR7ANCT6N/assets/images/integraciones/pagos/mercado-pago-nodo-datos-del-pago.png?fit=max&auto=format&n=BJIoathnR7ANCT6N&q=85&s=e7fc93b248400116b7b157c74bb81ada" alt="Mercado Pago node in Canvas with Payment data panel and node outputs visible" width="1024" height="772" data-path="assets/images/integraciones/pagos/mercado-pago-nodo-datos-del-pago.png" />
</Frame>

| Field           | Example value (tours)                                |
| --------------- | ---------------------------------------------------- |
| Payment reason  | `Tour Valpo Walk - 2 ticket(s)` or a flow variable   |
| Taxable amount  | Net charge amount (e.g. `20168`)                     |
| Tax-free amount | `0` if not applicable                                |
| Buyer email     | Test user for the country (see below)                |
| Currency        | Match credentials (e.g. `CLP`)                       |
| VAT percentage  | Match installation (e.g. `19`)                       |
| Save response   | `checkout_response` (optional, for the code example) |

<Note>
  In **Development**, the node environment reflects **test** credentials. **Currency** and **VAT** must match what you set when installing the integration.
</Note>

***

### Test emails by country (test mode)

In **Development**, Mercado Pago only processes payments if **Buyer email** belongs to a *test user* from the **same country** as your credentials.

<AccordionGroup>
  <Accordion title="🇨🇱 Chile">
    ```txt theme={null}
    test_user_230383680042455079@testuser.com
    ```
  </Accordion>

  <Accordion title="🇵🇪 Peru">
    ```txt theme={null}
    test_user_6344464757279593247@testuser.com
    ```
  </Accordion>

  <Accordion title="🇨🇴 Colombia">
    ```txt theme={null}
    test_user_7600640374023229585@testuser.com
    ```
  </Accordion>

  <Accordion title="🇲🇽 Mexico">
    ```txt theme={null}
    test_user_538195043292703001@testuser.com
    ```
  </Accordion>

  <Accordion title="🇧🇷 Brazil">
    ```txt theme={null}
    test_user_6254528388464257378@testuser.com
    ```
  </Accordion>

  <Accordion title="🇦🇷 Argentina">
    ```txt theme={null}
    test_user_1511189314898568640@testuser.com
    ```
  </Accordion>

  <Accordion title="🇺🇾 Uruguay">
    ```txt theme={null}
    test_user_1178397850300963040@testuser.com
    ```
  </Accordion>
</AccordionGroup>

<Check>
  If payment fails for no clear reason in Development, check the test email first.
</Check>

***

### Connect the node outputs

The node exposes five outputs. Connect them based on the result you want to handle.

| Output                   | Meaning                            | Connect                               |
| ------------------------ | ---------------------------------- | ------------------------------------- |
| **Payment message sent** | Button sent; no payment result yet | Post-send support AI Agent (optional) |
| **Successful payment**   | Transaction approved               | Code → Text (receipt)                 |
| **Pending payment**      | In process or pending settlement   | Informative text                      |
| **Failed payment**       | Rejected or not completed          | Text + retry                          |
| **Error**                | Technical or provider error        | Error handling                        |

Detailed descriptions and a reference prompt for **Payment message sent** in [Usage and configuration — Node outputs](/guides/integraciones/pagos/proveedores/mercado-pago/uso-y-configuracion#node-outputs).

<Frame caption="Post-send payment button support example on WhatsApp">
  <img src="https://mintcdn.com/jelouai/y5L6vahGrhMqbaUQ/assets/images/integraciones/pagos/soporte-post-cta-ejemplo-whatsapp.png?fit=max&auto=format&n=y5L6vahGrhMqbaUQ&q=85&s=7c82515588c84e1859c9f6ceb0f305c1" alt="WhatsApp conversation with Mercado Pago button and support agent answering a question" className="mx-auto rounded-xl shadow-sm" style={{ maxWidth: '320px' }} width="1290" height="1134" data-path="assets/images/integraciones/pagos/soporte-post-cta-ejemplo-whatsapp.png" />
</Frame>

#### Example: normalize **Successful payment**

If you used **Save response** = `checkout_response`, map the minimum to Context:

<Accordion title="Normalization code (Successful payment)">
  ```javascript normalize-payment.js theme={null}
  const r = $memory.getJson('checkout_response')
  if (!r) throw new Error('checkout_response does not exist in memory.')

  const pl = r?.paymentLinkResponse
  if (!pl) throw new Error('checkout_response.paymentLinkResponse does not exist (check memory).')

  const gw = pl.gateway_response || {}
  const md = pl.metadata || gw.metadata || {}

  const email = String(gw?.payer?.email || md.email || '')

  $context.set('pay_operation_id', String(gw.id || ''))
  $context.set('pay_amount', Number(pl.amount || 0))
  $context.set('pay_currency', String(pl.currency || 'CLP'))
  $context.set('pay_email', email)
  $context.set('pay_status', String(gw.status || 'approved'))
  $context.set(
    'pay_receipt',
    `Done ✅ Payment approved.\n\nMercado Pago operation #: ${String(gw.id || '')}`
  )
  ```
</Accordion>

In a **Text** node connected to **Successful payment**, display:

```txt theme={null}
{{$context.pay_receipt}}
```

<Frame caption="Successful payment → Code → Text flow">
  <img src="https://mintcdn.com/jelouai/y5L6vahGrhMqbaUQ/assets/images/integraciones/pagos/pago-exitoso-codigo-texto-flujo.png?fit=max&auto=format&n=y5L6vahGrhMqbaUQ&q=85&s=4b616727705b1f014efec707101f090e" alt="Successful payment output connected to Code node then Text node" className="w-full max-w-3xl mx-auto rounded-xl shadow-sm" width="1640" height="608" data-path="assets/images/integraciones/pagos/pago-exitoso-codigo-texto-flujo.png" />
</Frame>

***

## 2. Testing on WhatsApp

Validate the end-to-end flow from WhatsApp; checkout opens in an **embedded WebView**.

<Note>
  Testing must be done from WhatsApp, not only from the Canvas preview.
</Note>

### Video 2: Testing from WhatsApp

<Frame caption="Video 2 – Mobile test with test cards">
  <video controls className="mx-auto w-full max-w-sm aspect-[9/16] rounded-xl" src="https://mintcdn.com/jelouai/Hhs56n83OOsOa4Lx/assets/videos/integraciones/pagos/paso-2-prueba-whatsapp.mp4?fit=max&auto=format&n=Hhs56n83OOsOa4Lx&q=85&s=5ee89f78ebe8400b4bd5d6dccea6a664" data-path="assets/videos/integraciones/pagos/paso-2-prueba-whatsapp.mp4">
    Your browser does not support video playback.
  </video>
</Frame>

<Steps>
  <Step title="Open Test in Canvas">
    In the top-right corner, click **Test**.

    <Frame caption="Test project panel">
      <img src="https://mintcdn.com/jelouai/y5L6vahGrhMqbaUQ/assets/images/integraciones/pagos/probar-proyecto-whatsapp.png?fit=max&auto=format&n=y5L6vahGrhMqbaUQ&q=85&s=51e4b7d84aa11f0169c1ce83cf448097" alt="Test project panel with WhatsApp test option" className="mx-auto rounded-xl shadow-sm" style={{ maxWidth: '280px' }} width="708" height="1338" data-path="assets/images/integraciones/pagos/probar-proyecto-whatsapp.png" />
    </Frame>
  </Step>

  <Step title="Start a test conversation">
    Enter your number, send the first message, and complete the flow until the payment button.
  </Step>

  <Step title="Complete payment in the WebView">
    Open the payment button, use a test card for the corresponding country, and verify which **output** the flow continues through.
  </Step>
</Steps>

<Note>
  In some countries, the Mercado Pago app may try to open from the WebView. In Development, close it and return to WhatsApp to use the test card.
</Note>

***

### Test cards by country

Mercado Pago publishes test cards by country to simulate approval or rejection:

<AccordionGroup>
  <Accordion title="🇨🇱 Chile">
    [Test cards (Chile)](https://www.mercadopago.cl/developers/es/docs/checkout-bricks/integration-test/test-cards)
  </Accordion>

  <Accordion title="🇵🇪 Peru">
    [Test cards (Peru)](https://www.mercadopago.com.pe/developers/es/docs/your-integrations/test/cards)
  </Accordion>

  <Accordion title="🇨🇴 Colombia">
    [Test cards (Colombia)](https://www.mercadopago.com.co/developers/es/docs/your-integrations/test/cards)
  </Accordion>

  <Accordion title="🇲🇽 Mexico">
    [Test cards (Mexico)](https://www.mercadopago.com.mx/developers/es/docs/shopify/additional-content/your-integrations/test/cards)
  </Accordion>

  <Accordion title="🇧🇷 Brazil">
    [Test cards (Brazil)](https://www.mercadopago.com.br/developers/es/docs/checkout-api-payments/additional-content/your-integrations/test/cards)
  </Accordion>

  <Accordion title="🇦🇷 Argentina">
    [Test cards (Argentina)](https://www.mercadopago.com.ar/developers/es/docs/subscriptions/additional-content/your-integrations/test/cards)
  </Accordion>

  <Accordion title="🇺🇾 Uruguay">
    [Test cards (Uruguay)](https://www.mercadopago.com.uy/developers/es/docs/subscriptions/additional-content/your-integrations/test/cards)
  </Accordion>
</AccordionGroup>

<Check>
  Test at least one **approved** and one **rejected** case to validate **Successful payment** and **Failed payment**.
</Check>

***

## 3. Go to production

Going to production means production credentials and the buyer's real data. The WhatsApp experience stays the same.

### Video 3: Production setup + real payment

<Frame caption="Video 3 – Go to production and real payment">
  <iframe className="mx-auto w-full max-w-3xl aspect-video rounded-xl" src="https://www.youtube.com/embed/1sSVuPfs4rI" title="Video 3 – Go to production and real payment" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
</Frame>

<Note>
  For the current **Go to production** flow, follow [Connect in Brain Studio](/guides/integraciones/pagos/proveedores/mercado-pago/conectar-en-brain-studio#go-to-production).
</Note>

<Steps>
  <Step title="Get production Access Token">
    In Mercado Pago, copy the **Access Token** from **Production credentials**.
  </Step>

  <Step title="Go to production">
    Start **Go to production** from the node's **Advanced** tab in Canvas or from **Mercado Pago** in Marketplace.

    Enter the production Access Token and confirm **VAT** and **currency**.
  </Step>

  <Step title="Use real data in the node">
    Replace the test user in **Buyer email** with the real email captured in your flow.

    Verify **Currency** and **VAT percentage** remain consistent with the production installation.
  </Step>

  <Step title="Run a low-amount real payment test">
    Complete a real payment and confirm **Successful payment**, the operation number, and the record in your Mercado Pago dashboard.
  </Step>
</Steps>

<Warning>
  Production transactions consume Brain Studio credits per attempt, in addition to provider fees.
</Warning>

***

## Next steps

<CardGroup cols={3}>
  <Card title="Usage and configuration" href="/guides/integraciones/pagos/proveedores/mercado-pago/uso-y-configuracion" icon="gear">
    Complete sidepanel and node output reference.
  </Card>

  <Card title="Coverage and pricing" href="/guides/integraciones/pagos/proveedores/mercado-pago/cobertura-y-precios" icon="globe">
    Countries, payment methods, and reference fees.
  </Card>

  <Card title="Other providers" href="/guides/integraciones/pagos/proveedores" icon="credit-card">
    Provider catalog by country.
  </Card>
</CardGroup>
