Documentation Index
Fetch the complete documentation index at: https://mintlify.com/akibanks/api-tienda-vinilos/llms.txt
Use this file to discover all available pages before exploring further.
POST /checkout creates a complete purchase order from the authenticated user’s shopping cart. For each item the backend fetches current popularity stats from the Discogs API (have / want counts) and calculates the unit price server-side using the store’s pricing algorithm. Any precio field sent by the client is silently ignored. Orders are created immediately with status pagada.
Endpoint details
| Method | POST |
| Path | /checkout |
| Auth | JWT required (Authorization: Bearer <token>) |
Request body
items — cart items
A non-empty array of vinyl releases to purchase.
envio — shipping address
Shipping address for the order.
Example request
Response — 201 Created
Human-readable confirmation message.
Unique ID of the newly created order. Use this to look up the order later via
GET /mis-compras or GET /admin/ventas/:id.Order total formatted to exactly two decimal places (e.g.
"29.99"). Stored as a decimal in the database to avoid floating-point drift.Error responses
| Status | Condition | Error message |
|---|---|---|
400 | items is missing, not an array, or empty | "El carrito está vacío." |
400 | An item is missing discogs_id, titulo, or artista | "Cada ítem debe tener discogs_id, titulo y artista." |
400 | cantidad is not a positive integer | "La cantidad debe ser un entero positivo." |
400 | envio is missing any required field | "Los datos de envío son requeridos." |
401 | JWT is absent or malformed | "Token de autenticación requerido." |
401 | JWT is expired or invalid | "Token inválido o expirado. Vuelve a iniciar sesión." |
500 | Unexpected server or database error | "Error al procesar la compra." |
Order state
All orders created throughPOST /checkout start with status pagada. Admins can transition an order through its lifecycle via PUT /admin/ventas/:id/estado.
Valid status values:
| State | Meaning |
|---|---|
pendiente | Order placed but payment not confirmed |
pagada | Payment confirmed (default for all new orders) |
enviada | Order handed to the courier |
entregada | Order delivered to the recipient |
cancelada | Order cancelled |