Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JuanSCaicedo/Api-Ecommerce/llms.txt

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

Customers can retrieve a paginated list of all their past orders, look up an individual order by its unique transaction number, and manage saved shipping addresses. All endpoints require a valid Bearer token and return data scoped to the authenticated user.

GET /api/ecommerce/profile_client/orders

Returns a paginated list of all orders placed by the authenticated user, ordered by newest first (10 per page).
curl --request GET \
  --url "https://your-domain.com/api/ecommerce/profile_client/orders?page=1" \
  --header "Authorization: Bearer <token>"

Query parameters

ParameterTypeDefaultDescription
pageinteger1Page number for pagination.

Response

The sales value is wrapped in a data key by the SaleCollection resource.
{
  "sales": {
    "data": [
      {
        "id": 18,
        "user_id": 12,
        "method_payment": "bank_transfer",
        "currency_total": "COP",
        "currency_payment": "COP",
        "discount": null,
        "subtotal": 599800,
        "total": 599800,
        "price_dolar": null,
        "description": "Please deliver in the afternoon.",
        "n_transaccion": "TXN-20240610-00018",
        "sale_details": [ "..." ],
        "sale_address": { "...": "..." },
        "created_at": "2024-06-10 09:30 AM"
      }
    ]
  },
  "total": 5
}
sales
object
Object with a data array of sale (order) objects, 10 records per page.
total
integer
Total number of orders placed by the authenticated user across all pages.

Sale object fields

id
integer
Internal primary key of the sale record.
user_id
integer
ID of the authenticated user who placed the order.
n_transaccion
string
Unique transaction identifier. Used as the lookup key for GET /api/ecommerce/sale/{id}. For direct checkouts this is the n_transaccion value supplied by the client; for MercadoPago checkouts it is the MercadoPago payment_id.
method_payment
string
Payment method used, e.g. "bank_transfer", "mercadopago", "cash".
currency_total
string
Currency code of the order total, e.g. "COP".
currency_payment
string
Currency code used for the payment transaction.
discount
number | null
Order-level discount amount. null when not applicable.
subtotal
number
Order subtotal before additional fees.
total
number
Grand total charged for the order.
price_dolar
number | null
Dollar exchange rate at the time of purchase, if applicable.
description
string | null
Order notes or delivery instructions provided by the customer at checkout.
sale_details
array
Array of SaleDetail objects — one per cart item at the time of checkout. Each detail preserves the pricing, quantity, discount, variation, and coupon information that was active when the order was placed. Includes a review field if the customer has reviewed that item.
sale_address
object
Delivery address captured at checkout. See sale_address fields.
created_at
string
Order creation timestamp formatted as "YYYY-MM-DD hh:mm AM/PM".

GET /api/ecommerce/sale/

Returns the full details of a single order identified by its n_transaccion value.
The {id} path parameter is the n_transaccion string, not the numeric primary key. This allows customers to look up orders using the transaction reference shown in their confirmation email.
curl --request GET \
  --url https://your-domain.com/api/ecommerce/sale/TXN-20240610-00018 \
  --header "Authorization: Bearer <token>"

Path parameters

ParameterTypeDescription
idstringThe n_transaccion unique transaction identifier.

Response

{
  "sale": {
    "id": 18,
    "user_id": 12,
    "method_payment": "bank_transfer",
    "currency_total": "COP",
    "currency_payment": "COP",
    "discount": null,
    "subtotal": 599800,
    "total": 599800,
    "price_dolar": null,
    "description": "Please deliver in the afternoon.",
    "n_transaccion": "TXN-20240610-00018",
    "sale_details": [
      {
        "id": 35,
        "product_id": 42,
        "product": { "id": 42, "title": "Wireless Headphones Pro", "...": "..." },
        "product_variation_id": 11,
        "product_variation": { "...": "..." },
        "quantity": 2,
        "price_unit": 299900,
        "subtotal": 299900,
        "total": 599800,
        "currency": "COP",
        "type_discount": null,
        "discount": null,
        "type_campaing": null,
        "code_cupon": null,
        "code_discount": null,
        "created_at": "2024-06-10 09:30 AM",
        "review": null
      }
    ],
    "sale_address": {
      "id": 18,
      "sale_id": 18,
      "name": "María",
      "surname": "García",
      "phone": "+573001234567",
      "address": "Calle 123 # 45-67",
      "city": "Bogotá",
      "country_region": "Colombia",
      "street": "Avenida Principal",
      "postcode_zip": "110111",
      "email": "maria@example.com",
      "company": ""
    },
    "created_at": "2024-06-10 09:30 AM"
  }
}
sale
object
The full sale resource including all sale_details items and the associated sale_address delivery record.
sale.sale_details
array
Array of order line items. Each item mirrors the cart item structure (same fields as CartEcommerceResource) plus a review field containing any review the customer left for that product.
sale.sale_address
object
Delivery address captured at checkout.

