Skip to content

Get

/order

Target audience: Developers

Get order(s)

Introduction

This endpoint returns one or several orders, details for them along with payments.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/order
Production https://backend.worldoftulo.com/external/api/v1/order

Requirements

Identity Scope
No /external/order/r

Parameters

Name Description
order_id The id of the order to get
account_id The id of the account to get orders from

Curl Example

Get an order

curl --request GET \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/order?order_id=ADEPRIMO-123 \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \

Get orders for account

curl --request GET \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/order?account_id=58580d09a67201024e00004c \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \

Response

Example response one order

HTTP 200
{
  "item": {
    "id": "5c4f1c0f95cfeba6a08a6903",
    "order_id": "ADEPRIMO-1222",
    "payment_option": "creditcard",
    "purchase_type": "recurring",
    "state": "closed",
    "subscription_start_date": "",
    "traffic_source": "web",
    "merchant_reference": "adeprimo-campaign-001",
    "child_order_ids": ["ADEPRIMO-810"],
    "parent_order_id": "ADEPRIMO-852",
    "order_detail": {
      "period_info": {
        "type": "month",
        "length": 1,
        "price": 99.0,
        "price_specification": ""
      },
      "partial_payment_info": {
        "id": null,
        "number_of_partial_payments_selected": 1
      },
      "description": "Adeprimo Plus (prenumeration, 1 månad)",
      "price": 99.0,
      "vat_code": "25",
      "created": "2019-01-28T16:13:19+01:00",
      "product_code": "adeprimo_plus"
    },
    "payments": [
      {
        "order_id": "ADEPRIMO-1222",
        "product_code": "adeprimo_plus",
        "payment_result": {
          "created": "2019-01-28T16:20:34.981+01:00",
          "order_status": "completed",
          "transaction_status": "sale",
          "transaction_number": "5c4f1dc095cfebd6fb090249",
          "payment_method": "creditcard",
          "amount": "9900",
          "error_code": null,
          "error_description": null,
          "third_party_error": null
        },
        "payment_type": "autopay",
        "payment_method": "creditcard",
        "amount": 99.0,
        "description": "Plus",
        "state": "closed",
        "provider": "Tulo",
        "price_specification": ""
      },
      {
        "order_id": "ADEPRIMO-1222",
        "product_code": "adeprimo_plus",
        "payment_result": {
          "created": "2019-01-28T16:35:23.419+01:00",
          "order_status": "completed",
          "transaction_status": "sale",
          "transaction_number": "5c4f213995cfebeae2d4fc91",
          "payment_method": "creditcard",
          "amount": "9900",
          "error_code": null,
          "error_description": null,
          "third_party_error": null
        },
        "payment_type": "autopay",
        "payment_method": "creditcard",
        "amount": 99.0,
        "description": "Plus",
        "state": "closed",
        "provider": "Tulo",
        "price_specification": ""
      }
    ],
    "addresses": {
      // Payway Address //
    }
  }
}

Example response multiple orders

HTTP 200
{
  "items": [{
      "id": "56cc6807400e06bc39000001",
      "order_id": "ADEPRIMO-516",
      "payment_option": "creditcard",
      "purchase_type": "recurring",
      "state": "closed",
      "subscription_start_date": "",
      "traffic_source": null,
      "child_order_ids": [],
      "parent_order_id": null,
      "order_detail": {
        "period_info": {
          "type": "month",
          "length": 1,
          "price": "149.0",
          "price_specification": ""
        },
        "partial_payment_info": null,
        "description": "Adeprimo Digital (prenumeration, 1 månad)",
        "price": 149.0,
        "vat_code": "25",
        "created": "2016-02-23T15:09:11+01:00",
        "product_code": "adeprimo_digital"
      },
      "payments": [{
          "order_id": "ADEPRIMO-516",
          "product_code": "adeprimo_digital",
          "payment_result": {
            "created": "2017-08-22T16:10:14.736+02:00",
            "order_status": "",
            "transaction_status": "0",
            "transaction_number": "15572993",
            "payment_method": "MC",
            "amount": "",
            "error_code": "",
            "error_description": "",
            "third_party_error": ""
          },
          "payment_type": "autopay",
          "payment_method": "CREDITCARD",
          "amount": 149.0,
          "description": "Adeprimo Digital",
          "state": "closed",
          "provider": "PayexCreditCardPaymentProvider",
          "price_specification": ""
        },
        "addresses": {
          // Payway Address //
        }
      ]
    },
    {
      "id": "58b92dc7400e066d2300002a",
      "order_id": "ADEPRIMO-852",
      "payment_option": "klarna",
      "purchase_type": "recurring",
      "state": "closed",
      "subscription_start_date": "",
      "traffic_source": null,
      "child_order_ids": [
        "ADEPRIMO-1222"
      ],
      "parent_order_id": null,
      "order_detail": {
        "period_info": {
          "type": "month",
          "length": 1,
          "price": "10.0",
          "price_specification": ""
        },
        "partial_payment_info": null,
        "description": "Adeprimo Digital 24 h (prenumeration, 1 månad)",
        "price": 10.0,
        "vat_code": "25",
        "created": "2017-03-03T09:48:07+01:00",
        "product_code": "adeprimo_digital_24h"
      },
      "payments": [{
          "order_id": "ADEPRIMO-852",
          "product_code": "adeprimo_digital_24h",
          "payment_result": {
            "created": "2017-09-03T10:45:15.826+02:00",
            "order_status": "completed",
            "transaction_status": "sale",
            "transaction_number": "59abc119cf31fc595b000000",
            "payment_method": "klarna",
            "amount": "1000",
            "error_code": null,
            "error_description": null,
            "third_party_error": null
          },
          "payment_type": "autopay",
          "payment_method": "KLARNA",
          "amount": 10.0,
          "description": "Adeprimo Digital 24 h",
          "state": "closed",
          "provider": "KlarnaPaymentProvider",
          "price_specification": ""
        }
      ]
    },
    "addresses": {
      // Payway Address //
    }
  ]
}

The addresses will include an object Payway Address if available.

Errors

Example error response

HTTP 400 Bad Request
{
    "code": "invalid_parameter",
    "field": "account_id",
    "message": "Parameter must match format (/^[a-f\d]{24}$/)"
}

HTTP 400 Bad Request

Name Type Description
invalid_parameter Object Validation error on any of the fields in the posted json
json_parser_error Object The request body could not be parsed as valid json
invalid_content_type_error Object The requests Content-Type header isn't set to application/json
unknown_parameter Object One or more of the fields in the posted json was not recognized

HTTP 404 Not Found

Name Type Description
not_found Object The package could not be found

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side