Payment Services

POST /product/{id}

Requires authentication with server access token.

Update the product by POST-ing the fields to edit. Refer to GET /product/{id} for details on the supported query parameters.

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

POST /api/2/product/{id}

id

required path parameter

name

optional

description

optional

price

optional

vat

optional

paymentOptions

optional

url

optional

quantityLimit

optional

status

optional

availableStart

optional

availableStop

optional

saleStart

optional

saleStop

optional

hideItems

optional

allowMultiSales

optional

subscriptionPeriod

optional

subscriptionRenewPrice

optional

subscriptionRenewPeriod

optional

subscriptionAutoRenew

optional

subscriptionAutoRenewLockPeriod

optional

subscriptionAutoRenewDisabled

optional

subscriptionGracePeriod

optional

subscriptionEmailReceiptLimit

optional

subscriptionFinalEndDate

optional

subscriptionSurveyUrl

optional

Example request

cURL
Minimal example
curl https://login.schibsted.com/api/2/product/1337 \
   -X POST \
   -d "oauth_token=[access token]"
With all parameters
curl https://login.schibsted.com/api/2/product/1337 \
   -X POST \
   -d "oauth_token=[access token]" \
   -d "name=John Doe" \
   -d "description=Some information" \
   -d "price=400" \
   -d "vat=96" \
   -d "paymentOptions=2" \
   -d "url=http://example.com" \
   -d "quantityLimit=10" \
   -d "status=0" \
   -d "availableStart=2014-01-01" \
   -d "availableStop=2016-06-01" \
   -d "saleStart=2016-06-01" \
   -d "saleStop=2014-07-01" \
   -d "hideItems=1" \
   -d "allowMultiSales=1" \
   -d "subscriptionPeriod=12000" \
   -d "subscriptionRenewPrice=59" \
   -d "subscriptionRenewPeriod=12000" \
   -d "subscriptionAutoRenew=1" \
   -d "subscriptionAutoRenewLockPeriod=12000" \
   -d "subscriptionAutoRenewDisabled=1" \
   -d "subscriptionGracePeriod=12000" \
   -d "subscriptionEmailReceiptLimit=0" \
   -d "subscriptionFinalEndDate=2014-12-31" \
   -d "subscriptionSurveyUrl=http://survey.example.com"
Java
Minimal example
SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
    POST(token, "/product/1337").
    getResponseBody();
With all parameters
Map<String, String> params = new HashMap<>() {{
    put("name", "John Doe");,
    put("description", "Some information");,
    put("price", "400");,
    put("vat", "96");,
    put("paymentOptions", "2");,
    put("url", "http://example.com");,
    put("quantityLimit", "10");,
    put("status", "0");,
    put("availableStart", "2014-01-01");,
    put("availableStop", "2016-06-01");,
    put("saleStart", "2016-06-01");,
    put("saleStop", "2014-07-01");,
    put("hideItems", "1");,
    put("allowMultiSales", "1");,
    put("subscriptionPeriod", "12000");,
    put("subscriptionRenewPrice", "59");,
    put("subscriptionRenewPeriod", "12000");,
    put("subscriptionAutoRenew", "1");,
    put("subscriptionAutoRenewLockPeriod", "12000");,
    put("subscriptionAutoRenewDisabled", "1");,
    put("subscriptionGracePeriod", "12000");,
    put("subscriptionEmailReceiptLimit", "0");,
    put("subscriptionFinalEndDate", "2014-12-31");,
    put("subscriptionSurveyUrl", "http://survey.example.com");
}};

SpidOAuthToken token = spidClient.getServerToken();
String responseJSON = spidClient.
    POST(token, "/product/1337", params).
    getResponseBody();

This example is an excerpt, see a full example

PHP
Minimal example
<?php
$client->auth();
echo var_dump($client->api("/product/1337", "POST"));
With all parameters
<?php
$params = array(
    "name" => "John Doe",
    "description" => "Some information",
    "price" => "400",
    "vat" => "96",
    "paymentOptions" => "2",
    "url" => "http://example.com",
    "quantityLimit" => "10",
    "status" => "0",
    "availableStart" => "2014-01-01",
    "availableStop" => "2016-06-01",
    "saleStart" => "2016-06-01",
    "saleStop" => "2014-07-01",
    "hideItems" => "1",
    "allowMultiSales" => "1",
    "subscriptionPeriod" => "12000",
    "subscriptionRenewPrice" => "59",
    "subscriptionRenewPeriod" => "12000",
    "subscriptionAutoRenew" => "1",
    "subscriptionAutoRenewLockPeriod" => "12000",
    "subscriptionAutoRenewDisabled" => "1",
    "subscriptionGracePeriod" => "12000",
    "subscriptionEmailReceiptLimit" => "0",
    "subscriptionFinalEndDate" => "2014-12-31",
    "subscriptionSurveyUrl" => "http://survey.example.com"
);

$client->auth();
echo var_dump($client->api("/product/1337", "POST", $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/POST client token "/product/1337"))
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/POST client token "/product/1337" {"name" "John Doe"
                                           "description" "Some information"
                                           "price" "400"
                                           "vat" "96"
                                           "paymentOptions" "2"
                                           "url" "http://example.com"
                                           "quantityLimit" "10"
                                           "status" "0"
                                           "availableStart" "2014-01-01"
                                           "availableStop" "2016-06-01"
                                           "saleStart" "2016-06-01"
                                           "saleStop" "2014-07-01"
                                           "hideItems" "1"
                                           "allowMultiSales" "1"
                                           "subscriptionPeriod" "12000"
                                           "subscriptionRenewPrice" "59"
                                           "subscriptionRenewPeriod" "12000"
                                           "subscriptionAutoRenew" "1"
                                           "subscriptionAutoRenewLockPeriod" "12000"
                                           "subscriptionAutoRenewDisabled" "1"
                                           "subscriptionGracePeriod" "12000"
                                           "subscriptionEmailReceiptLimit" "0"
                                           "subscriptionFinalEndDate" "2014-12-31"
                                           "subscriptionSurveyUrl" "http://survey.example.com"}))

