Documentation

Before you begin

Before you begin, make sure to:

Every response of our API has the same structure and represents current state of the session. html_snippet is used to to embed the Shipping Selector to your e-commerce checkout page (see Frontend Integration for more details).

Note

This section shows the examples of usage of the Delivery Checkout API in form of HTTP request calls. You can leverage Delivery Checkout API Swagger to generate a client complying to the API and get started with using our API quickly.


Please note that we reserve the right to introduce additional fields to our API responses without prior notification. Users are encouraged to regularly check for updates in our documentation for any changes that may impact their integration.

Create Checkout Session

When the customer is ready to finalize the purchase, you need to create a Checkout Session from your backend. The simplest possible request is presented below. Newly created session is in an ACTIVE state. For the full request fields reference, please see CreateSessionRequest.

POST /v1/delivery_checkout/session.create HTTP/1.1
Host: api.ingrid.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=
Content-Length: 356

{
"purchase_country": "SE",
"purchase_currency": "SEK",
"cart": {
"total_value": 10000,
"items": [
{
"sku": "SKU12345",
"name": "Saucony Shadow 6000",
"quantity": 1
}
],
"cart_id": "UNIQUE_ID"
},
"locales": [
"sv-SE"
]
}
curl --location --request POST 'https://api.ingrid.com/v1/delivery_checkout/session.create' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=' \
--data-raw '{
"purchase_country": "SE",
"purchase_currency": "SEK",
"cart": {
"total_value": 10000,
"items": [
{
"sku": "SKU12345",
"name": "Saucony Shadow 6000",
"quantity": 1
}
],
"cart_id": "UNIQUE_ID"
},
"locales": [
"sv-SE"
]
}'

var https = require("follow-redirects").https;
var fs = require("fs");

var options = {
method: "POST",
hostname: "api.ingrid.com",
path: "/v1/delivery_checkout/session.create",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=",
},
maxRedirects: 20,
};

var req = https.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});

res.on("error", function (error) {
console.error(error);
});
});

var postData = JSON.stringify({
purchase_country: "SE",
purchase_currency: "SEK",
cart: {
total_value: 10000,
items: [
{
sku: "SKU12345",
name: "Saucony Shadow 6000",
quantity: 1,
},
],
cart_id: "UNIQUE_ID",
},
locales: ["sv-SE"],
});

req.write(postData);

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ingrid.com/v1/delivery_checkout/session.create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"purchase_country": "SE",
"purchase_currency": "SEK",
"cart": {
"total_value": 10000,
"items": [
{
"sku": "SKU12345",
"name": "Saucony Shadow 6000",
"quantity": 1
}
],
"cart_id": "UNIQUE_ID"
},
"locales": [
"sv-SE"
]
}'
,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("api.ingrid.com")
payload = json.dumps({
"purchase_country": "SE",
"purchase_currency": "SEK",
"cart": {
"total_value": 10000,
"items": [
{
"sku": "SKU12345",
"name": "Saucony Shadow 6000",
"quantity": 1
}
],
"cart_id": "UNIQUE_ID"
},
"locales": [
"sv-SE"
]
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
}
conn.request("POST", "/v1/delivery_checkout/session.create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
{
"session": {
"checkout_session_id": "VM2-0bf1dd5954d04661a4a97d0319710aca",
"status": "ACTIVE",
"updated_at": "2022-09-30T05:15:48Z",
"cart": {
"total_value": 10000,
"total_discount": 0,
"items": [
{
"sku": "SKU12345",
"name": "Saucony Shadow 6000",
"quantity": 1,
"price": 0
}
],
"cart_id": "UNIQUE_ID"
},
"delivery_groups": [
{
"items": [
{
"sku": "SKU12345",
"quantity": 1
}
],
"shipping": {
"delivery_type": "delivery",
"supports": {},
"warehouse": {
"address": {
"name": "Main Warehouse",
"address_lines": ["Sveavägen 21"],
"city": "Stockholm",
"postal_code": "112 22",
"country": "SE"
}
},
"carrier_product_id": "pnl"
},
"category": {
"id": "delivery-9892c6c022b948138d7e52128b44bc07",
"name": "Delivery",
"presented_category_name": "Delivery"
},
"pricing": {
"currency": "SEK",
"price": 1000,
"price_components": [
{
"type": "PRICE_COMPONENT_TYPE_SHIPPING",
"value": 1000
}
]
},
"selection": "PRESELECTED_CHOICE",
"delivery_time": {
"pickup_from_merchant": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-03T00:00:00+02:00"
},
"customer_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
},
"carrier_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
}
},
"addresses": {}
}
]
},
"html_snippet": "<div></div>",
"token": "XXxpZW50dHdvOjMzZDcwNzIwYjU1NjQ3OTdhMDNkMDQwN2I0N2RlYzg2"
}

