API - Oversikt

API - Bestillinger

Hent kundebestillinger, oppdater statuser og antall, og slett bestillinger.

Endepunktoversikt

MetodeEndepunktBeskrivelseTilgang
GET/public-api/v1/customer-ordersReturnerer en paginert og filtrerbar liste med kundebestillinger.orders:read
GET/public-api/v1/customer-orders/:idReturnerer én kundebestilling med konfigurerte produktlinjer.orders:read
POST/public-api/v1/customer-orders/batchReturnerer opptil 100 bestillinger etter ID.orders:read
PATCH/public-api/v1/customer-orders/:id/statusOppdaterer bestillingsstatusen.orders:write
PATCH/public-api/v1/customer-orders/:orderId/quantityOppdaterer antallet for valgte bestillingsdetaljer.orders:write
PATCH/public-api/v1/customer-orders/:orderId/quantity/allAngir samme antall for hver vare i en bestilling.orders:write
DELETE/public-api/v1/customer-orders/:idSletter en kundebestilling som tilhører butikkeieren.orders:write

Kundebestillinger

Endepunkter for kundebestillinger lar en ekstern butikk lese konfigurerte bestillingslinjer, oppdatere antall, endre behandlingsstatus og fjerne forlatte bestillinger.

ParameterPåkrevdDetaljer
nameneiSøker i designnavn og numerisk bestillings-ID.
category_idneiFiltrerer etter produktkategori-ID.
order_statusneiEn av de tillatte bestillingsstatusene.
offsetneiStandard 0. Må være >= 0.
limitneiStandard 9 for denne kontrolleren, maksimalt 50.
order_byneiid, created_at eller design_name.
directionneiASC eller DESC.

Eksempelforespørsel (fetch)

const params = new URLSearchParams({
  limit: '20',
  offset: '0',
  order_status: 'shopping_cart',
  order_by: 'created_at',
  direction: 'DESC'
});

const orders = await alterFetch(`/customer-orders?${params.toString()}`);

const order = await alterFetch('/customer-orders/123');

const batch = await alterFetch('/customer-orders/batch', {
  method: 'POST',
  body: JSON.stringify({
    customerOrderIds: [123, 124, 125]
  })
});

Tillatte verdier

StatusBeskrivelse
shopping_cartHandlekurvfase; kunden kan fortsatt redigere konfigurasjonen.
editableBestillingen kan fortsatt redigeres av kunden.
paidBestillingen er betalt og klar til behandling.
processingBestillingen er under behandling.
completedBestillingen er ferdig behandlet.
cancelledBestillingen ble kansellert.

Eksempelforespørsel (fetch)

await alterFetch('/customer-orders/123/status', {
  method: 'PATCH',
  body: JSON.stringify({
    status: 'processing'
  })
});

await alterFetch('/customer-orders/123/quantity', {
  method: 'PATCH',
  body: JSON.stringify({
    items: [
      { orderDetailId: 987, quantity: 3 }
    ]
  })
});

await alterFetch('/customer-orders/123/quantity/all', {
  method: 'PATCH',
  body: JSON.stringify({
    quantity: 2
  })
});

await alterFetch('/customer-orders/123', {
  method: 'DELETE'
});

Eksempelsvar

{
  "order": {
    "id": 123,
    "customizerId": 381,
    "orderStatus": "shopping_cart",
    "createdAt": "2026-05-28T10:15:00.000Z",
    "customizerOrderURL": "https://alterproduct.com/app/customizer/381/123",
    "productItems": [
      {
        "id": 987,
        "model3d": { "id": 381 },
        "size": {
          "id": 395,
          "name": { "pl": "M", "en": "M" },
          "measureSize": null
        },
        "material": {
          "id": 2,
          "name": { "pl": "Bawełna", "en": "Cotton" }
        },
        "printType": {
          "id": 1,
          "name": { "pl": "DTG", "en": "DTG" }
        },
        "color": {
          "id": 418,
          "name": { "pl": "Domyślny", "en": "Default" },
          "hex": "#ffffff"
        },
        "variant": {
          "id": 531,
          "metadata": null,
          "stockQuantity": 25
        },
        "unitPrice": { "value": 12.5, "currency": "EUR" },
        "totalPrice": { "value": 37.5, "currency": "EUR" },
        "quantity": 3
      }
    ],
    "customizerName": "Men's T-Shirt",
    "productGroup": {
      "id": 4,
      "name": { "pl": "Koszulka", "en": "T-Shirt" }
    },
    "totalPrice": { "value": 37.5, "currency": "EUR" }
  }
}