Response

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

Success: 200 OK

Returns the updated product object.

Product

productId

integer (as string)

Unique product ID

parentProductId

integer (as string)

ID of the parent product, if any

clientId

string

Your client ID

type

Product type

bundle

Bundle type

code

string

name

string

Product display name

description

string

A detailed description of the product

url

URL (string)

price

price

vat

integer (as string)

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

currency

string

Price and VAT currency

paymentOptions

Payment options

Available payment options for this product

quantityLimit

integer (as string)

Maximum available sales for this product.

quantityCount

integer (as string)

Number of sales for this product so far

saleStart

datetime

Start of a sale for this product (i.e. reduced price or with additional benefits)

saleStop

datetime

End of a sale

availableStart

datetime

When this product is available for purchase

availableStop

datetime

When this product is no longer available for purchase

subscriptionPeriod

timestamp, in seconds

The subscription period

subscriptionRenewPrice

price

Price of subscription renewal

subscriptionRenewPeriod

timestamp, in seconds

For how long a renewal is valid

subscriptionAutoRenew

string, "1" (true) or "0" (false)

If "1", the subscription automatically renews

subscriptionAutoRenewLockPeriod

timestamp, in seconds

The initial period during which auto renew cannot be changed

subscriptionAutoRenewDisabled

string, "1" (true) or "0" (false)

If "1", auto renew is not available

subscriptionGracePeriod

integer (as string)

The period after a failed renewal charge the subscription will stay active

subscriptionEmailReceiptLimit

integer (as string)

The maximum number of email receipts

subscriptionFinalEndDate

datetime

By this date, the subscription is no longer for sale

allowMultiSales

string, "1" (true) or "0" (false)

If "1", users can purchase this product multiple times

status

Product status

changedBy

integer (as string)

ID of the user that made the last change

changed

datetime

createdBy

integer (as string)

ID of the user that created this product

created

datetime

purchaseUri

URL (string)

A URI where the product may be purchased

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

Product status

An enum, with the following possible values:

"-1"

Deleted

"0"

Not available

"1"

Available, but not visible

"2"

Available, but not selectable

"3"

Available

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

Bundle type

An enum, with the following possible values:

"0"

Not a bundle

"1"

Dynamic bundle

"2"

Onetime bundle

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.
  • 420 Request Ratelimit exceeded

Sample response

JSON
{
  "subscriptionSurveyUrl": null,
  "status": "1",
  "purchaseUri": "https://identity-pre.schibsted.com/auth/start?client_id\u003d52f8e3d9efd04bb749000000\u0026flow\u003dpayment\u0026product_id\u003d301696",
  "changedBy": "52f8e3d9efd04bb749000000",
  "subscriptionAutoRenewLockPeriod": "0",
  "vat": "2500",
  "clientId": "[Your client ID]",
  "guardian": "0",
  "currency": "NOK",
  "subscriptionFinalEndDate": null,
  "quantityCount": "0",
  "createdBy": "[ID of admin user, or client]",
  "name": "VG PLUSS",
  "parentProductId": "301696",
  "changed": "2014-08-05 13:09:50",
  "saleStart": null,
  "subscriptionGracePeriod": "0",
  "subscriptionPeriod": "2592000",
  "availableStop": null,
  "subscriptionAutoRenew": "0",
  "productId": "301696",
  "code": "vg+",
  "saleStop": null,
  "bundle": "0",
  "url": null,
  "subscriptionEmailReceiptLimit": null,
  "created": "2014-08-05 11:59:05",
  "subscriptionRenewPeriod": null,
  "type": "2",
  "subscriptionAutoRenewDisabled": "0",
  "subscriptionRenewPrice": null,
  "hideItems": "0",
  "paymentOptions": "2",
  "price": "9900",
  "allowMultiSales": "0",
  "description": null,
  "quantityLimit": null,
  "autopay": "0",
  "availableStart": null
}
JSON-P
callback({
  "subscriptionSurveyUrl": null,
  "status": "1",
  "purchaseUri": "https://identity-pre.schibsted.com/auth/start?client_id\u003d52f8e3d9efd04bb749000000\u0026flow\u003dpayment\u0026product_id\u003d301696",
  "changedBy": "52f8e3d9efd04bb749000000",
  "subscriptionAutoRenewLockPeriod": "0",
  "vat": "2500",
  "clientId": "[Your client ID]",
  "guardian": "0",
  "currency": "NOK",
  "subscriptionFinalEndDate": null,
  "quantityCount": "0",
  "createdBy": "[ID of admin user, or client]",
  "name": "VG PLUSS",
  "parentProductId": "301696",
  "changed": "2014-08-05 13:09:50",
  "saleStart": null,
  "subscriptionGracePeriod": "0",
  "subscriptionPeriod": "2592000",
  "availableStop": null,
  "subscriptionAutoRenew": "0",
  "productId": "301696",
  "code": "vg+",
  "saleStop": null,
  "bundle": "0",
  "url": null,
  "subscriptionEmailReceiptLimit": null,
  "created": "2014-08-05 11:59:05",
  "subscriptionRenewPeriod": null,
  "type": "2",
  "subscriptionAutoRenewDisabled": "0",
  "subscriptionRenewPrice": null,
  "hideItems": "0",
  "paymentOptions": "2",
  "price": "9900",
  "allowMultiSales": "0",
  "description": null,
  "quantityLimit": null,
  "autopay": "0",
  "availableStart": null
});

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.