POST /paylink
Requires authentication with server access token.
Create a new paylink.
The items
parameter should be a JSON array of objects. Each object should contain at least the following required fields:
description
price
(total price including VAT, in cents - 10000 is 100,-)vat
(fraction × 10000, for instance 25% would be 2500)
These fields may be omitted if the optional field productId
is provided. This will make the item inherit description
, price
, vat
from the product. Example: if only description
and productId
is provided, the item will not inherit description
from the product.
Additionally, you may use the following optional fields:
clientItemReference
productId
ogpUri
currency
quantity
name
See the paylink item object specification for further details on these fields.
The paymentOptions
parameter defines allowed payment methods for Paylink. It can be provided in two formats - as:
- integer bitmask (bitmask format specification)
- JSON array of objects (array format specification)
available since Schibsted account version 2.111.0
See also
- Docs for the PayLink API
- The Paylink item object
GET
/paylink/{paylinkId}POST
/paylink/{paylinkId}/lockPOST
/paylink/{paylinkId}/unlockPOST
/paylink/{paylinkId}/usePOST
/paylinkDELETE
/paylink/{paylinkId}
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/paylink
title | requiredThe PayLink title. Displayed to the user on the payment page, and shown on the New Credit Card page at Payex. |
---|---|
items | requiredThe items to be sold. A list of PayLink Item objects. |
clientReference | optionalYour reference. Useful for tracking and processing the Order generated by this PayLink. |
purchaseFlow | optionalDefaults to |
paymentOptions | optionalThe allowed payment methods for this PayLink. Payment options can be provided in two formats: as an integer bit mask or as a JSON array of objects (this format allows providing data for external payment methods). Defaults to integer bitmask, 2 (bank card with PayEx). |
expires | optionalThe date when the PayLink expires. A unix timestamp. Defaults to 24 hours from creation. |
redirectUri | optionalRedirect the user to this URL after payment is complete. |
cancelUri | optionalRedirect the user to this URL if login or payment is cancelled. |
buyerUserId | optionalIf set, only this user has access to the PayLink. |
Example request
curl
Minimal example
curl https://login.schibsted.com/api/2/paylink \
-X POST \
-H "Authorization: Bearer [access token]" \
-d "title=Freebies for all" \
-d "items=[{\"name\":\"Episode\",\"description\":\"Star Wars IV\",\"price\":9900,\"vat\":2500},{\"description\":\"Star Wars V\",\"price\":9900,\"vat\":2500},{\"description\":\"Star Wars VI\",\"price\":9900,\"vat\":2500}]"
With all parameters
curl https://login.schibsted.com/api/2/paylink \
-X POST \
-H "Authorization: Bearer [access token]" \
-d "title=Freebies for all" \
-d "items=[{\"name\":\"Episode\",\"description\":\"Star Wars IV\",\"price\":9900,\"vat\":2500},{\"description\":\"Star Wars V\",\"price\":9900,\"vat\":2500},{\"description\":\"Star Wars VI\",\"price\":9900,\"vat\":2500}]" \
-d "clientReference=ref" \
-d "purchaseFlow=AUTHORIZE" \
-d "paymentOptions=[{\"type\":\"PAYEX_CC\"},{\"type\":\"KLARNA\"},{\"type\":\"PROVIDED\",\"subType\":\"Vouchers\",\"url\":\"https://external-url.com\",\"name\":\"Vouchers\",\"imageUrl\":\"https://external-url.com/vouchers-icon.jpeg\",\"description\":\"Vouchers allow you to pay with voucher code.\"}]" \
-d "expires=2016-06-01" \
-d "redirectUri=http://somewhere.com/else/" \
-d "cancelUri=http://somewhere.com" \
-d "buyerUserId=632784"
Response
This endpoint supports the JSON and JSON-P response formats.
Success: 200 OK
Returns the newly created paylink object
Paylink
paylinkId | integer (as string)Paylink ID Although the typical format is as an integer we recommend using 36 character length string so the client ensures to be compatible for future possible changes |
---|---|
clientId | stringID of the client that gets paid (seller client ID). Defaults to the authenticated client |
code | stringPaylink code |
shortUrl | stringPaylink short URL |
sellerUserId | integer (as string)ID of the user that gets paid. If set, will connect this paylink to the user as seller and receiver of payment |
buyerUserId | integer (as string)ID of the user that can pay. If set, will lock this paylink to this user |
clientReference | stringClient's custom reference |
title | stringThe title shown to the user in the payment flow. Will also be shown on Payex' "new credit card" page |
purchaseFlow | Purchase flowDefaults to DIRECT (1 phase payment, no authorization) |
paymentOptions | Payment optionsPayment options can be returned in two formats (depending on format provided in Paylink create request): as a bit mask or as a JSON array of objects (this format allows providing data for external payment methods). |
redirectUri | stringThe URL the user is redirected to after payment. Can also be overridden by the client in the payment flow |
cancelUri | stringThe URL the user is redirected to if the user aborts the payment or login flow. Can also be overridden by the client in payment flow |
expires | stringWhen the paylink will expire. A unix timestamp or a datetime. Defaults to 24 hours from creation |
status | Paylink status |
updated | datetimeWhen the paylink was last updated |
updatedBy | stringID of the person/client who last updated the paylink |
created | datetimeWhen the paylink was created |
createdBy | stringID of the person/client who created the paylink |
items | collection of Paylink items, as an object with |
Purchase flow
An enum, with the following possible values:
| Direct purchase flow |
---|---|
| Authorize/Capture purchase flow |
Paylink status
An enum, with the following possible values:
| Deleted |
---|---|
| Not available |
| Available |
| Used |
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:
| Masterpass |
---|---|
| Credit card |
| SMS |
| PayEx Invoice |
| Voucher |
| Klarna Invoice |
| Klarna Mobile |
| Wallet |
Payment options - array format
This format allows providing data for provided payment methods. See the provided payment methods specification for further details.
type | Payment option typeRequired. Example: PAYEX_CC, STREX, PROVIDED |
---|---|
subType | stringRequired when type is PROVIDED. A subtype used to distinguish between various types of provided payment methods. |
url | stringRequired when type is PROVIDED. User is redirected to this URL after choosing payment with provided payment method. |
name | stringRequired when type is PROVIDED. Provided payment method name. |
imageUrl | stringRequired when type is PROVIDED. Provided payment method image url. |
description | stringRequired when type is PROVIDED. Provided payment method description. |
Paylink item
paylinkItemId | integer (as string) |
---|---|
paylinkId | integer (as string) |
clientId | stringID of the client that gets paid (seller client_id) |
productId | integer (as string)ID of an existing product in Schibsted account |
clientItemReference | stringClient's custom reference for this item |
type | Paylink item type |
name | stringControl receipt item name, optional, uses Paylink title if not set |
description | stringControl cart item description |
ogpUri | stringOpen Graph Protocol enabled URI representing the product being purchased |
price | integer (as string)Price (including VAT amount), in "cents". 0 or a positive integer. |
vat | integer (as string)VAT, fraction × 10000. For instance, 25% would be 2500 |
currency | stringCurrency. Ex. NOK. Defaults to the to platform currency |
quantity | integer (as string)The quantity of this item. Defaults to 1, the total cost is price multiplied by quantity |
updated | stringWhen the paylink was last changed |
updatedBy | stringID of the user/client who last updated the paylink item |
created | stringWhen the paylink item was created |
createdBy | stringID of the user/client who created the paylink item |
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.
- 400 Bad Request Missing one or more required parameters
- 400 Bad Request Paylink items is not a list of items
- 400 Bad Request Validation error(s)
- 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 Schibsted account 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 Paylink not found
- 420 Request Ratelimit exceeded
Sample response
JSON
{
"sellerUserId": null,
"updatedBy": "52f8e3d9efd04bb749000000",
"status": "1",
"clientReference": "Order number #3242",
"items": {
"6199": {
"updatedBy": null,
"vat": "1917",
"clientId": "[Your client ID]",
"currency": "NOK",
"paylinkId": "4638",
"createdBy": "[ID of admin user, or client]",
"quantity": "1",
"ogpUri": null,
"productId": null,
"clientItemReference": null,
"created": "2014-08-06 08:16:36",
"updated": "2014-08-06 08:16:36",
"type": "0",
"paylinkItemId": "6199",
"price": "7983",
"description": "Star Wars IV"
}
},
"clientId": "[Your client ID]",
"paylinkId": "4638",
"cancelUri": "http://localhost:8000/cancel",
"createdBy": "[ID of admin user, or client]",
"expires": "2014-08-07 08:16:36",
"buyerUserId": null,
"title": "Star Wars Movies",
"code": "4638",
"created": "2014-08-06 08:16:36",
"updated": "2014-08-06 08:16:36",
"shortUrl": "https://identity-pre.schibsted.com/auth/start?paylink\u003d4638",
"paymentOptions": "2",
"purchaseFlow": "DIRECT",
"redirectUri": "http://localhost:8000/callback"
}
JSON-P
callback({
"sellerUserId": null,
"updatedBy": "52f8e3d9efd04bb749000000",
"status": "1",
"clientReference": "Order number #3242",
"items": {
"6199": {
"updatedBy": null,
"vat": "1917",
"clientId": "[Your client ID]",
"currency": "NOK",
"paylinkId": "4638",
"createdBy": "[ID of admin user, or client]",
"quantity": "1",
"ogpUri": null,
"productId": null,
"clientItemReference": null,
"created": "2014-08-06 08:16:36",
"updated": "2014-08-06 08:16:36",
"type": "0",
"paylinkItemId": "6199",
"price": "7983",
"description": "Star Wars IV"
}
},
"clientId": "[Your client ID]",
"paylinkId": "4638",
"cancelUri": "http://localhost:8000/cancel",
"createdBy": "[ID of admin user, or client]",
"expires": "2014-08-07 08:16:36",
"buyerUserId": null,
"title": "Star Wars Movies",
"code": "4638",
"created": "2014-08-06 08:16:36",
"updated": "2014-08-06 08:16:36",
"shortUrl": "https://identity-pre.schibsted.com/auth/start?paylink\u003d4638",
"paymentOptions": "2",
"purchaseFlow": "DIRECT",
"redirectUri": "http://localhost:8000/callback"
});
Comments/feedback
Do you have questions, or just want to contribute some newly gained insight? Want to share an example? Please leave a comment. Our team reads and responds to every question. Additionally, your experience can help others using Schibsted account, and it can help us continuously improve our documentation.