Pull Checkout Session

At any point of a session lifetime, session can be fetched using session.pull call. The only argument to this call is ID of the session.

This call is not idempotent. Ingrid will make sure, that shipping options presented to the customer are still valid and will try to refresh them in this case. If you want to just have the snapshot of a session use session.get instead.

GET /v1/delivery_checkout/session.pull?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca HTTP/1.1
Host: api.ingrid.com
Accept: application/json
Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=
curl --location --request GET 'https://api.ingrid.com/v1/delivery_checkout/session.pull?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
var https = require("follow-redirects").https;
var fs = require("fs");

var options = {
method: "GET",
hostname: "api.ingrid.com",
path: "/v1/delivery_checkout/session.pull?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca",
headers: {
Accept: "application/json",
Authorization: "Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=",
},
maxRedirects: 20,
};

var req = https.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});

res.on("error", function (error) {
console.error(error);
});
});

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ingrid.com/v1/delivery_checkout/session.pull?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("api.ingrid.com")
payload = ''
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
}
conn.request("GET", "/v1/delivery_checkout/session.pull?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
{
"session": {
"checkout_session_id": "VM2-0bf1dd5954d04661a4a97d0319710aca",
"status": "ACTIVE",
"updated_at": "2022-09-30T05:23:27Z",
"cart": {
"total_value": 10000,
"total_discount": 0,
"items": [
{
"sku": "SKU12345",
"name": "Saucony Shadow 6000",
"quantity": 1,
"price": 0
}
],
"cart_id": "UNIQUE_ID"
},
"delivery_groups": [
{
"items": [
{
"sku": "SKU12345"
}
],
"shipping": {
"delivery_type": "delivery",
"supports": {},
"warehouse": {
"address": {
"name": "Main Warehouse",
"address_lines": [
"Sveavägen 21"
],
"city": "Stockholm",
"postal_code": "112 22",
"country": "SE"
}
},
"carrier_product_id": "pnl"
},
"category": {
"id": "delivery-9892c6c022b948138d7e52128b44bc07",
"name": "Delivery",
"presented_category_name": "Delivery"
},
"pricing": {
"currency": "SEK",
"price": 1000,
"price_components": [
{
"type": "PRICE_COMPONENT_TYPE_SHIPPING",
"value": 1000
}
]
},
"selection": "PRESELECTED_CHOICE",
"delivery_time": {
"pickup_from_merchant": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-03T00:00:00+02:00"
},
"customer_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
},
"carrier_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
}
},
"addresses": {}
}
]
},
"html_snippet":"<div></div>"
}

Get Checkout Session

At any point of a session lifetime, session can be fetched using session.get call. The only argument to this call is the checkout_session_id of the session.

Delivery promises presented in category options have a certain time of freshness, during which they are valid. After a certain time has passed, the validity of delivery promise expires and the delivery promise has to be generated again.

This call is idempotent. If you want to also regenerate expired delivery promises for current time use session.pull instead.

GET /v1/delivery_checkout/session.get?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca HTTP/1.1
Host: api.ingrid.com
Accept: application/json
Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=
curl --location --request GET 'https://api.ingrid.com/v1/delivery_checkout/session.get?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
var https = require("follow-redirects").https;
var fs = require("fs");

var options = {
method: "GET",
hostname: "api.ingrid.com",
path: "/v1/delivery_checkout/session.get?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca",
headers: {
Accept: "application/json",
Authorization: "Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=",
},
maxRedirects: 20,
};

var req = https.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});

res.on("error", function (error) {
console.error(error);
});
});

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ingrid.com/v1/delivery_checkout/session.get?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client

