Skroutz API Access Application no longer accepts requests.

Orders API Edit the file on GitHub

Orders API allows Skroutz Merchants to perform actions on their Smart Cart orders, such as accepting or rejecting an order.

You may find a high level overview of the service and descriptive guides for its activation in the merchant support guidelines.

Table of Contents

Setup

Obtaining an API token

In order to be able to use the API, you need to generate an API token from within Smart Cart settings page in merchant's panel (Merchants > Υπηρεσίες > Έξυπνο Καλάθι).

There can only be one active API key per shop at a certain time. Creating a new API key will expire any previous one.

Authorization

Pass in a valid API token in the Authorization header, prefixed with Bearer as in the following curl example.

A specific Accept header is also required. For more information on API requests check the API overview.

curl -X GET https://api.skroutz.gr/merchants/ecommerce/orders/191128-1234567 \
  -H 'Accept: application/vnd.skroutz+json; version=3.0' \
  -H 'Authorization: Bearer your_access_token_here'

Endpoints

All endpoints require the order code as a URL parameter. This is available in all incoming order Webhook events, as well as the merchants' panel.

Retrieve a single order

When an order is in a state that can be accepted or rejected, accept_options and reject_options attributes are included in the response, providing all the available options for issuing "accept" or "reject" requests for the order, respectively.

  GET /merchants/ecommerce/orders/:code

GET https://api.skroutz.gr/merchants/ecommerce/orders/191128-1234567

View Response
Show Headers
Status: 200
{
  "order": {
    "code": "191128-1234567",
    "state": "open",
    "comments": "User comments here",
    "courier_voucher": null,
    "line_items": [
      {
        "id": "opaoe8M3pZ",
        "shop_uid": "12456",
        "product_name": "Champion Hooded Sweatshirt M (212077-KK001)",
        "quantity": 1,
        "size": {
          "label": "Μέγεθος",
          "value": "L",
          "shop_value": "L"
        },
        "unit_price": 23.99,
        "total_price": 23.99
      }
    ],
    "created_at": "2019-11-28T13:24:37+02:00",
    "expires_at": "2019-12-04T10:24:00+02:00",
    "dispatch_until": "2019-12-04T18:00:00+02:00",
    "accept_options": {
      "number_of_parcels": [
        1
      ],
      "pickup_location": [
        {
          "id": "YlpD0KROym",
          "label": "Πανεπιστημίου 2, Τ.Κ. 12345, Αθήνα, Αττική"
        },
        {
          "id": "onpL6DXG4l",
          "label": "Σταδίου 1, Τ.Κ. 12345, Αθήνα, Αττική"
        },
        {
          "id": "wgO1N22OaQ",
          "label": "Κρήτης 50, Τ.Κ. 73100, Χανιά, Χανιά"
        }
      ],
      "pickup_window": [
        {
          "id": 1,
          "label": "15:00 - 18:00, Τρί 03/12/19"
        },
        {
          "id": 2,
          "label": "10:00 - 12:00, Τετ 04/12/19"
        },
        {
          "id": 3,
          "label": "12:00 - 15:00, Τετ 04/12/19"
        },
        {
          "id": 4,
          "label": "15:00 - 18:00, Τετ 04/12/19"
        }
      ]
    },
    "reject_options": {
      "line_item_rejection_reasons": [
        {
          "id": 1,
          "label": "Εκτός αποθέματος στο κατάστημα ή στον προμηθευτή",
          "requires_available_quantity": false
        },
        {
          "id": 2,
          "label": "Λάθος καταχωρημένη τιμή(ες)",
          "requires_available_quantity": false
        },
        {
          "id": 4,
          "label": "Περιορισμένα τεμάχια",
          "requires_available_quantity": true
        },
        {
          "id": 5,
          "label": "To προϊόν καταργήθηκε",
          "requires_available_quantity": false
        }
      ]
    }
  }
}

Accept a single order

The available param values used are provided in accept_options when retrieving a single order.

  POST /merchants/ecommerce/orders/:code/accept

POST https://api.skroutz.gr/merchants/ecommerce/orders/191128-1234567/accept

View Response Params
{
  "number_of_parcels": 1,
  "pickup_location": "YlpD0KROym",
  "pickup_window": 2
}
Show Headers
Status: 200
{
  "success": true
}

Reject a single order

Reject specific line items with reasons

To reject specific line items you need to provide a line_items params which would hold an array of line items. Each line items should have the line item id and the rejection reason_id. In case the rejection reason requires_available_quantity, an available_quantity attribute is also required.

The available rejection reason IDs are provided in reject_options when retrieving a single order.

  POST /merchants/ecommerce/orders/:code/reject

POST https://api.skroutz.gr/merchants/ecommerce/orders/191128-1234567/reject

View Response Params
{
  "line_items": [
    {
      "id": "jn231kb12u",
      "reason_id": 2
    },
    {
      "id": "opaoe8M3pZ",
      "reason_id": 4,
      "available_quantity": 1
    }
  ]
}
Show Headers
Status: 200
{
  "success": true
}

Reject whole order with "other" reason

  POST /merchants/ecommerce/orders/:code/reject

POST https://api.skroutz.gr/merchants/ecommerce/orders/191128-1234567/reject

View Response Params
{
  "rejection_reason_other": "Our store is closed for personal reasons"
}
Show Headers
Status: 200
{
  "success": true
}

Error handling

In case of errors, the response will have a representative HTTP status code in the 4xx or 5xx range. The body would contain an array of errors.

For example, if you try to reject an order that is already rejected, you will get a 422 HTTP status code (Unprocessable Entity), with the following body:

{
  "errors": [
      {
          "code": "order_status",
          "messages": [
              "Order already rejected."
          ]
      }
  ]
}

More on API error handling

Order object attributes appendix

The order object returned retrieving a single order via the API is the same as in webhook events about a new/updated order.

Order object

Name Type Value Description
code String   Order code
state String "open" / "cancelled" Order state
comments String   Order comments
courier_voucher String   Order's shipment courier voucher URL
line_items Array   Order line items (products)
created_at Date String in format
YYYY-MM-DDTHH:MM:SS+HH:M
  Order creation date
expires_at Date String in format
YYYY-MM-DDTHH:MM:SS+HH:M
  Order expiration date
dispatch_until Date String in format
YYYY-MM-DDTHH:MM:SS+HH:M
  Order maximum dispatch date

Order line items array

Name Type Description
line_items[_].id String Unique item id
line_items[_].shop_uid String Item id in shop
line_items[_].product_name String Item product name
line_items[_].quantity Integer Item quantity
line_items[_].size Object Item size values (optional)
line_items[_].unit_price Double Price per item in euros (VAT-included)
line_items[_].total_price Double Total item price in euros: unit_price * quantity

Line item size

Name Type Value Description
line_items[_].size.label String "Νούμερο" / "Μέγεθος" / "Ηλικία" Item size label
line_items[_].size.value String   Item size value
line_items[_].size.shop_value String   Item original size as provided by the shop