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

# Obtener Método de Pago

> Recuperar una entidad de método de pago por ID — en el modelo de entidades gu1 para tarjetas, cuentas y billeteras, con ejemplos para get.

## Descripción General

Recupera información detallada sobre una entidad de método de pago específica incluyendo sus datos, relaciones y metadatos.

## Endpoint

```
GET http://api.gu1.ai/entities/{id}
```

## Autenticación

Requiere una clave API válida en el encabezado de Autorización:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Parámetros de Ruta

<ParamField path="id" type="string" required>
  UUID de la entidad de método de pago a recuperar
</ParamField>

## Ejemplos de Solicitudes

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "http://api.gu1.ai/entities/payment-method-uuid-123" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'http://api.gu1.ai/entities/payment-method-uuid-123',
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const paymentMethod = await response.json();
  console.log(paymentMethod.entityData.paymentMethod);
  ```

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

  response = requests.get(
      'http://api.gu1.ai/entities/payment-method-uuid-123',
      headers={
          'Authorization': 'Bearer YOUR_API_KEY'
      }
  )

  payment_method = response.json()
  print(payment_method['entityData']['paymentMethod'])
  ```
</CodeGroup>

## Respuesta

<ResponseField name="success" type="boolean">
  Si la solicitud fue exitosa
</ResponseField>

<ResponseField name="id" type="string">
  UUID de la entidad de método de pago
</ResponseField>

<ResponseField name="entityType" type="string">
  Siempre `"payment_method"`
</ResponseField>

<ResponseField name="entityData" type="object">
  Datos del método de pago

  <Expandable title="propiedades">
    <ResponseField name="paymentMethod" type="object">
      Detalles del método de pago (la estructura varía según el tipo)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="relationships" type="array">
  Array de relaciones con otras entidades (propietarios, transacciones, dispositivos)
</ResponseField>

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

<ResponseField name="riskScore" type="number">
  Puntuación de riesgo calculada (si se analizó)
</ResponseField>

<ResponseField name="riskFactors" type="array">
  Array de factores de riesgo identificados
</ResponseField>

<ResponseField name="createdAt" type="string">
  Marca de tiempo ISO 8601 de la creación
</ResponseField>

<ResponseField name="updatedAt" type="string">
  Marca de tiempo ISO 8601 de la última actualización
</ResponseField>

## Ejemplos de Respuesta

### Respuesta de Tarjeta de Crédito

```json theme={null}
{
  "success": true,
  "id": "payment-method-uuid-123",
  "entityType": "payment_method",
  "entityData": {
    "paymentMethod": {
      "type": "credit_card",
      "last4": "4242",
      "brand": "visa",
      "expiryMonth": "12",
      "expiryYear": "2025",
      "holderName": "John Doe",
      "issuerCountry": "BR",
      "bin": "424242",
      "funding": "credit",
      "fingerprint": "abc123xyz"
    }
  },
  "relationships": [
    {
      "targetEntityId": "person-uuid-123",
      "relationshipType": "owns",
      "strength": 1.0,
      "metadata": {
        "since": "2024-01-15"
      }
    }
  ],
  "riskScore": 15,
  "riskFactors": [
    {
      "type": "high_velocity",
      "severity": "low",
      "description": "Múltiples transacciones en corto período de tiempo"
    }
  ],
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-12-23T10:00:00.000Z"
}
```

### Respuesta de Cuenta Bancaria

```json theme={null}
{
  "success": true,
  "id": "payment-method-uuid-456",
  "entityType": "payment_method",
  "entityData": {
    "paymentMethod": {
      "type": "bank_account",
      "accountNumber": "12345-6",
      "accountType": "checking",
      "bank": "Banco do Brasil",
      "currency": "BRL",
      "routingNumber": "001",
      "holderName": "John Doe"
    }
  },
  "relationships": [
    {
      "targetEntityId": "person-uuid-123",
      "relationshipType": "owns",
      "strength": 1.0
    }
  ],
  "riskScore": 5,
  "riskFactors": [],
  "createdAt": "2024-01-15T10:00:00.000Z",
  "updatedAt": "2024-12-23T10:00:00.000Z"
}
```

## Casos de Uso

### Obtener Método de Pago con Detalles del Propietario

```javascript theme={null}
async function getPaymentMethodWithOwner(paymentMethodId) {
  // Obtener método de pago
  const pmResponse = await fetch(
    `http://api.gu1.ai/entities/${paymentMethodId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const paymentMethod = await pmResponse.json();

  // Obtener propietario (primera relación)
  const ownerRelationship = paymentMethod.relationships.find(
    r => r.relationshipType === 'owns'
  );

  if (ownerRelationship) {
    const ownerResponse = await fetch(
      `http://api.gu1.ai/entities/${ownerRelationship.targetEntityId}`,
      {
        headers: {
          'Authorization': 'Bearer YOUR_API_KEY'
        }
      }
    );

    const owner = await ownerResponse.json();

    return {
      paymentMethod,
      owner
    };
  }

  return { paymentMethod };
}
```

### Verificar Historial de Transacciones del Método de Pago

```javascript theme={null}
async function getPaymentMethodTransactions(paymentMethodId) {
  // Obtener todas las transacciones vinculadas a este método de pago
  const response = await fetch(
    `http://api.gu1.ai/entities?entityType=transaction&relationshipWith=${paymentMethodId}`,
    {
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const { entities } = await response.json();

  return entities;
}
```

## Respuestas de Error

### 404 No Encontrado

```json theme={null}
{
  "error": "Entidad no encontrada",
  "entityId": "payment-method-uuid-123"
}
```

### 401 No Autorizado

```json theme={null}
{
  "error": "Clave API inválida o faltante"
}
```

## Ver También

* [Crear Método de Pago](/es/api-reference/payment-methods/create)
* [Actualizar Método de Pago](/es/api-reference/payment-methods/update)
* [Listar Métodos de Pago](/es/api-reference/payment-methods/list)
* [Analizar Método de Pago](/en/api-reference/entities/analyze)
