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

# Ver cobro

> Este endpoint te permite obtener el detalle de un cobro.

<ParamField path="payment_id" type="string" required placeholder="9e5ccd4a-d2f0-49dd-87fc-a0da752bd166">
  ID del cobro creado previamente. [Ver cómo crear un cobro](/client/payments/create).
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.onepay.la/v1/payments/9e5ccd4a-d2f0-49dd-87fc-a0da752bd166 \
    -H "Authorization: Bearer sk_test_xxx"
  ```

  ```javascript JavaScript theme={null}
  const paymentId = '9e5ccd4a-d2f0-49dd-87fc-a0da752bd166';

  const response = await fetch(`https://api.onepay.la/v1/payments/${paymentId}`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer sk_test_xxx'
    }
  });
  const payment = await response.json();
  console.log(payment.status); // Estado del cobro
  console.log(payment.payment_link); // Link de pago
  ```

  ```python Python theme={null}
  import requests

  payment_id = "9e5ccd4a-d2f0-49dd-87fc-a0da752bd166"
  url = f"https://api.onepay.la/v1/payments/{payment_id}"
  headers = {
      "Authorization": "Bearer sk_test_xxx"
  }

  response = requests.get(url, headers=headers)
  payment = response.json()
  print(payment["status"])  # Estado del cobro
  print(payment["payment_link"])  # Link de pago
  ```

  ```php PHP theme={null}
  <?php
  $paymentId = "9e5ccd4a-d2f0-49dd-87fc-a0da752bd166";
  $ch = curl_init();

  curl_setopt_array($ch, [
      CURLOPT_URL => "https://api.onepay.la/v1/payments/{$paymentId}",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          "Authorization: Bearer sk_test_xxx"
      ]
  ]);

  $response = curl_exec($ch);
  $payment = json_decode($response, true);

  echo $payment["status"];  // Estado del cobro
  echo $payment["payment_link"];  // Link de pago

  curl_close($ch);
  ?>
  ```
</RequestExample>

### Response

<ResponseField name="id" type="string">
  Identificador único del cobro
</ResponseField>

<ResponseField name="source" type="string">
  Título del cobro (mismo valor que `title`)
</ResponseField>

<ResponseField name="currency" type="string">
  Código de moneda ISO (ej: `COP`)
</ResponseField>

<ResponseField name="amount" type="number">
  Monto del cobro en pesos
</ResponseField>

<ResponseField name="amount_label" type="string">
  Monto formateado (ej: `"$ 1.400.000"`)
</ResponseField>

<ResponseField name="title" type="string">
  Título del cobro
</ResponseField>

<ResponseField name="description" type="string">
  Descripción del cobro
</ResponseField>

<ResponseField name="phone" type="string">
  Número de teléfono del cliente
</ResponseField>

<ResponseField name="expiration_at" type="string">
  Fecha de expiración del cobro (ISO 8601)
</ResponseField>

<ResponseField name="due_date" type="string">
  Fecha de vencimiento (ISO 8601)
</ResponseField>

<ResponseField name="document_link" type="string">
  URL del documento adjunto
</ResponseField>

<ResponseField name="external_id" type="string">
  ID externo del cobro en tu sistema
</ResponseField>

<ResponseField name="allows" type="object">
  Métodos de pago habilitados para este cobro
</ResponseField>

<ResponseField name="status" type="string">
  Estado actual del cobro: `pending`, `approved`, `declined`, `cancelled`, `expired`, `in_progress`, `refunded`, `partially_paid`, `partial_expired`
</ResponseField>

<ResponseField name="is_test" type="boolean">
  Indica si el cobro fue creado en modo prueba
</ResponseField>

<ResponseField name="created_at" type="string">
  Fecha de creación (ISO 8601)
</ResponseField>

<ResponseField name="paid_at" type="string">
  Fecha de pago (ISO 8601). `null` si aún no ha sido pagado.
</ResponseField>

<ResponseField name="payment_link" type="string">
  URL del link de pago
</ResponseField>

<ResponseField name="redirect_url" type="string">
  URL de redirección tras el pago
</ResponseField>

<ResponseField name="provider_id" type="string">
  ID del proveedor de pago
</ResponseField>

<ResponseField name="metadata" type="object">
  Metadatos adicionales del cobro
</ResponseField>

<ResponseField name="customer" type="object">
  Datos del cliente que realizó el pago. `null` si aún no ha pagado.
</ResponseField>

<ResponseField name="method" type="object">
  Método de pago utilizado. `null` si aún no ha pagado.
</ResponseField>

<ResponseField name="splits" type="array">
  Reglas de split aplicadas al cobro
</ResponseField>

<ResponseField name="company" type="object">
  Datos de la empresa. Presente cuando se consulta con credenciales que incluyen la empresa.
</ResponseField>

<ResponseField name="commission" type="object">
  Comisión aplicada. `null` si no aplica.
</ResponseField>

<ResponseField name="partial_payment" type="object">
  Información de pago parcial. Solo presente cuando el cobro tiene `partial_payment_config` configurado. Ver [crear cobro](/client/payments/create) para detalle de campos.
</ResponseField>

### Response Example

<ResponseExample>
  ```json Cobro aprobado theme={null}
  {
    "id": "9bf2bc44-28d4-4693-9896-7fc1fe1f5b65",
    "source": "Factura Movistar Noviembre",
    "currency": "COP",
    "amount": 63040,
    "amount_label": "$ 63.040",
    "title": "Factura Movistar Noviembre",
    "description": "Factura Movistar Noviembre",
    "phone": "+573138977841",
    "expiration_at": "2024-05-03T16:47:09.000000Z",
    "due_date": null,
    "document_link": null,
    "external_id": null,
    "allows": {
      "cards": true,
      "accounts": true,
      "card_extra": false,
      "realtime": false,
      "pse": true,
      "transfiya": true
    },
    "status": "approved",
    "is_test": false,
    "created_at": "2024-05-02T16:47:09.000000Z",
    "paid_at": "2024-05-02T18:00:00.000000Z",
    "payment_link": null,
    "redirect_url": null,
    "provider_id": null,
    "metadata": null,
    "customer": {
      "id": "4e5f6a7b-8c9d-0e1f-2345-6789abcdef01",
      "first_name": "Juan",
      "last_name": "Demo",
      "email": "hola@onepay.la",
      "phone": "+573167591039",
      "document_type": "CC",
      "document_number": "1234567890",
      "created_at": "2024-04-01T10:00:00.000000Z",
      "is_test": false
    },
    "method": null,
    "splits": [],
    "company": null,
    "commission": null
  }
  ```

  ```json Pago parcial theme={null}
  {
    "id": "9e5ccd4a-d2f0-49dd-87fc-a0da752bd166",
    "source": "Suscripción Premium",
    "currency": "COP",
    "amount": 500000,
    "amount_label": "$ 500.000",
    "title": "Suscripción Premium",
    "description": null,
    "phone": "+573201112233",
    "expiration_at": "2025-04-20T22:36:24.000000Z",
    "due_date": null,
    "document_link": null,
    "external_id": null,
    "allows": {
      "cards": true,
      "accounts": true,
      "card_extra": false,
      "realtime": false,
      "pse": true,
      "transfiya": true
    },
    "status": "partially_paid",
    "is_test": false,
    "created_at": "2025-04-15T10:00:00.000000Z",
    "paid_at": null,
    "payment_link": "https://pagos.onepay.la/payment/9e5ccd4a-d2f0-49dd-87fc-a0da752bd166",
    "redirect_url": null,
    "provider_id": null,
    "metadata": null,
    "customer": null,
    "method": null,
    "splits": [],
    "company": null,
    "commission": null,
    "partial_payment": {
      "total_paid_in_cents": 20000000,
      "total_paid_label": "$ 200.000",
      "remaining_amount_in_cents": 30000000,
      "remaining_label": "$ 300.000",
      "progress_percentage": 40.0,
      "is_fully_paid": false,
      "min_amount_in_cents": 5000000,
      "max_amount_in_cents": null,
      "max_payment_methods": 3,
      "timeout_hours": 24,
      "partial_expires_at": "2025-04-16T10:00:00+00:00",
      "charges": [
        {
          "id": "3f8b7a21-1d4a-4d2e-8f1a-17e2f1e6b9ab",
          "amount_in_cents": 20000000,
          "amount_label": "$ 200.000",
          "payment_method_type": "account",
          "payment_method": "PSE - Bancolombia",
          "paid_at": "2025-04-15T10:30:00+00:00"
        }
      ]
    }
  }
  ```
</ResponseExample>