conn = http.client.HTTPSConnection("api.ingrid.com")
payload = ''
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
}
conn.request("GET", "/v1/delivery_checkout/session.get?checkout_session_id=VM2-0bf1dd5954d04661a4a97d0319710aca", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
{
"session": {
"checkout_session_id": "VM2-0bf1dd5954d04661a4a97d0319710aca",
"status": "ACTIVE",
"updated_at": "2022-09-30T05:23:27Z",
"cart": {
"total_value": 10000,
"total_discount": 0,
"items": [
{
"sku": "SKU12345",
"name": "Saucony Shadow 6000",
"quantity": 1,
"price": 0
}
],
"cart_id": "UNIQUE_ID"
},
"delivery_groups": [
{
"items": [
{
"sku": "SKU12345"
}
],
"shipping": {
"delivery_type": "delivery",
"supports": {},
"warehouse": {
"address": {
"name": "Main Warehouse",
"address_lines": [
"Sveavägen 21"
],
"city": "Stockholm",
"postal_code": "112 22",
"country": "SE"
}
},
"carrier_product_id": "pnl"
},
"category": {
"id": "delivery-9892c6c022b948138d7e52128b44bc07",
"name": "Delivery",
"presented_category_name": "Delivery"
},
"pricing": {
"currency": "SEK",
"price": 1000,
"price_components": [
{
"type": "PRICE_COMPONENT_TYPE_SHIPPING",
"value": 1000
}
]
},
"selection": "PRESELECTED_CHOICE",
"delivery_time": {
"pickup_from_merchant": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-03T00:00:00+02:00"
},
"customer_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
},
"carrier_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
}
},
"addresses": {}
}
]
},
"html_snippet":"<div></div>"
}

Update Checkout Session

The session.update method can be used to update the cart contents or to apply shipping date changes or split to the cart items among other things. You can update either cart, apply shipping date, split cart items or everything in one request. To learn more about the fields that update checkout session call can change, please see the Swagger.

For the full request description see UpdateSessionRequest.

POST /v1/delivery_checkout/session.update HTTP/1.1
Host: api.ingrid.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=
Content-Length: 99

{
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID"
}
curl --location --request POST 'https://api.ingrid.com/v1/delivery_checkout/session.update' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=' \
--data-raw '{
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID"
}'

var https = require("follow-redirects").https;
var fs = require("fs");

var options = {
method: "POST",
hostname: "api.ingrid.com",
path: "/v1/delivery_checkout/session.update",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=",
},
maxRedirects: 20,
};

var req = https.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});

res.on("error", function (error) {
console.error(error);
});
});

var postData = JSON.stringify({
checkout_session_id: "VM2-ac8251c243f5410da9e42dc1a81dea39",
external_id: "EXTERNAL_ID",
});

req.write(postData);

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ingrid.com/v1/delivery_checkout/session.update',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID"
}'
,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("api.ingrid.com")
payload = json.dumps({
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID"
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
}
conn.request("POST", "/v1/delivery_checkout/session.update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
{
"session": {
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"status": "ACTIVE",
"updated_at": "2022-09-30T05:51:00Z",
"cart": {
"total_value": 1000,
"total_discount": 0,
"items": [
{
"sku": "sku-1",
"name": "Item name 1",
"quantity": 1,
"price": 900
},
{
"sku": "sku-2",
"name": "Item name 2",
"quantity": 1,
"price": 100
}
],
"cart_id": "cart-identifier"
},
"delivery_groups": [
{
"header": "Delivery 1",
"items": [
{
"sku": "sku-1",
"quantity": 1
}
],
"shipping": {
"delivery_type": "delivery",
"carrier": "PostNord",
"supports": {},
"warehouse": {
"address": {
"name": "Main Warehouse",
"address_lines": ["Sveavägen 21"],
"city": "Stockholm",
"postal_code": "112 22",
"country": "SE"
}
},
"carrier_product_id": "pnl"
},
"category": {
"id": "delivery-9892c6c022b948138d7e52128b44bc07",
"name": "Delivery",
"presented_category_name": "Delivery"
},
"pricing": {
"currency": "SEK",
"price": 1000,
"price_components": [
{
"type": "PRICE_COMPONENT_TYPE_SHIPPING",
"value": 1000
}
]
},
"selection": "PRESELECTED_CHOICE",
"delivery_time": {
"pickup_from_merchant": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-03T00:00:00+02:00"
},
"customer_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
},
"carrier_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
}
},
"external_id": "EXTERNAL_ID",
"group_id": "group-1",
"addresses": {}
},
{
"header": "Delivery 2",
"items": [
{
"sku": "sku-2",
"quantity": 1
}
],
"shipping": {
"delivery_type": "delivery",
"carrier": "PostNord",
"supports": {},
"warehouse": {
"address": {
"name": "Main Warehouse",
"address_lines": ["Sveavägen 21"],
"city": "Stockholm",
"postal_code": "112 22",
"country": "SE"
}
},
"carrier_product_id": "pnl"
},
"category": {
"id": "delivery-9892c6c022b948138d7e52128b44bc07",
"name": "Delivery",
"presented_category_name": "Delivery"
},
"pricing": {
"currency": "SEK",
"price": 1000,
"price_components": [
{
"type": "PRICE_COMPONENT_TYPE_SHIPPING",
"value": 1000
}
]
},
"selection": "PRESELECTED_CHOICE",
"delivery_time": {
"pickup_from_merchant": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-03T00:00:00+02:00"
},
"customer_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
},
"carrier_delivery_promise": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-04T00:00:00+02:00"
}
},
"external_id": "EXTERNAL_ID",
"group_id": "group-2",
"addresses": {}
}
]
},
"html_snippet": "<div></div>"
}

