Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/ecommerce-delivery/llms.txt

Use this file to discover all available pages before exploring further.

After placing an order, the buyer must upload a payment proof image (e.g., a bank transfer screenshot) to allow administrators to verify the payment. This endpoint accepts a multipart/form-data request containing the image file(s), updates the sale’s status to Validando (Under review), records the current date as dateproof, and sends an FCM push notification to every administrator with an active device token. Both the buyer who owns the order and any admin user are permitted to call this endpoint.
The endpoint URL contains a deliberate typo in the original source: it is /laod-proof/ (not /load-proof/). Use the URL exactly as shown.

Endpoint

POST /api/sale/laod-proof/:saleId

Authentication

Requires a valid user Token in the request headers. The authenticated user must either own the sale (userId match) or have an admin role (roles.value === "2").

Path Parameters

saleId
string
required
The MongoDB ObjectId of the sale to attach the payment proof to.

Request Body

This endpoint uses multipart/form-data encoding.
imgPay
file[]
required
One or more image files representing the payment proof (e.g., a bank transfer receipt or payment screenshot). The server stores them under storage/sale/ with a randomised filename prefix.

Side Effects

Status Update

The sale document is updated with:
  • imgPay — array of stored image paths
  • dateproof — current date formatted as YYYY-M-D
  • status — set to { name: "Validando", value: "4" }

FCM Push Notification (Admin Broadcast)

A push notification is sent to all admin users who have an active FCM token registered:
FieldValue
title"Nuevo comprobante de pago"
body"El usuario {name_client} con codigo {codeSale} subio su comprobante de pago"
data.saleIdThe saleId from the path parameter
data.type"dateproof_update"

Response

200 — Proof uploaded successfully

{
  "msj": "Excelente, en estos momentos estamos validando tu pago, te notificaremos por correo electrónico cuando tu pago haya sido validado",
  "status": true,
  "newSale": {
    "_id": "664a1f2e9b3c4d001e2f3a10",
    "userId": "663f8e1c2a4b5d001a9c7b22",
    "codeSale": "SALE-20240519-4821",
    "status": { "name": "Validando", "value": "4" },
    "imgPay": ["42shirt_receipt.jpg"],
    "dateproof": "2024-5-20",
    "name_client": "Ana",
    "total": 89.98
  }
}
The newSale field in the response contains the sale document before the update was applied (MongoDB findOneAndUpdate without { new: true }). The updated document can be retrieved via the list endpoints.

403 — Permission denied

{ "msj": "No tienes permisos para esta funcion", "status": false }

404 — Sale not found

{ "msj": "Compra no encontrada", "status": false }

Example Request

curl -X POST https://your-api.com/api/sale/laod-proof/664a1f2e9b3c4d001e2f3a10 \
  -H "Authorization: Bearer <your_token>" \
  -F "imgPay=@/path/to/payment_receipt.jpg"

Build docs developers (and LLMs) love