Payment Services

GET /orders

Requires authentication with server access token.

Deprecated since version 2.84

List and search all orders.

Examples

Fetch all orders that changed within the past 7 days:

curl http://identity-pre.schibsted.com/api/2/users?oauth_token=TOKEN&\
  since=last week&\
  filters=updated

Fetch all orders created between yesterday and today:

curl http://identity-pre.schibsted.com/api/2/users?oauth_token=TOKEN&\
  since=yesterday&\
  until=today

Fetch 10 orders created today (since midnight):

curl http://identity-pre.schibsted.com/api/2/users?oauth_token=TOKEN&\
  since=today&\
  limit=10&\
  offset=20

Fetch 10 orders created since february 22nd 2013:

curl http://identity-pre.schibsted.com/api/2/users?oauth_token=TOKEN&\
  since=2013-02-22&\
  limit=10&\
  offset=20

See also

Help us improve

Did you spot an error? Or maybe you just have a suggestion for how we can improve? Leave us a comment.

Request

GET /api/2/orders

sort

optional

userId

optional

The user's uuid or userId (not to be mistaken with the deprecated id).

status

optional

One or more statuses to filter results by

ocr

optional

Filter results by OCR/KID number

orderId

optional

Show this specific order

clientReference

optional

Filter by custom client reference

filters

optional
all
Include all items in the response, including deleted/blocked or otherwise excluded items
none
Do not apply any status filters (e.g. same as 'all')
purchases
Default filter. Returns all regular orders (excludes renewals)
renews
Return orders that are for subscription renewals (recurring payments)
transfers
Return orders that are transfers. Not currently in use
repurchases
expired
Return all items with status expired
cancelled
Include cancelled orders in the results
failed
Return failed orders
created
Use in combination with pagination parameters to find created orders in a time-span
pending
Return pending orders
completed
Include completed orders in the results
credited
Return orders that have been credited
authorized
Return orders that have been authorized
merchant
Show all results within the current merchant rather than the current client
transactions
Includes all order transactions in the response
items
Includes order items in the response
identifier
Includes order payment identifiers in the response

The pagination parameters limit, offset, since, and until are also supported.

Example request

cURL
Minimal example
curl https://login.schibsted.com/api/2/orders -G \
   -d "oauth_token=[access token]"
With all parameters
curl https://login.schibsted.com/api/2/orders -G \
   -d "oauth_token=[access token]" \
   -d "sort=userId" \
   -d "userId=42" \
   -d "status=0" \
   -d "ocr=1234567" \
   -d "orderId=42" \
   -d "clientReference=ref"
Java
Minimal example
SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
    GET(token, "/orders").
    getResponseBody();
With all parameters
Map<String, String> params = new HashMap<>() {{
    put("sort", "userId");,
    put("userId", "42");,
    put("status", "0");,
    put("ocr", "1234567");,
    put("orderId", "42");,
    put("clientReference", "ref");
}};

SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
    GET(token, "/orders", params).
    getResponseBody();

This example is an excerpt, see a full example

PHP
Minimal example
<?php
$client->auth();
echo var_dump($client->api("/orders"));
With all parameters
<?php
$params = array(
    "sort" => "userId",
    "userId" => "42",
    "status" => "0",
    "ocr" => "1234567",
    "orderId" => "42",
    "clientReference" => "ref"
);

$client->auth();
echo var_dump($client->api("/orders", $params));

This example is an excerpt, see a full example

Clojure
Minimal example
(ns example
  (:require [spid-client-clojure.core :as spid]))

(let [client (spid/create-client "[client-id]" "[secret]")
      token (spid/create-server-token client)]
  (spid/GET client token "/orders"))
With all parameters
(ns example
  (:require [spid-client-clojure.core :as spid]))

(let [client (spid/create-client "[client-id]" "[secret]")
      token (spid/create-server-token client)]
  (spid/GET client token "/orders" {"sort" "userId"
                                    "userId" "42"
                                    "status" "0"
                                    "ocr" "1234567"
                                    "orderId" "42"
                                    "clientReference" "ref"}))

Response

This endpoint supports the JSON and JSON-P response formats.

Success: 200 OK

Returns a list of order objects

Order

Orders contain one or more order items. Orders with status other than failed and pending will have transactions attached to them.

Crediting an order can be done by a full credit or a partial credit. Partial credits must be done by specifying which order item you want to credit. If you specify an amount (optional), the corresponding order item will be partially credited. In a full credit there is no need to specify any other fields than description, which is required in both full and partial credits.