Complete Checkout Session

The session.complete method is used when the checkout is done. The state of the session is changed from ACTIVE to COMPLETE. At this point, if the customer has not made a choice we will generate one for the customer based on the information in the customer field provided in the request. After this action the session will be "frozen" and could not be modified.

If you are using Address Form the customer field is not required anymore.

We will also generate a Transport Order Identifier (tos_id), that could be used to book a delivery.

For the full request description see CompleteSessionRequest.

POST /v1/delivery_checkout/session.complete HTTP/1.1
Host: api.ingrid.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=
Content-Length: 278

{
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID",
"customer": {
"address_lines": [
"Jakobsgatan 11"
],
"city": "Stockholm",
"country": "SE",
"phone": "+46123456789",
"postal_code": "112 46",
"email": "test@ingrid.com"
}
}
curl --location --request POST 'https://api.ingrid.com/v1/delivery_checkout/session.complete' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=' \
--data-raw '{
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID",
"customer": {
"address_lines": [
"Jakobsgatan 11"
],
"city": "Stockholm",
"country": "SE",
"phone": "+46123456789",
"postal_code": "112 46",
"email": "test@ingrid.com"
}
}'

var https = require("follow-redirects").https;
var fs = require("fs");

var options = {
method: "POST",
hostname: "api.ingrid.com",
path: "/v1/delivery_checkout/session.complete",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE=",
},
maxRedirects: 20,
};

var req = https.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});

res.on("error", function (error) {
console.error(error);
});
});

var postData = JSON.stringify({
checkout_session_id: "VM2-ac8251c243f5410da9e42dc1a81dea39",
external_id: "EXTERNAL_ID",
customer: {
address_lines: ["Jakobsgatan 11"],
city: "Stockholm",
country: "SE",
phone: "+46123456789",
postal_code: "112 46",
email: "test@ingrid.com",
},
});

req.write(postData);

req.end();
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.ingrid.com/v1/delivery_checkout/session.complete',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID",
"customer": {
"address_lines": [
"Jakobsgatan 11"
],
"city": "Stockholm",
"country": "SE",
"phone": "+46123456789",
"postal_code": "112 46",
"email": "test@ingrid.com"
}
}'
,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
import http.client
import json

