P2P
Chat P2P
Obtener y enviar mensajes en el chat de una oferta P2P.
GET /p2p/:uuid/chat
Obtiene los mensajes del chat asociado a una oferta P2P.
Autenticación
Bearer Token (Authorization: Bearer <token> en headers).
Request
curl -X GET "https://api.qvapay.com/p2p/7c9e6679-7425-40de-944b-e07fc1f90ae7/chat" \
-H "Authorization: Bearer <token>"Parámetros (URL)
| Parámetro | Tipo | Requerido | Descripción |
|---|---|---|---|
uuid | string | Sí | UUID de la oferta P2P |
Response (200)
{
"message": "chat",
"chat": [
{
"id": "1",
"p2p_id": "123",
"peer_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "Hola, ya realicé la transferencia",
"image": null,
"created_at": "2024-06-20T14:35:00.000Z",
"updated_at": "2024-06-20T14:35:00.000Z",
"is_moderator": false,
"moderator_name": null
}
]
}POST /p2p/:uuid/chat
Envía un mensaje de texto o imagen al chat de la oferta P2P. Solo los participantes (creador y peer) pueden enviar mensajes.
Request (mensaje de texto)
curl -X POST "https://api.qvapay.com/p2p/7c9e6679-7425-40de-944b-e07fc1f90ae7/chat" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"message": "Ya realicé la transferencia"
}'Request (imagen)
curl -X POST "https://api.qvapay.com/p2p/7c9e6679-7425-40de-944b-e07fc1f90ae7/chat" \
-H "Authorization: Bearer <token>" \
-F "[email protected]" \
-F "message=Aquí está el comprobante"Parámetros (body JSON - mensaje de texto)
| Parámetro | Tipo | Requerido | Descripción |
|---|---|---|---|
message | string | Sí | Mensaje de texto (máx. 599 caracteres) |
Parámetros (FormData - imagen)
| Parámetro | Tipo | Requerido | Descripción |
|---|---|---|---|
file | File | Sí | Imagen a enviar (JPG, PNG o GIF) |
message | string | No | Mensaje acompañando la imagen (máx. 599 caracteres) |
Las imágenes se redimensionan automáticamente a un máximo de 1000x1000 px.
Response (200)
{
"message": "12345"
}El campo message contiene el ID del mensaje creado.
Errores
| Código | Descripción |
|---|---|
400 | P2P no habilitado, mensaje requerido, formato de archivo inválido, o mensaje excede 599 caracteres |
401 | Token de autenticación inválido o ausente |
403 | No eres participante de esta oferta |
404 | Oferta P2P no encontrada |
500 | Error al subir la imagen |