# Payment methods

| Method                                                                     | Today       |
| -------------------------------------------------------------------------- | ----------- |
| <img class="logo-medio" src="/pse.png" alt="PSE" width="36" height="36" /> | Enabled     |
| Card                                                                       | Not enabled |
| Cash                                                                       | Not enabled |

## How the buyer pays

| Step | Where it happens                         | What you do                                                 |
| ---- | ---------------------------------------- | ----------------------------------------------------------- |
| 1    | Your server, with `POST /v1/pagos`       | You create the charge and receive a `checkoutUrl`.          |
| 2    | The payment screen, at the `checkoutUrl` | You redirect the buyer. They pick their bank there.         |
| 3    | Their bank's page                        | Nothing: the authentication is between them and their bank. |
| 4    | Your webhook, with `payment.completed`   | You verify the signature and ship.                          |

The screen in step 2 **is EvePay's**, at `api.evetev.com`. There are three ways to use it, and in two of them you build no payment form at all:

- **You redirect the buyer** to the `checkoutUrl`, which is what the table above describes. If your store restricts which domains it may redirect to, that is the one to allow.
- **You show it inside your checkout**, in a frame: that is the next section, and it is what keeps the buyer inside your store without you writing a payment form.
- **You skip it**: if you send the `pagador` block when you create the charge —with the bank and the payer's details— the `checkoutUrl` goes straight to their bank's page. You build the form and you take on the payer's data.

## The screen inside your store

Add `?embebido=1` to the `checkoutUrl` and show it in a frame, inside your own checkout. The buyer never leaves your store and you do not maintain a copy of a form that changes when the gateway changes.

```html
<iframe
  id="pago"
  src="https://api.evetev.com/v1/checkout/EL_TOKEN?embebido=1"
  title="Pago seguro"
  style="width: 100%; height: 760px; border: 0; display: block"
></iframe>
```

What that flag changes:

- The screen drops its own background and margins, so it blends into your design instead of looking like a page forced into a box.
- It tells you how tall it is, so the frame grows with it. A guessed height leaves the pay button out of sight.
- On submit it **breaks out of the frame**: the buyer reaches their bank in the full window. Nobody should authorise a payment inside a box where they cannot check the address.
- A validation error does stay inside, which is exactly what you want: it gets fixed without losing sight of your store.

The height arrives through `postMessage`. Check its origin before trusting it:

```html
<script>
  const marco = document.getElementById("pago");
  window.addEventListener("message", (evento) => {
    if (evento.origin !== "https://api.evetev.com") return;
    const dato = evento.data;
    if (!dato || dato.evepay !== "alto" || !Number.isFinite(dato.alto)) return;
    marco.style.height = Math.ceil(dato.alto) + "px";
  });
</script>
```

If that script does not run nothing breaks: the frame keeps the height you gave it, and the payment still works.

> **Only your site can frame it.** The screen answers with `frame-ancestors` pointing at the site you registered in the portal, so the frame works there and nowhere else; if you have not registered it yet, it comes up blank. This is not paperwork: without that limit anyone could frame the payment screen, put an invisible button on top of it and have your buyer authorise what they cannot see.

## The bank list

`GET /v1/pagos/bancos` returns the PSE banks, with the same code the gateway uses:

```bash
curl https://api.evetev.com/v1/pagos/bancos \
  -H "Authorization: Bearer evpk_tu_llave"
```

```json
[
  { "codigo": "1022", "nombre": "BANCO UNION" },
  { "codigo": "1040", "nombre": "BANCO AGRARIO" }
]
```

The list comes from the gateway and it changes: fetch it when you are about to show it, do not hard-code it.

> **For the normal flow you do not need it**, because the bank is picked on the payment screen. It is here so you can build your own selector and have it tested before the mode below is enabled for your merchant.

## Your own form

The bank and the payer's details can be asked for on **your** site, with the buyer going straight to their bank without passing through the payment screen. That is the `pagador` field of `POST /v1/pagos`, and its fields are in [create a charge](/en/create-a-charge).

> **It is enabled now.** Until November 2026 this field was accepted and ignored, and the buyer ended up on the payment screen anyway. Today the `checkoutUrl` you get with `pagador` points at the bank's page.

Two fields of that object are specific to PSE: `bancoCodigo`, which comes from the list above, and `tipoPersona` — `natural` or `juridica` — because a company pays from a corporate account and its bank asks for a separate authorisation.

### What you gain and what you take on

You gain the jump: the buyer does not see an in-between page on another domain with another design, which is where part of the purchases are lost.

You take on the data. Your buyer's document, email, mobile and address pass through **your** server, and that makes you responsible for them: keeping them out of your logs, not storing what you do not need, answering if they leak. With the payment screen none of that is yours — we receive them, forward them to the gateway and do not store them.

This is not a design decision. It is deciding whether you want to carry personal data belonging to people who are not your customers yet.