n_transaccion — Transaction Identifier

n_transaccion is the unique transaction identifier stored on every Sale record.
  • Direct checkout: the client supplies n_transaccion in the POST /api/ecommerce/checkout request body (e.g. a bank transfer reference number). If omitted it remains null.
  • MercadoPago checkout: the client supplies the MercadoPago payment_id as n_transaccion in the POST /api/ecommerce/checkout-mercadopago request body.
Use n_transaccion as the lookup key when retrieving a specific order via GET /api/ecommerce/sale/{id}. It is also included in the SaleMail confirmation email sent to the customer.

Saved Shipping Addresses — /api/ecommerce/user_address

Customers can save multiple reusable shipping addresses to their account. All four CRUD operations are available. All endpoints require a valid Bearer token.

GET /api/ecommerce/user_address

Returns all saved addresses for the authenticated user, ordered by newest first.
curl --request GET \
  --url https://your-domain.com/api/ecommerce/user_address \
  --header "Authorization: Bearer <token>"
Response:
{
  "message": 200,
  "address": [
    {
      "id": 3,
      "user_id": 12,
      "name": "María",
      "surname": "García",
      "company": "",
      "country_region": "Colombia",
      "address": "Calle 123 # 45-67",
      "street": "Avenida Principal",
      "city": "Bogotá",
      "postcode_zip": "110111",
      "phone": "+573001234567",
      "email": "maria@example.com",
      "created_at": "2024-06-10T09:30:00.000000Z",
      "updated_at": "2024-06-10T09:30:00.000000Z"
    }
  ]
}

POST /api/ecommerce/user_address

Creates a new saved address. The user_id is set server-side from the Bearer token.
curl --request POST \
  --url https://your-domain.com/api/ecommerce/user_address \
  --header "Authorization: Bearer <token>" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "María",
    "surname": "García",
    "company": "",
    "country_region": "Colombia",
    "address": "Calle 123 # 45-67",
    "street": "Avenida Principal",
    "city": "Bogotá",
    "postcode_zip": "110111",
    "phone": "+573001234567",
    "email": "maria@example.com"
  }'
Body fields:
name
string
required
Recipient’s first name.
surname
string
required
Recipient’s last name.
company
string
Optional company name.
country_region
string
required
Country or region, e.g. "Colombia".
address
string
required
Primary street address, e.g. "Calle 123 # 45-67".
street
string
Additional address line / apartment.
city
string
required
City, e.g. "Bogotá".
postcode_zip
string
Postal or ZIP code.
phone
string
required
Contact phone number.
email
string
Contact email address for the delivery.
Response:
{
  "message": 201,
  "addres": {
    "id": 4,
    "user_id": 12,
    "name": "María",
    "surname": "García",
    "...": "..."
  }
}

PUT /api/ecommerce/user_address/

Updates an existing saved address by its numeric ID.
curl --request PUT \
  --url https://your-domain.com/api/ecommerce/user_address/3 \
  --header "Authorization: Bearer <token>" \
  --header "Content-Type: application/json" \
  --data '{
    "city": "Medellín",
    "postcode_zip": "050001"
  }'
Path parameters:
ParameterTypeDescription
idintegerThe saved address ID to update.
Response:
{
  "message": 200,
  "addres": { "id": 3, "city": "Medellín", "...": "..." }
}

DELETE /api/ecommerce/user_address/

Soft-deletes a saved address by its numeric ID.
curl --request DELETE \
  --url https://your-domain.com/api/ecommerce/user_address/3 \
  --header "Authorization: Bearer <token>"
Path parameters:
ParameterTypeDescription
idintegerThe saved address ID to delete.
Response:
{
  "message": 200
}
The UserAddres model uses soft deletes (SoftDeletes trait). Deleted addresses are not permanently removed from the database and will not be returned by the GET endpoint.

Build docs developers (and LLMs) love