Create

View latest version »

This method is used to create a new checkout resource. The body of a create method call contains the JSON-representation of the checkout-resource.

HTTP-message

Request Response
Header
  • Content-Type: application/json;
Body
Checkout-resource  Checkout-resource

The test URI is https://test-api.payson.se/2.0/Checkouts

Response codes

Code Status Info
201 Created The call was successful. The created resource will be returned in the response body.
400 Bad request The call failed. Look at the returned JSON-object for more information.
401 Unauthorized The authorization failed. Check the authorization field in the header.

Request

POST https://api.payson.se/2.0/Checkouts HTTP/1.1
Host: api.payson.se
Accept: application/json
Authorization: Basic MTIzNDpkYzE1NzE4Mi1lMjVhLTQwMDgtYmQwOS05MDNkZjM0MjhkYjQ=
Content-Type: application/json
Content-Length: 778

{
“order”: {
“currency”: “sek”,
“items”: [
{
“name”: “TestItem1”,
“quantity”: 1,
“taxRate”: 0.4,
“unitPrice”: 100
},
{
“name”: “TestItem2”,
“quantity”: 3,
“taxRate”: 0.25,
“unitPrice”: 50
}
]
},
“merchant”: {
“checkoutUri”: “http://www.adress.xyz/Checkout?id=123”,
“confirmationUri”: “http://www.adress.xyz/Confirmation?id=123”,
“notificationUri”: “http://www.addres.xyz/Notification?id=123”,
“termsUri”: “http://www.addres.xyz/Terms”
}
}

Response

HTTP/1.1 201 Created
Location: https://api.payson.se/2.0/Checkouts/264d3bfd-f7a1-4122-8556-a56700f71eaa
Content-Length: 1435

{
“status”: “created”,
“id”: “264d3bfd-f7a1-4122-8556-a56700f71eaa”,
“snippet”: “<iframe id=’checkoutIframe’ name=’checkoutIframe’
src=’http://embedded.payson.se/checkout?id=264d3bfd-f7a1-4122-8556-a56700f71eaa’
style=’width:100%; height: 100%’ frameborder=’0′ scrolling=’no’></iframe>”,
“customer”: {
“type”: “person”
},
“order”: {
“currency”: “sek”,
“totalPriceExcludingTax”: 172.5,
“totalPriceIncludingTax”: 250,
“totalTaxAmount”: 77.5,
“items”: [
{
“itemId”: “c363d219-191e-41df-a502-a56700f71eb6”,
“discountRate”: 0,
“name”: “TestItem1”,
“quantity”: 1,
“taxRate”: 0.4,
“totalPriceExcludingTax”: 60,
“totalPriceIncludingTax”: 100,
“totalTaxAmount”: 40,
“creditedAmount”: 0,
“type”: “physical”,
“unitPrice”: 100
},
{
“itemId”: “1489c744-7acd-4ed8-b839-a56700f71eb6”,
“discountRate”: 0,
“name”: “TestItem2”,
“quantity”: 3,
“taxRate”: 0.25,
“totalPriceExcludingTax”: 112.5,
“totalPriceIncludingTax”: 150,
“totalTaxAmount”: 37.5,
“creditedAmount”: 0,
“type”: “physical”,
“unitPrice”: 50
}
]
},
“merchant”: {
“checkoutUri”: “http://www.adress.xyz/Checkout?id=123”,
“confirmationUri”: “http://www.adress.xyz/Confirmation?id=123”,
“partnerId”: 0,
“notificationUri”: “http://www.addres.xyz/Notification?id=123”,
“termsUri”: “http://www.addres.xyz/Terms”
},
“gui”: {
“colorScheme”: “blue”,
“locale”: “en”,
“verfication”: “none”,
“requestPhone”: false
},
“history”: {
“created”: “2015-12-07T14:59:44”
},
“links”: [
{
“href”: “https://api.payson.se/2.0/Checkouts/264d3bfd-f7a1-4122-8556-a56700f71eaa”,
“rel”: “self”
}
]
}