> For the complete documentation index, see [llms.txt](https://docs.payvalida.com/api-deuna/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payvalida.com/api-deuna/metodo/creacion-de-qr.md).

# Creación de QR

## Entornos disponibles

* **Producción**: `https://api.payvalida.com/api/v4/merchants/qr/deuna`
* **Sandbox**: `https://api-test.payvalida.com/api/v4/merchants/qr/deuna`

Todas las peticiones deben autenticarse mediante un **checksum** (query parameters), el cual se construye utilizando el algoritmo `SHA-512` con la siguiente estructura:

```
checksum = SHA512(merchant + order + timestamp + fixedhash)
```

Donde:

* `merchant`: Nombre del comercio asignado por Payválida.
* `order`: Identificador único de la orden asignada por el comercio
* `timestamp`: Marca de tiempo en formato ISO 8601 (Ejemplo: 2025-06-09T15:29:35.437Z)
* `fixedhash`: Valor fijo confidencial proporcionado al comercio por Payválida.

{% hint style="danger" %}
Es fundamental mantener el `fixedhash` seguro. No debe ser expuesto en el frontend ni compartido con terceros.
{% endhint %}

***

#### Headers requeridos

```http
Content-Type: application/json
Accept: application/json
```

#### Parámetros de consulta (query parameters)

| Parámetro | Tipo   | Requerido | Descripción                                               |
| --------- | ------ | --------- | --------------------------------------------------------- |
| merchant  | string | Sí        | Identificador del comercio.                               |
| order     | string | Sí        | Identificador único de la orden asignado por el comercio. |
| timestamp | string | Sí        | Marca de tiempo en formato UNIX epoch.                    |
| checksum  | string | Sí        | SHA-512 de `merchant + order + timestamp + fixedhash`.    |

#### Ejemplo de solicitud

```http
GET https://api-test.payvalida.com/api/v4/merchants/qr/deuna?merchant=kuanto&order=ordenpago123&timestamp=2025-06-09T15:29:35.437Z&checksum=abc123...
Content-Type: application/json
Accept: application/json
```

#### Respuesta exitosa

```json
{
  "CODE": "0000",
  "DESC": "OK",
  "DATA": {
    "qr": "data:image/png;base64,iVBORw0KGgoAAA.....=",
    "deepLink": "https://pagar.deuna.app/H91/merchant?id=MD1Y7HWEV"
  }
}
```

#### Campos de la respuesta

* `CODE`: Código de respuesta. `"0000"` indica éxito.
* `DESC`: Descripción del resultado.
* `DATA.qr`: Imagen QR codificada en Base64 que puede ser utilizada directamente en un tag HTML `<img>`.
* `DATA.deepLink`: URL deeplink que redirige a la app DeUna para completar el pago.

***

#### Ejemplo en cURL

```bash
curl -X GET "https://api-test.payvalida.com/api/v4/merchants/qr/deuna?merchant=kuanto&order=ordenpago123&timestamp=2025-06-09T15:29:35.437Z&checksum=abc123... \
  -H "Content-Type: application/json" \
  -H "Accept: application/json"
```

***

### Posibles errores

La API puede responder con los siguientes códigos de error en caso de solicitudes malformadas o fallas internas. Todos los errores mantienen la misma estructura de respuesta, cambiando los valores de `CODE` y `DESC`.

#### Formato de error

```json
{
  "CODE": "0001",
  "DESC": "Invalid body"
}
```

#### Tabla de errores

| CODE | DESC                  | Descripción                                               |
| ---- | --------------------- | --------------------------------------------------------- |
| 0001 | Invalid body          | La estructura de los parámetros enviados no es válida.    |
| 0002 | Internal server error | Error interno del servidor. Intente nuevamente más tarde. |


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.payvalida.com/api-deuna/metodo/creacion-de-qr.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
