# Consulta por referencia

Esta consulta te permite obtener información detallada de una transacción específica utilizando su código de identificación. Cada transacción está vinculada a un comercio, por lo que es importante que el código de transacción coincida con tu comercio, de lo contrario no recibirás un resultado exitoso.

{% hint style="info" %}
El **`external_reference`** es un identificador único asignado a cada transacción, siendo esta la forma en que se distinguen en Trazo.
{% endhint %}

## Ruta

<mark style="color:green;">`GET`</mark> `/v1/merchant/transaction/{external_reference}`

## Cuerpo

| Name                                                   | Value            |
| ------------------------------------------------------ | ---------------- |
| `Content-Type`                                         | application/json |
| `x-auth-token`*<mark style="color:red;">**\***</mark>* | {token}          |
| `child-id`                                             | {business\_id}   |

{% hint style="info" %}
El child-id es opcional y se usa para las cuentas administradas para conocer más puedes ingresa a este [enlace](https://docs.qentaz.com/documentation/terminos-de-relevancia#cuentas-administradas).
{% endhint %}

## Respuesta

{% tabs %}
{% tab title="200" %}

```json
{
    "external_reference": "61BUD1R4A",
    "process_id": "62d61cb6-acec-4ee6-96ba-d3d278b56846",
    "description": "Descripción Transacción (con recargo)",
    "status": "CREATED",
    "amount": 1000,
    "expected_amount": 100000,
    "channel": "WHATSAPP",
    "currency": "COP",
    "reference_one": "Referencia 1",
    "reference_two": "Referencia 2",
    "reference_three": "Referencia 3",
    "reference_four": "Referencia 4",
    "reference_five": "Referencia 5",
    "reference_six": "Referencia 6",
    "reference_seven": "Referencia 7",
    "reference_eight": "Referencia 8",
    "expiration": false,
    "attachment": null,
    "comments": null,
    "payment_method": null,
    "payment_provider_source": null,
    "receipt_image": null,
    "type": "inmediato",
    "source": "api",
    "merchant": {
        "name": "DIEGO PEREZ",
        "phone": "573110011111",
        "email": "diego@gmail.com",
        "id_number": "1000011111",
        "id_type": "CC"
    },
    "payer": {
        "name": "ALEJANDRO PEREZ",
        "phone": "573110011111",
        "email": "diego@gmail.com",
        "id_number": "1000011111",
        "id_type": "CC"
    }
    "affiliate": {
        "name": "ALEJANDRO PEREZ",
        "id_number": "1000011111",
        "id_type": "CC"
    },
    "invoice": {
        "provider": null,
        "type": null,
        "id": null,
        "retentions": null,
        "url": null,
        "voucher": null
    },
    "fees": {
        "service_fee": null,
        "service_variable": null,
        "service_iva": null,
        "service_saas": null,
        "fee_settled": null,
        "saas_settled": null
    },
    "late_fees": [
        {
            "id": 7018,
            "date": "2025-06-15",
            "value": 1000,
            "reminder": true,
            "reminder_template": "credit_late_fee_2"
        },
        {
            "id": 7019,
            "date": "2025-06-27",
            "value": 1000,
            "reminder": true,
            "reminder_template": "credit_late_fee_3"
        }
    ],
    "advance_payments": null,
    "payout_process_status": false,
    "payout_process_id": null,
    "return_review_reason": null,
    "return_success_reason": null,
    "cash_manual_process_status": false,
    "cash_manual_reason": null,
    "limit_date": "2025-05-22",
    "expected_date": null,
    "created_at": "2025-05-07T16:31:56.503Z",
    "updated_at": "2025-06-17T15:47:45.983Z"
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "error": "No information was found for the requested query."
}
```

{% endtab %}
{% endtabs %}

## Ejemplo

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET '{{base_url}}/v1/merchant/transaction/{external_reference}' \
--header 'x-auth-token: {{token}}' \
--data-raw ''
```

{% endtab %}

{% tab title="NodeJs (Axios)" %}

```javascript
var axios = require('axios');
var data = '';

var config = {
  method: 'get',
  url: `${base_url}/v1/merchant/transaction/${external_reference}`,
  headers: { 
    'x-auth-token': token //Agregar token
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = f"{base_url}/v1/merchant/transaction/{external_reference}"

payload = ""
headers = {
  'x-auth-token': token #Agregar token
}

response = requests.request("DELETE", url, headers=headers, data=payload)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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.qentaz.com/documentation/cobros/consultar-cobro/consulta-por-referencia.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.
