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

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# PagoEfectivo via Mercado Pago

> Accept PagoEfectivo through the Mercado Pago hosted checkout in Payrails, and see the order and customer fields Mercado Pago needs.

<picture noZoom>
  ![PagoEfectivo logo](https://assets.payrails.io/img/logos/pagoefectivo/logo.svg)
</picture>

<picture noZoom>
  ![Mercado Pago logo](https://assets.payrails.io/img/logos/mercadopago/logo-full-bleed.svg)
</picture>

Accept [PagoEfectivo](https://docs.payrails.com/docs/integrations/payment-methods/pagoefectivo) payments from customers in Peru with Mercado Pago as the payment service provider (PSP). The customer selects Mercado Pago in your checkout, goes to the Mercado Pago hosted checkout and picks PagoEfectivo there. The customer then gets a payment code (CIP) to pay at a bank, at an agent, or through online banking. Payrails records the payment as PagoEfectivo once Mercado Pago reports the method the customer used.

## Supported workflows

<table>
  <thead>
    <tr><th>Workflow</th><th>Supported</th></tr>
  </thead>

  <tbody>
    <tr><td>Payrails SDK</td><td>✔</td></tr>
    <tr><td>Payrails API</td><td>✔</td></tr>
    <tr><td>[Delayed / Manual Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✖</td></tr>
    <tr><td>[Instant Capture](https://docs.payrails.com/docs/orchestration/payment-acceptance/capture-and-cancel-modes.md#capture-mode)</td><td>✔</td></tr>
    <tr><td>[Cancel / Void](https://docs.payrails.com/docs/orchestration/payment-acceptance/cancel-a-payment.md)</td><td>✖</td></tr>
    <tr><td>[Refund / Reverse](https://docs.payrails.com/docs/orchestration/payment-acceptance/refund-a-payment.md)</td><td>✔</td></tr>
    <tr><td>[Save Instruments](https://docs.payrails.com/docs/resources/manage-instruments.md)</td><td>✖</td></tr>
    <tr><td>[Merchant Initiated Transaction (MIT)](https://docs.payrails.com/docs/resources/payments/authorization-flags.md)</td><td>✖</td></tr>
  </tbody>
</table>

## Before you begin

Complete these steps before you send your first PagoEfectivo payment through Mercado Pago:

1. Set up a Mercado Pago integration in your workspace with your Mercado Pago access token and HMAC key. Follow the [Mercado Pago integration setup guide](https://docs.payrails.com/docs/integrations/payment-providers/mercado-pago.md) if you don't have one yet.
2. Ask Mercado Pago to enable PagoEfectivo on your Mercado Pago account for Peru.
3. In the Payrails Portal, go to **Settings → Integrations**, open your Mercado Pago integration, select **Mercado Pago** under **Payment methods**, and save.
4. Add Mercado Pago as a [payment option](https://docs.payrails.com/docs/integrations/payment-methods/set-up-payment-methods.md) in your workflow.

## Request fields for Mercado Pago

Send these fields in the authorize request, in addition to the standard [authorize fields](https://docs.payrails.com/reference/authorizeaction.md). **Required** fields must be present for the payment to succeed. Payrails sends **Optional** fields to the PSP when you include them.

| Field | Status | Description |
| - | - | - |
| `amount.currency` | Required | Send `PEN`. Mercado Pago offers PagoEfectivo on its Peru checkout, and Payrails picks the Peru site from the currency. |
| `returnInfo.success` | Required | A full URL. The customer returns here after a successful payment. |
| `returnInfo.error` | Required | A full URL. The customer returns here after a failed payment. |
| `meta.customer` | Required | The customer object. Payrails builds the Mercado Pago payer from it. |
| `meta.customer.email` | Required | Sent to Mercado Pago as the payer email. Mercado Pago links the PagoEfectivo payment to this email. |
| `meta.order` | Required | The order object. Payrails builds the Mercado Pago items from it. |
| `meta.order.lines` | Required | One or more order lines, each with `id`, `name`, and `unitPrice` and `quantity` or `total`. The lines must add up to the payment amount. Send `meta.order.total` instead when you don't send lines. |
| `meta.customer.name` | Optional | Sent to Mercado Pago as the payer first name. |
| `meta.customer.lastName` | Optional | Sent to Mercado Pago as the payer surname. |
| `meta.customer.identityCardNumber` | Optional | The customer's document number. Sent to Mercado Pago as the payer identification. |
| `meta.customer.identityCardType` | Optional | Leave it empty for a DNI. Send `tradeLicense` for a RUC or `foreignId` for a foreigner identity card. |
| `meta.customer.phone` | Optional | Sent to Mercado Pago as the payer phone. `countryCode` becomes the area code. |
| `meta.customer.createdAt` | Optional | The date the customer opened their account, in RFC 3339 format. For a guest order, send the order date. |
| `meta.order.lines[].categoryId` | Optional | The Mercado Pago item category. |
| `meta.order.lines[].description` | Optional | Sent to Mercado Pago as the item description. |
| `meta.order.billingAddress` | Optional | Sent to Mercado Pago as the payer address: `postalCode`, `street` and `doorNumber`. |
| `meta.order.deliveryAddress` | Optional | Sent to Mercado Pago as the shipping address. |
| `meta.order.softDescriptor` | Optional | Sent to Mercado Pago as the statement descriptor. |

## Authorize a PagoEfectivo payment

Call [authorize a payment](https://docs.payrails.com/reference/authorizeaction.md) with `mercadoPago` as the `paymentMethodCode` and `hpp` as the `integrationType`. The response includes the redirect to the Mercado Pago hosted checkout, where the customer picks PagoEfectivo.

```json Authorize request theme={null}
{
  "amount": {
    "value": "100.00",
    "currency": "PEN"
  },
  "paymentComposition": [
    {
      "integrationType": "hpp",
      "paymentMethodCode": "mercadoPago",
      "amount": {
        "value": "100.00",
        "currency": "PEN"
      }
    }
  ],
  "meta": {
    "customer": {
      "name": "Carlos",
      "lastName": "Quispe",
      "email": "carlos.quispe@example.com",
      "identityCardNumber": "12345678",
      "country": {
        "code": "PE"
      }
    },
    "order": {
      "lines": [
        {
          "id": "sku-2001",
          "name": "Running shoes",
          "quantity": 1,
          "unitPrice": {
            "value": "100.00",
            "currency": "PEN"
          }
        }
      ]
    }
  },
  "returnInfo": {
    "success": "https://example.com/success",
    "error": "https://example.com/error"
  }
}
```

The payment stays pending until the customer pays the code. Confirm the result through [webhook notifications](https://docs.payrails.com/docs/orchestration/payment-acceptance/receive-notifications.md) or the execution status before you fulfill the order.

## How Mercado Pago handles PagoEfectivo

* Payrails creates a Mercado Pago checkout session for each authorize request. The customer picks the payment method on the Mercado Pago page, and can pick PagoEfectivo when Mercado Pago offers it for the payment.
* After the customer picks PagoEfectivo, the Mercado Pago page shows the payment code. The customer can pay it online or note it and pay at a bank or agent.
* The payment stays pending until the customer pays the code. Treat the pending notification as a reserved order.
* When Mercado Pago reports the payment, Payrails updates its payment method from `mercadoPago` to `pagoEfectivo`.
* The checkout session stays open for the **Session Expiration Hours** set on your Mercado Pago integration, or 24 hours by default.
* Payrails captures Mercado Pago payments immediately, so a successful payment is final. To return funds, refund the payment. Mercado Pago returns the money to the PagoEfectivo account linked to the customer's email.
* Payrails sends your `merchantReference` to Mercado Pago as the external reference of the payment.


## Related topics

- [PagoEfectivo](https://docs.payrails.com/docs/integrations/payment-methods/pagoefectivo.md)
- [PagoEfectivo via dLocal](https://docs.payrails.com/docs/integrations/payment-methods/pagoefectivo/dlocal.md)
- [Yape via Mercado Pago](https://docs.payrails.com/docs/integrations/payment-methods/yape/mercadopago.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.