> ## Documentation Index
> Fetch the complete documentation index at: https://strapi-suite.littlebox.pt/llms.txt
> Use this file to discover all available pages before exploring further.

# Shipping

> Quote shipping methods, pickup points and store pickup.

## Markets and Destinations

The store sells only to its **markets** (Settings → General). A manual shipping method has weight brackets per market. A carrier such as CTT or DPD gets its price from the carrier API. Strapi offers a method only when the cart weight (each variant's weight times its quantity) fits its brackets for the destination.

* Send a `destination` in the quote to get `shippingOptions`. Ask for the country first, and for the postal code too when you can: some markets depend on it.
* A country outside the markets, or one no method serves, returns `shippingOptions: []`. That is not an error: tell the customer the store does not ship there.
* With a `shippingMethod` set, a country outside the markets answers `400 invalid_country` on `shipping.country`, and a method that does not serve the destination answers `400 SHIPPING_UNAVAILABLE`.
* `PT-ISL` (Portugal islands: Azores and Madeira, postal codes starting with `9`) is a market, never an address country. Keep `country: "PT"` in addresses and destinations, and always send `destination.postalCode` for Portugal so Strapi finds the right market and price.
* A carrier that fails or times out simply leaves its options out of the list.

> [!NOTE]
>
> The API has no endpoint that lists the markets. Keep the list of countries your checkout offers in your frontend
> configuration, in line with the markets set in the admin, and rely on `shippingOptions: []` for the rest.

## Choose a Shipping Method

1. Quote with `destination`.
2. Show `shippingOptions` (name, price, `estimatedDays` when not `null`).
3. Quote again with the chosen `{ providerId, serviceId }` as `shippingMethod`.
4. Read `selectedShipping` and the new `totals`. Shipping promotions apply only now.

Every listed price is the price the order is charged, because Strapi prices the options on this exact cart (gifts included).

## Pickup Options

Two kinds of options need a pickup point. Both carry `requiresPickupPoint: true`:

* **Store pickup** (`providerId: "store-pickup"`, `serviceId: "STORE"`). The option itself carries `pickupPoints`: the store's shops for the customer's market (up to 100, no opening hours). Let the customer choose one.
* **DPD Pickup** (`providerId: "dpd-portugal"`, `serviceId: "PICKUP"`). The option has no `pickupPoints`: search them with `GET /shipping/pickup-points`.

The rule for your UI: if the option has `pickupPoints`, show that list. Otherwise, search the DPD points.

## Search DPD Pickup Points

`GET /shipping/pickup-points?postalCode=1000-001&country=PT`

Session: any guest or login session (in guest only mode, a guest session). Rate limit: `cart.quote`.

| Query | Description |
| - | - |
| `postalCode` | Required. `NNNN-NNN` or `NNNNNNN`. |
| `country` | Optional, must be `PT`. |

```json Response 200 theme={null}
{
  "points": [
    {
      "id": "PT12345",
      "name": "Corner Shop",
      "address": "Rua Augusta 1",
      "address2": null,
      "postalCode": "1100-048",
      "city": "Lisboa",
      "country": "PT",
      "openingHours": [
        { "day": 1, "from": "09:00", "to": "13:00" },
        { "day": 1, "from": "14:00", "to": "19:00" }
      ]
    }
  ]
}
```

`day` runs from 1 to 7 (DPD's day number) and a day can have several intervals. No point near the code returns `points: []`. Strapi caches answers in memory per postal code for 10 minutes.

| Status | Code | When |
| - | - | - |
| 400 | `INVALID_POSTAL_CODE` | `postalCode` is missing or has the wrong format. |
| 400 | `PICKUP_NOT_AVAILABLE` | DPD Pickup is off, the country is not `PT`, or the postal code's market has no Pickup rates. |
| 502 | `PICKUP_SEARCH_FAILED` | DPD failed or did not answer in time. Retry. |

## Pickup at Checkout

With a pickup method, `POST /orders` needs `pickupPointId`:

* **DPD Pickup**: the `id` of a point from the search. Strapi confirms it by searching again with `pickupPostalCode` (the postal code the customer searched with) or, when absent, the shipping address postal code. Send `pickupPostalCode` whenever the customer searched with a code other than their own.
* **Store pickup**: the `id` of one of the option's `pickupPoints`. `pickupPostalCode` is ignored.

The order then ships to the point, with the customer's name and phone from `shippingAddress`. The shipping price is the price of the point's market, so **quote with the point's postal code as `destination`** before you place the order, or the totals may not match.

| Status | Code | Path | When |
| - | - | - | - |
| 400 | `PICKUP_POINT_REQUIRED` | `pickupPointId` | A pickup method without `pickupPointId`. |
| 400 | `PICKUP_POINT_INVALID` | `pickupPointId` | The search by that postal code does not return the id. |
| 400 | `INVALID_POSTAL_CODE` | `pickupPostalCode` or `shippingAddress.postalCode` | The searched code is not a Portuguese postal code. |
| 400 | `PICKUP_NOT_AVAILABLE` | `shipping` | Pickup is not available for that postal code. |
| 502 | `PICKUP_SEARCH_FAILED` | | DPD failed. Retry. Strapi never accepts an unconfirmed point. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.