Crediting an order will trigger a user notification, which will inform the user about the order change. This can be optionally turned off by setting the field notifyUser to false.

Capturing an order can be done by a full or a partial capture. Partial captures must be done by specifying which order item you want to capture. If you specify an amount (optional), the corresponding order item will be partially captured. In a full capture there is no need to specify any other fields.

All captured and credited VAT amounts will match the corresponding VAT percentage set in the order item.

orderId

integer

Unique order ID

clientId

string

ID of the client this order belongs to

merchantId

integer

Merchant ID

clientReference

string

Custom client reference (inherited from Paylinks)

extOrderRef

string

External order reference

extTransRef

string

External transaction reference

identifierId

integer

Payment method identifier ID

identifierType

Payment options

Payment type for the payment method identifier used

userFlow

User flow

The user involvement level during creation of this order

purchaseFlow

Purchase flow

What type of purchase flow this order was processed with

userId

integer

ID of the user this order belongs to

sellerUserId

integer

ID of the user who will receive money from this order. Used in P2P.

paylinkId

integer

ID used to create this order

ocr

string

OCR/KID number

type

Order type

Order type

totalPrice

integer

Total price (including VAT amount) for the complete order

vat

integer

VAT, fraction × 10000. For instance, 25% would be 2500

calculatedVat

integer

Total amount of VAT for this order

creditedAmount

integer

Amount of the order credited. Defaults to 0.

capturedAmount

integer

Amount of the order captured. Defaults to full amount or 0, depending on paymentFlow.

creditedVatAmount

integer

Credited VAT amount

capturedVatAmount

integer

Captured VAT amount

currency

string

Order currency; SEK, NOK, USD

campaignId

integer

ID of the campaign that triggered this order

voucherId

integer

ID of the voucher used for this order

tag

string

Can be used for custom order tracking

status

Order status

transactionSynced

Transaction synced status

transactionStatus

integer

Third party payment provider transaction status

errorCode

string

Error Code

errorDescription

string

Error Description

errorThirdparty

string

Third-Party Error Description (e.g. VISA error)

updated

datetime

The time the order was last updated

created

datetime

The time the order was created

statusChecked

datetime

The last time the order status was checked by a client via the /status endpoint

identifier

Payment identifier

Payment method used for this order

items

list of Order items

transactions

list of Transactions

The check mark indicates that the field always contains a valid non-empty value.

Order item

orderItemId

integer

Unique order item ID

orderId

integer

Unique Order ID

clientId

string

Client ID

clientItemReference

string

A client provided reference to this order item. (Inherited from Paylink items)

productId

integer

Product ID. Defaults to 0

discountId

integer

Discount ID (if available)

type

Order item type

status

integer

Order item status

code

string

Product code

name

string

Product Name

description

string

Order item description

description_2

string

Order item description, line 2

description_3

string

Order item description, line 3

description_4

string

Order item description, line 4

price

price

Single item price (including VAT amount)

vat

integer

VAT, fraction × 10000. For instance, 25% would be 2500

capturedAmount

integer

The amount captured on this item

creditedAmount

integer

The amount credited on this item

quantity

integer

The number of occurrences of this productId/type

updated

datetime

When the order was last updated

created

datetime

When the order was created

The check mark indicates that the field always contains a valid non-empty value.

Order status

Order status changes happen according to the following state-machine:

Order status state machine

See callbacks to learn how to subscribe to these changes.

An enum, with the following possible values:

"-3"

Expired

"-2"

Cancelled

"-1"

Failed

"0"

Created

"1"

Pending

"2"

Complete

"3"

Credited

"4"

Authorized

Order type

An enum, with the following possible values:

"0"

Purchase

"1"

Renew

"2"

Transfer

"3"

Re-purchase

"4"

Direct

Payment options

Payment options can be provided as a bit mask.

Bitmask format is the default format. If payment options are not provided, the default value is 2 (bank card with PayEx).

Examples: 2 means credit card, 4 means SMS, while 6 means both credit card and SMS.

An enum, with the following possible values:

"1"

Masterpass

"2"

Credit card

"4"

SMS

"8"

PayEx Invoice

"16"

Voucher

"32"

Klarna Invoice

"64"

Klarna Mobile

"128"

Wallet

Purchase flow

An enum, with the following possible values:

"DIRECT"

Direct purchase flow

"AUTHORIZE"

Authorize/Capture purchase flow

Payment identifier

A payment identifier is a means of payment, e.g. credit card, SMS and others.

identifierId

integer (as string)

Unique payment identifier ID

identifier

string

The actual identifier, like a credit card number or cell phone number

