Skip to main content

Documentation Index

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

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

Once a buyer has uploaded their payment proof via Upload Proof, the seller who owns one of the products in the cart can call this endpoint to update the confirmed_payment status. The controller first validates that shoppingCartId is a well-formed MongoDB ObjectId, then verifies the cart exists, and finally checks that the authenticated user’s _id matches the user._id of at least one product in the cart’s products array — confirming they are the seller. When the payment is fully confirmed (key: 1, name: "Pago"), the server also decrements minCant via a ShoppingCart.findOneAndUpdate call targeted at the matching product subdocument’s _id, reducing the available quantity by the cart’s cantBuy value.

Method and path

POST /api/shopping-cart/update-payment/:shoppingCartId/confirmed

Authentication

A valid JWT must be passed in the token-access request header. The authenticated user must be the seller — their _id must appear as products[n].user._id inside the specified cart. The buyer cannot call this endpoint to self-approve their own payment.
HeaderRequiredDescription
token-access✅ YesJWT of the product owner (seller)
Buyers are blocked from confirming their own payments. If the authenticated user’s _id does not match any products[n].user._id in the cart, the API returns 403 No tienes permisos para esta función.

Path parameters

shoppingCartId
string
required
The MongoDB ObjectId of the shopping cart. The server calls mongoose.Types.ObjectId.isValid() on this value and returns 400 immediately if the format is invalid — before any database query is made.

Request body

confirmed_payment
object
required
Payment status object that will be set on the cart document via $set.
When confirmed_payment.key === 1 and confirmed_payment.name === "Pago", the server performs an additional write: it calls ShoppingCart.findOneAndUpdate({ _id: product._id }, { $inc: { minCant: -cantBuy } }) where product._id is the _id of the matching product subdocument inside the cart. This decrements minCant by the cart’s cantBuy value (always 1) to signal that one copy of the design has been consumed.

Responses

200 — Payment status updated

msj
string
"Compra validada correctamente"
status
boolean
true
paymentConfirmed
object
The Mongoose updateOne result object, containing:

Error responses

StatusmsjCause
403"Sin token"token-access header is missing
401"Token inexistente"JWT is invalid or expired
400"ID no válido"shoppingCartId is not a valid MongoDB ObjectId format
404"Carrito no encontrado"No ShoppingCart document matches shoppingCartId
403"No tienes permisos para esta función"Authenticated user is not a seller of any product in this cart
500(error object)Unexpected server error

Examples

Confirm payment

curl -X POST https://api.tukit.app/api/shopping-cart/update-payment/65a0b1c2d3e4f5a6b7c8d9e0/confirmed \
  -H "token-access: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "confirmed_payment": {
      "key": 1,
      "name": "Pago"
    }
  }'
Response
{
  "msj": "Compra validada correctamente",
  "status": true,
  "paymentConfirmed": {
    "acknowledged": true,
    "modifiedCount": 1,
    "upsertedId": null,
    "upsertedCount": 0,
    "matchedCount": 1
  }
}

Mark as pending

curl -X POST https://api.tukit.app/api/shopping-cart/update-payment/65a0b1c2d3e4f5a6b7c8d9e0/confirmed \
  -H "token-access: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "confirmed_payment": {
      "key": 2,
      "name": "Pago pendiente"
    }
  }'
Response
{
  "msj": "Compra validada correctamente",
  "status": true,
  "paymentConfirmed": {
    "acknowledged": true,
    "modifiedCount": 1,
    "upsertedId": null,
    "upsertedCount": 0,
    "matchedCount": 1
  }
}

Build docs developers (and LLMs) love