### The form

The least it has to collect. The options in the first `select` come from `GET /v1/pagos/bancos`, the list above. The HTML is in Spanish because the person filling it in is your Colombian buyer:

```html
<form method="post" action="/pagar">
  <label for="bancoCodigo">Tu banco</label>
  <select id="bancoCodigo" name="bancoCodigo" required>
    <option value="">Elige tu banco</option>
  </select>

  <label for="tipoPersona">¿Quién paga?</label>
  <select id="tipoPersona" name="tipoPersona" required>
    <option value="natural">Una persona</option>
    <option value="juridica">Una empresa</option>
  </select>

  <label for="nombre">Nombre completo</label>
  <input id="nombre" name="nombre" required />

  <label for="tipoDocumento">Documento</label>
  <select id="tipoDocumento" name="tipoDocumento" required>
    <option>CC</option>
    <option>CE</option>
    <option>NIT</option>
    <option>PA</option>
  </select>

  <label for="documento">Número</label>
  <input id="documento" name="documento" inputmode="numeric" required />

  <label for="correo">Correo</label>
  <input id="correo" name="correo" type="email" required />

  <label for="telefono">Celular</label>
  <input id="telefono" name="telefono" inputmode="tel" maxlength="10" required />

  <label for="direccion">Dirección</label>
  <input id="direccion" name="direccion" maxlength="64" required />

  <button type="submit">Pagar</button>
</form>
```

Ask for the name even though the bank identifies by document: the gateway requires it for PSE and without it the charge never arrives. If you already have it on the order, use it and do not ask again.

### The call, from your server

The form does **not** call the API: the key cannot touch the browser. Your server receives the `POST`, builds the charge and redirects.

```bash
curl -X POST https://api.evetev.com/v1/pagos \
  -H "Authorization: Bearer evpk_tu_llave" \
  -H "Idempotency-Key: pedido-4417" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "tu-merchant-id",
    "monto": 89000,
    "moneda": "COP",
    "referencia": "pedido-4417",
    "urlRetorno": "https://tutienda.co/pedidos/4417/gracias",
    "pagador": {
      "bancoCodigo": "1007",
      "tipoPersona": "natural",
      "nombre": "Ana María Restrepo",
      "tipoDocumento": "CC",
      "documento": "1020304050",
      "correo": "quien@compra.co",
      "telefono": "3001234567",
      "direccion": "Calle 72 # 10-34"
    }
  }'
```

The `checkoutUrl` in the response goes straight to the bank's page. You redirect there and carry on as always: what decides whether you ship is [the notice](/en/webhooks), not the buyer coming back.

### What you must validate before sending it

If a field does not comply, the API answers `400` and the charge is not created. Validating in your form saves you that trip:

| Field           | Rule                                     | The most common mistake                                  |
| --------------- | ---------------------------------------- | -------------------------------------------------------- |
| `bancoCodigo`   | From `GET /v1/pagos/bancos`, up to 20    | Leaving it empty because the `select` was not `required` |
| `tipoPersona`   | `natural` or `juridica`                  | Sending `persona` or `empresa`                           |
| `tipoDocumento` | `CC`, `CE`, `NIT` or `PA`                | Sending it in lower case                                 |
| `documento`     | Between 4 and 20 characters              | Sending it with thousands separators                     |
| `correo`        | An email, up to 150                      | —                                                        |
| `telefono`      | Between 7 and 10 digits, **without +57** | `+57 300 1234567`, which is how it is said here          |
| `direccion`     | Between 3 and 64 characters              | Going over 64 with an address that has a district        |
| `nombre`        | Between 3 and 200. Required              | Leaving it out: it was optional until November 2026      |

> **The key stays on your server.** If the form called the API from the browser, anyone who opens the inspector takes your key and can charge in your name. It is the most expensive mistake when integrating a gateway, and no error warns you about it: it works perfectly until someone looks.

## When the buyer comes back

They return to the page you registered, or to the `urlRetorno` you sent. **That return does not tell you whether they paid**: the redirect arrives without a single parameter — we checked it by paying for real against the gateway — so that page does not even know which charge it was.

What decides is the `payment.completed` webhook. It is covered in full in [receiving the notice](/en/webhooks).

## If they do not finish at the bank

The charge stays `pendiente`, and there it stays: **there is no expiry event** and no notice that the buyer walked away. That is PSE's nature, which is asynchronous: minutes can pass between leaving your site and the bank confirming.

What solves it is querying `GET /v1/pagos/:id` in a periodic sweep of the orders that have been `pendiente` for hours. Polling in a loop is not needed.

## Testing it without charging

The test key returns the bank list with the exact shape of the real one, without calling the gateway, and it includes **BANKA**, the test bank.

You complete the payment yourself with `POST /v1/pagos/:id/simular`, and the webhook arrives signed just as in production. It is covered in [testing without charging](/en/testing).