type

Payment identifier type

mediaDistribution

string

Invoice distribution; "PDF" or "PAPER"

method

string

Payment method (VISA, MC, SMS)

description

string

expirationDate

datetime

When this payment identifier expires

userId

string

userId of the user who owns this payment identifier

maxAmount

string

The maximum amount that can be charged

status

Payment identifier status

updated

string

When the payment identifier was last updated

created

string

When the payment identifier was created

The check mark indicates that the field always contains a valid non-empty value.

Transaction

transactionId

integer (as string)

Unique ID of the transaction

masterId

integer (as string)

ID of master transaction

clientId

string

userId

integer (as string)

ID of the user the transaction is for

type

Transaction type

reference

string

Third-party reference

orderId

integer (as string)

amount

price

currency

string

description

string

ip

string

The IP address from which the transaction was made

createdBy

integer (as string)

ID of the user who created the transaction

created

datetime

The check mark indicates that the field always contains a valid non-empty value.

Failure cases

Some HTTP response codes are used for multiple error situations. There is no consistent way to tell these apart, but the error object will contain a textual explanation of the reason for the error. For explanation on OAuth related failures and errors see OAuth authentication failures.

  • 401 Unauthorized You don't have administration rights for this client.
  • 401 Unauthorized Your client doesn't have administration rights for this client.
  • 403 Forbidden Client is not authorized to access this API endpoint. Contact SPiD to request access.
  • 403 Forbidden Requesting IP is not whitelisted
  • 403 Forbidden Access token rejected
  • 404 Not Found Unknown client ID
  • 404 Not Found Client ID mismatch. The client making the request is no the owner of this resource, and does not have administrative privileges for it.
  • 404 Not Found No order found
  • 420 Request Ratelimit exceeded

Sample response

JSON
{
  "4466": {
    "sellerUserId": null,
    "status": "2",
    "clientReference": "Order number 1403529697359",
    "vat": "2400",
    "errorCode": "OK",
    "clientId": "[Your client ID]",
    "userId": "102968",
    "currency": "NOK",
    "paylinkId": "4319",
    "transactionSynced": "1",
    "calculatedVat": "5748",
    "extTransRef": "4337518",
    "orderId": "4466",
    "totalPrice": "29700",
    "capturedAmount": "29700",
    "errorDescription": "OK",
    "merchantId": "[Your merchant ID]",
    "creditedVatAmount": "0",
    "identifierType": "2",
    "voucherId": null,
    "statusChecked": "2014-06-23 15:25:17",
    "created": "2014-06-23 15:21:40",
    "updated": "2014-06-23 15:25:17",
    "type": "0",
    "creditedAmount": "0",
    "errorThirdparty": null,
    "ocr": "47000000000044660",
    "campaignId": null,
    "capturedVatAmount": "5748",
    "purchaseFlow": "1",
    "extOrderRef": "EFF7F358E6B64635885C85EFA7C131D6",
    "tag": null,
    "transactionStatus": null,
    "userFlow": "2",
    "identifierId": "1934"
  }
}
JSON-P
callback({
  "4466": {
    "sellerUserId": null,
    "status": "2",
    "clientReference": "Order number 1403529697359",
    "vat": "2400",
    "errorCode": "OK",
    "clientId": "[Your client ID]",
    "userId": "102968",
    "currency": "NOK",
    "paylinkId": "4319",
    "transactionSynced": "1",
    "calculatedVat": "5748",
    "extTransRef": "4337518",
    "orderId": "4466",
    "totalPrice": "29700",
    "capturedAmount": "29700",
    "errorDescription": "OK",
    "merchantId": "[Your merchant ID]",
    "creditedVatAmount": "0",
    "identifierType": "2",
    "voucherId": null,
    "statusChecked": "2014-06-23 15:25:17",
    "created": "2014-06-23 15:21:40",
    "updated": "2014-06-23 15:25:17",
    "type": "0",
    "creditedAmount": "0",
    "errorThirdparty": null,
    "ocr": "47000000000044660",
    "campaignId": null,
    "capturedVatAmount": "5748",
    "purchaseFlow": "1",
    "extOrderRef": "EFF7F358E6B64635885C85EFA7C131D6",
    "tag": null,
    "transactionStatus": null,
    "userFlow": "2",
    "identifierId": "1934"
  }
});

Comments/feedback

Do you have questions, or just want to contribute some newly gained insight? Want to share an example? Please leave a comment. SPiD reads and responds to every question. Additionally, your experience can help others using SPiD, and it can help us continuously improve our documentation.