Skroutz API Access Application no longer accepts requests.

CPS Orders API Edit the file on GitHub

CPS orders API allows Skroutz Merchants to retrieve information about their CPS orders as well as to reject them without accessing Merchants Panel.

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 CPS orders settings page in Merchants 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/cps/orders/1234567 \
  -H 'Accept: application/vnd.skroutz+json; version=3.0' \
  -H 'Authorization: Bearer your_access_token_here'

Endpoints

Retrieve a single order

To fetch a specific order, you have to provide the order code with which you have originally identified your order in your shop, as a URL parameter.

When an order is in a state that can be rejected, reject_options attribute is included in the response, providing all the available options for issuing "reject" requests for the order.

  GET /merchants/cps/orders/:code

GET https://api.skroutz.gr/merchants/cps/orders/1234567

View Response
Show Headers
Status: 200
{
  "order": {
    "code": "1234567",
    "date": "2019-11-28T13:24:37+02:00",
    "revenue": 46.61,
    "commission": 4.66,
    "state": "Προς χρέωση",
    "charged": false,
    "charged_at": null,
    "refunded_at": null,
    "line_items": [
      {
        "product_id": "BM7300LEA35-BLA",
        "name": "GUESS ACCESSORIES-REVERSIBLE AND ADJUSTABLE BELT ΖΩΝΗ ΑΝΔΡΙΚΟ BM7300LEA35, ΜΑΥΡΟ, ΑΝΔΡΑΣ",
        "quantity": 1,
        "unit_price": 46.61,
        "commission_rate": 0.1,
        "commission": 4.66
      },
      {
        "product_id": "BM7300LEA49-BLA",
        "name": "BELT ΖΩΝΗ ΑΝΔΡΙΚΟ BM7300LEA49, ΚΑΦΕ, ΑΝΔΡΑΣ",
        "quantity": 3,
        "unit_price": 95.11,
        "commission_rate": 0.18,
        "commission": 17.12
      }
    ],
    "reject_options": [
      {
        "name": "user_cancel",
        "description": "Ακύρωση παραγγελίας από τον πελάτη",
        "requires_additional_comment": false
      },
      {
        "name": "user_return",
        "description": "Υπαναχώρηση πελάτη",
        "requires_additional_comment": false
      },
      {
        "name": "undelivered",
        "description": "Δεν κατέστη δυνατή η παράδοση της παραγγελίας",
        "requires_additional_comment": false
      },
      {
        "name": "unpaid",
        "description": "Δεν ολοκληρώθηκε η πληρωμή",
        "requires_additional_comment": false
      },
      {
        "name": "unavailable_items",
        "description": "Έλλειψη διαθεσιμότητας",
        "requires_additional_comment": false
      },
      {
        "name": "shop_staff_order",
        "description": "Παραγγελία από προσωπικό του καταστήματος",
        "requires_additional_comment": false
      },
      {
        "name": "other",
        "description": "Άλλο",
        "requires_additional_comment": true
      }
    ]
  }
}
Example
curl -X GET https://api.skroutz.gr/merchants/cps/orders/1234567 \
  -H 'Accept: application/vnd.skroutz+json; version=3.0' \
  -H 'Authorization: Bearer your_access_token_here'

Reject a single order

In order to reject an order, you must include a reject reason. The reject reason can be either one of the predefined ones we support or it can be a custom one that the user wants to provide.

Reject order with a predefined reason

The available predefined rejection reasons are provided in the reject_options field when retrieving a single order.

  POST /merchants/cps/orders/:code/reject

POST https://api.skroutz.gr/merchants/cps/orders/1234567/reject

View Response Params
{
  "reason": {
    "name": "user_cancel"
  }
}
Show Headers
Status: 200
{
  "success": true
}
Example
curl -X POST https://api.skroutz.gr/merchants/cps/orders/1234567/reject \
  -H 'Accept: application/vnd.skroutz+json; version=3.0' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -H 'Authorization: Bearer your_access_token_here' \
  -d '{ "reason": { "name": "user_cancel" } }'

Reject order with custom reason

In case you want to reject an order with a reject reason other than the ones provided in the reject_options field, then you have to use the reject option other and include also a comment, where you will explain your rejection.

The comment attribute is mandatory when using the other reject option

  POST /merchants/cps/orders/:code/reject

POST https://api.skroutz.gr/merchants/cps/orders/1234567/reject

View Response Params
{
  "reason": {
    "name": "other",
    "comment": "Our store is closed for personal reasons"
  }
}
Show Headers
Status: 200
{
  "success": true
}
Example
curl -X POST https://api.skroutz.gr/merchants/cps/orders/1234567/reject \
  -H 'Accept: application/vnd.skroutz+json; version=3.0' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -H 'Authorization: Bearer your_access_token_here' \
  -d '{ "reason": { "name": "other", "comment": "Our store is closed for personal reasons" } }'

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

Order object

Name Type Description
code String Order code
date Date String in format
YYYY-MM-DDTHH:MM:SS+HH:M
Order creation date
revenue Double Total order price in euros
commission Double Total order commission in euros
state String The current state of the order
rejection_reason String The declined reason of the order, if it has been previously rejected
charged Boolean Whether the order has already been charged
charged_at Date String in format
YYYY-MM-DDTHH:MM:SS+HH:M
Order charge date (if has been charged)
refunded_at Date String in format
YYYY-MM-DDTHH:MM:SS+HH:M
Order refund date (if has been refunded)
line_items Array Order line items (products)
reject_options Object Reject options (available for orders at a rejectable state)

Order line items array

Name Type Description
line_items[_].product_id String Item id in shop
line_items[_].name String Item product name
line_items[_].quantity Integer Item quantity
line_items[_].unit_price Double Price per item unit in euros
line_items[_].commission_rate Double Commission rate per item (from 0.0 - 100.0)
line_items[_].commission Double Commission per item in euros

Reject options

Available reject reasons to use when rejecting an order. These options are returned only when the order is at a rejectable state.

Name Type Description
reject_options.name String The rejection reason name to use
reject_options.description String A human readable label
reject_options.requires_additional_comment Boolean Whether or not comment is required

Possible values

Name Description Requires Additional Comment
user_cancel Ακύρωση παραγγελίας από τον πελάτη False
user_return Υπαναχώρηση πελάτη False
undelivered Δεν κατέστη δυνατή η παράδοση της παραγγελίας False
unpaid Δεν ολοκληρώθηκε η πληρωμή False
unavailable_items Έλλειψη διαθεσιμότητας False
shop_staff_order Παραγγελία από προσωπικό του καταστήματος False
other Άλλο True