conn = http.client.HTTPSConnection("api.ingrid.com")
payload = json.dumps({
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"external_id": "EXTERNAL_ID",
"customer": {
"address_lines": [
"Jakobsgatan 11"
],
"city": "Stockholm",
"country": "SE",
"phone": "+46123456789",
"postal_code": "112 46",
"email": "test@ingrid.com"
}
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer XXE5ODA0NTU0Y2JmNDRkYjhiYTdhM2NhX2EyZjFiNGE='
}
conn.request("POST", "/v1/delivery_checkout/session.complete", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
{
"session": {
"checkout_session_id": "VM2-ac8251c243f5410da9e42dc1a81dea39",
"status": "COMPLETE",
"updated_at": "2022-09-30T05:57:56Z",
"cart": {
"total_value": 1000,
"total_discount": 0,
"items": [
{
"sku": "sku-1",
"name": "Item name 1",
"quantity": 1,
"price": 900
},
{
"sku": "sku-2",
"name": "Item name 2",
"quantity": 1,
"price": 100
}
],
"cart_id": "cart-identifier"
},
"delivery_groups": [
{
"header": "Delivery 1",
"items": [
{
"sku": "sku-1",
"quantity": 1
}
],
"shipping": {
"delivery_type": "delivery",
"carrier": "PostNord",
"product": "MyPack Home",
"supports": {},
"warehouse": {
"address": {
"name": "Main Warehouse",
"address_lines": ["Sveavägen 21"],
"city": "Stockholm",
"postal_code": "112 22",
"country": "SE"
}
},
"carrier_product_id": "pnl"
},
"category": {
"id": "delivery-9892c6c022b948138d7e52128b44bc07",
"name": "Delivery",
"presented_category_name": "Delivery"
},
"pricing": {
"currency": "SEK",
"price": 1000,
"price_components": [
{
"type": "PRICE_COMPONENT_TYPE_SHIPPING",
"value": 1000
}
]
},
"selection": "PRESELECTED_CHOICE",
"delivery_time": {
"pickup_from_merchant": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-03T00:00:00+02:00"
},
"customer_delivery_promise": {
"earliest": "2022-10-04T00:00:00+02:00",
"latest": "2022-10-06T00:00:00+02:00"
},
"carrier_delivery_promise": {
"earliest": "2022-10-04T00:00:00+02:00",
"latest": "2022-10-06T00:00:00+02:00"
}
},
"tos_id": "01GE6FJ2J52Z2NHRY17HDJ1977",
"external_id": "EXTERNAL_ID",
"group_id": "group-1",
"addresses": {
"customer": {
"address_lines": ["Jakobsgatan 11"],
"city": "Stockholm",
"postal_code": "112 46",
"country": "SE",
"coordinates": {
"lat": 59.33648297029083,
"lng": 18.03103453818516
},
"email": "test@ingrid.com",
"phone": "+46123456789"
}
}
},
{
"header": "Delivery 2",
"items": [
{
"sku": "sku-2",
"quantity": 1
}
],
"shipping": {
"delivery_type": "delivery",
"carrier": "PostNord",
"product": "MyPack Home",
"supports": {},
"warehouse": {
"address": {
"name": "Main Warehouse",
"address_lines": ["Sveavägen 21"],
"city": "Stockholm",
"postal_code": "112 22",
"country": "SE"
}
},
"carrier_product_id": "pnl"
},
"category": {
"id": "delivery-9892c6c022b948138d7e52128b44bc07",
"name": "Delivery",
"presented_category_name": "Delivery"
},
"pricing": {
"currency": "SEK",
"price": 1000,
"price_components": [
{
"type": "PRICE_COMPONENT_TYPE_SHIPPING",
"value": 1000
}
]
},
"selection": "PRESELECTED_CHOICE",
"delivery_time": {
"pickup_from_merchant": {
"earliest": "2022-10-03T00:00:00+02:00",
"latest": "2022-10-03T00:00:00+02:00"
},
"customer_delivery_promise": {
"earliest": "2022-10-04T00:00:00+02:00",
"latest": "2022-10-06T00:00:00+02:00"
},
"carrier_delivery_promise": {
"earliest": "2022-10-04T00:00:00+02:00",
"latest": "2022-10-06T00:00:00+02:00"
}
},
"tos_id": "01GE6FJ2J5D3QHTD57XX0B38TS",
"external_id": "EXTERNAL_ID",
"group_id": "group-2",
"addresses": {
"customer": {
"address_lines": ["Jakobsgatan 11"],
"city": "Stockholm",
"postal_code": "112 46",
"country": "SE",
"coordinates": {
"lat": 59.33648297029083,
"lng": 18.03103453818516
},
"email": "test@ingrid.com",
"phone": "+46123456789"
}
}
}
]
}
}

Errors

Concurrent updates

Session pull, update and complete calls can fail when another concurrent call is made, that updates the session resource. In that case, the response to this call would be a message with HTTP 409 Conflict code, and the call would have to be made again.

Last updated: Thu, Mar 28, 06:15 AM