Conversions & Sales
Checkout cart process
Process checkout cart information on Doofinder statistics.
POST
/
api
/
v2
/
stats
/
carts
Checkout cart process
curl --request POST \
--url https://{search_zone}-api.doofinder.com/api/v2/stats/carts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"checkout_json": [
{
"id": "prod_12345",
"price": 29.99,
"quantity": 2
},
{
"id": "prod_67890",
"price": "$12.50",
"quantity": 1
}
],
"hashid": "<string>",
"currency": "EUR",
"ip": "<string>",
"referer": "<string>",
"session_id": "<string>",
"user_agent": "<string>",
"user_id": "<string>"
}
'import requests
url = "https://{search_zone}-api.doofinder.com/api/v2/stats/carts"
payload = {
"checkout_json": [
{
"id": "prod_12345",
"price": 29.99,
"quantity": 2
},
{
"id": "prod_67890",
"price": "$12.50",
"quantity": 1
}
],
"hashid": "<string>",
"currency": "EUR",
"ip": "<string>",
"referer": "<string>",
"session_id": "<string>",
"user_agent": "<string>",
"user_id": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
checkout_json: [
{id: 'prod_12345', price: 29.99, quantity: 2},
{id: 'prod_67890', price: '$12.50', quantity: 1}
],
hashid: '<string>',
currency: 'EUR',
ip: '<string>',
referer: '<string>',
session_id: '<string>',
user_agent: '<string>',
user_id: '<string>'
})
};
fetch('https://{search_zone}-api.doofinder.com/api/v2/stats/carts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{search_zone}-api.doofinder.com/api/v2/stats/carts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'checkout_json' => [
[
'id' => 'prod_12345',
'price' => 29.99,
'quantity' => 2
],
[
'id' => 'prod_67890',
'price' => '$12.50',
'quantity' => 1
]
],
'hashid' => '<string>',
'currency' => 'EUR',
'ip' => '<string>',
'referer' => '<string>',
'session_id' => '<string>',
'user_agent' => '<string>',
'user_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{search_zone}-api.doofinder.com/api/v2/stats/carts"
payload := strings.NewReader("{\n \"checkout_json\": [\n {\n \"id\": \"prod_12345\",\n \"price\": 29.99,\n \"quantity\": 2\n },\n {\n \"id\": \"prod_67890\",\n \"price\": \"$12.50\",\n \"quantity\": 1\n }\n ],\n \"hashid\": \"<string>\",\n \"currency\": \"EUR\",\n \"ip\": \"<string>\",\n \"referer\": \"<string>\",\n \"session_id\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"user_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{search_zone}-api.doofinder.com/api/v2/stats/carts")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"checkout_json\": [\n {\n \"id\": \"prod_12345\",\n \"price\": 29.99,\n \"quantity\": 2\n },\n {\n \"id\": \"prod_67890\",\n \"price\": \"$12.50\",\n \"quantity\": 1\n }\n ],\n \"hashid\": \"<string>\",\n \"currency\": \"EUR\",\n \"ip\": \"<string>\",\n \"referer\": \"<string>\",\n \"session_id\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"user_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-api.doofinder.com/api/v2/stats/carts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"checkout_json\": [\n {\n \"id\": \"prod_12345\",\n \"price\": 29.99,\n \"quantity\": 2\n },\n {\n \"id\": \"prod_67890\",\n \"price\": \"$12.50\",\n \"quantity\": 1\n }\n ],\n \"hashid\": \"<string>\",\n \"currency\": \"EUR\",\n \"ip\": \"<string>\",\n \"referer\": \"<string>\",\n \"session_id\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"user_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<unknown>"{
"error": {
"code": "bad_params",
"message": "Bad parameters error"
}
}Authorizations
api_tokenjwt_token
Doofinder API key. Pass it as: Authorization: Token <api_key>
Body
application/json
Checkout json array with the cart items basic data.
Show child attributes
Show child attributes
Example:
[
{
"id": "prod_12345",
"price": 29.99,
"quantity": 2
},
{
"id": "prod_67890",
"price": "$12.50",
"quantity": 1
}
]
Unique id of the search engine. In the search engine selector, you will find the hashid information
Pattern:
^[a-f0-9]{32}$Currency of the checkout.
Example:
"EUR"
Unique address that identifies a device. Detected automatically by the server.
The referer header value, provides information about the URL from which the current request originated. Detected automatically by the server.
Identifier of search session
Maximum string length:
32Identifier of device. Detected automatically by the server.
Identifier of user
Maximum string length:
36Response
OK
Response returned over register stat operation.
⌘I
Checkout cart process
curl --request POST \
--url https://{search_zone}-api.doofinder.com/api/v2/stats/carts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"checkout_json": [
{
"id": "prod_12345",
"price": 29.99,
"quantity": 2
},
{
"id": "prod_67890",
"price": "$12.50",
"quantity": 1
}
],
"hashid": "<string>",
"currency": "EUR",
"ip": "<string>",
"referer": "<string>",
"session_id": "<string>",
"user_agent": "<string>",
"user_id": "<string>"
}
'import requests
url = "https://{search_zone}-api.doofinder.com/api/v2/stats/carts"
payload = {
"checkout_json": [
{
"id": "prod_12345",
"price": 29.99,
"quantity": 2
},
{
"id": "prod_67890",
"price": "$12.50",
"quantity": 1
}
],
"hashid": "<string>",
"currency": "EUR",
"ip": "<string>",
"referer": "<string>",
"session_id": "<string>",
"user_agent": "<string>",
"user_id": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
checkout_json: [
{id: 'prod_12345', price: 29.99, quantity: 2},
{id: 'prod_67890', price: '$12.50', quantity: 1}
],
hashid: '<string>',
currency: 'EUR',
ip: '<string>',
referer: '<string>',
session_id: '<string>',
user_agent: '<string>',
user_id: '<string>'
})
};
fetch('https://{search_zone}-api.doofinder.com/api/v2/stats/carts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{search_zone}-api.doofinder.com/api/v2/stats/carts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'checkout_json' => [
[
'id' => 'prod_12345',
'price' => 29.99,
'quantity' => 2
],
[
'id' => 'prod_67890',
'price' => '$12.50',
'quantity' => 1
]
],
'hashid' => '<string>',
'currency' => 'EUR',
'ip' => '<string>',
'referer' => '<string>',
'session_id' => '<string>',
'user_agent' => '<string>',
'user_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{search_zone}-api.doofinder.com/api/v2/stats/carts"
payload := strings.NewReader("{\n \"checkout_json\": [\n {\n \"id\": \"prod_12345\",\n \"price\": 29.99,\n \"quantity\": 2\n },\n {\n \"id\": \"prod_67890\",\n \"price\": \"$12.50\",\n \"quantity\": 1\n }\n ],\n \"hashid\": \"<string>\",\n \"currency\": \"EUR\",\n \"ip\": \"<string>\",\n \"referer\": \"<string>\",\n \"session_id\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"user_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{search_zone}-api.doofinder.com/api/v2/stats/carts")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"checkout_json\": [\n {\n \"id\": \"prod_12345\",\n \"price\": 29.99,\n \"quantity\": 2\n },\n {\n \"id\": \"prod_67890\",\n \"price\": \"$12.50\",\n \"quantity\": 1\n }\n ],\n \"hashid\": \"<string>\",\n \"currency\": \"EUR\",\n \"ip\": \"<string>\",\n \"referer\": \"<string>\",\n \"session_id\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"user_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{search_zone}-api.doofinder.com/api/v2/stats/carts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"checkout_json\": [\n {\n \"id\": \"prod_12345\",\n \"price\": 29.99,\n \"quantity\": 2\n },\n {\n \"id\": \"prod_67890\",\n \"price\": \"$12.50\",\n \"quantity\": 1\n }\n ],\n \"hashid\": \"<string>\",\n \"currency\": \"EUR\",\n \"ip\": \"<string>\",\n \"referer\": \"<string>\",\n \"session_id\": \"<string>\",\n \"user_agent\": \"<string>\",\n \"user_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<unknown>"{
"error": {
"code": "bad_params",
"message": "Bad parameters error"
}
}