JavaScript
import HenrySDK from '@henrylabs/sdk';
const client = new HenrySDK({
apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
});
const response = await client.cart.checkout.details('crt_sa2aEsCz9PRM', {
buyer: {
shippingAddress: {
line1: '123 Main St',
line2: 'Apt 4B',
city: 'Anytown',
province: 'CA',
postalCode: '12345',
countryCode: 'US',
},
},
coupons: ['SUMMER21', 'FREESHIP'],
mode: 'async',
});
console.log(response.data);curl --request POST \
--url https://api.henrylabs.ai/v1/cart/{cartId}/details \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"buyer": {
"shippingAddress": {
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "Anytown",
"province": "CA",
"postalCode": "12345",
"countryCode": "US"
}
},
"coupons": [
"SUMMER21",
"FREESHIP"
],
"mode": "async"
}
'import requests
url = "https://api.henrylabs.ai/v1/cart/{cartId}/details"
payload = {
"buyer": { "shippingAddress": {
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "Anytown",
"province": "CA",
"postalCode": "12345",
"countryCode": "US"
} },
"coupons": ["SUMMER21", "FREESHIP"],
"mode": "async"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.henrylabs.ai/v1/cart/{cartId}/details",
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([
'buyer' => [
'shippingAddress' => [
'line1' => '123 Main St',
'line2' => 'Apt 4B',
'city' => 'Anytown',
'province' => 'CA',
'postalCode' => '12345',
'countryCode' => 'US'
]
],
'coupons' => [
'SUMMER21',
'FREESHIP'
],
'mode' => 'async'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://api.henrylabs.ai/v1/cart/{cartId}/details"
payload := strings.NewReader("{\n \"buyer\": {\n \"shippingAddress\": {\n \"line1\": \"123 Main St\",\n \"line2\": \"Apt 4B\",\n \"city\": \"Anytown\",\n \"province\": \"CA\",\n \"postalCode\": \"12345\",\n \"countryCode\": \"US\"\n }\n },\n \"coupons\": [\n \"SUMMER21\",\n \"FREESHIP\"\n ],\n \"mode\": \"async\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.henrylabs.ai/v1/cart/{cartId}/details")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"buyer\": {\n \"shippingAddress\": {\n \"line1\": \"123 Main St\",\n \"line2\": \"Apt 4B\",\n \"city\": \"Anytown\",\n \"province\": \"CA\",\n \"postalCode\": \"12345\",\n \"countryCode\": \"US\"\n }\n },\n \"coupons\": [\n \"SUMMER21\",\n \"FREESHIP\"\n ],\n \"mode\": \"async\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.henrylabs.ai/v1/cart/{cartId}/details")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"buyer\": {\n \"shippingAddress\": {\n \"line1\": \"123 Main St\",\n \"line2\": \"Apt 4B\",\n \"city\": \"Anytown\",\n \"province\": \"CA\",\n \"postalCode\": \"12345\",\n \"countryCode\": \"US\"\n }\n },\n \"coupons\": [\n \"SUMMER21\",\n \"FREESHIP\"\n ],\n \"mode\": \"async\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status": "<string>",
"message": "<string>",
"data": {
"jobs": [
{
"refId": "<string>",
"result": {
"items": [
{
"shippingOptions": [
{
"id": "<string>",
"name": "<string>",
"cost": {
"value": 123
},
"timeEstimate": "<string>",
"minDate": "<string>",
"maxDate": "<string>"
}
],
"costs": {
"subtotal": {
"value": 123
},
"total": {
"value": 123
},
"tax": {
"value": 123
},
"shipping": {
"value": 123
},
"discount": {
"value": 123
}
},
"coupons": [
{
"code": "<string>",
"available": true,
"savedAmount": {
"value": 123
}
}
]
}
],
"data": {
"shippingOptions": [
{
"id": "<string>",
"name": "<string>",
"cost": {
"value": 123
},
"timeEstimate": "<string>",
"minDate": "<string>",
"maxDate": "<string>"
}
],
"costs": {
"subtotal": {
"value": 123
},
"total": {
"value": 123
},
"tax": {
"value": 123
},
"shipping": {
"value": 123
},
"discount": {
"value": 123
}
},
"coupons": [
{
"code": "<string>",
"available": true,
"savedAmount": {
"value": 123
}
}
]
}
},
"error": {}
}
],
"metadata": {}
}
}{
"success": true,
"status": "<string>",
"message": "<string>"
}{
"success": true,
"status": "<string>",
"message": "<string>"
}Cart
Cart Details
Retrieve detailed information about a cart. Requests are async by default, or use mode=sync to wait up to 30 seconds for completion.
POST
/
cart
/
{cartId}
/
details
JavaScript
import HenrySDK from '@henrylabs/sdk';
const client = new HenrySDK({
apiKey: process.env['HENRY_SDK_API_KEY'], // This is the default and can be omitted
});
const response = await client.cart.checkout.details('crt_sa2aEsCz9PRM', {
buyer: {
shippingAddress: {
line1: '123 Main St',
line2: 'Apt 4B',
city: 'Anytown',
province: 'CA',
postalCode: '12345',
countryCode: 'US',
},
},
coupons: ['SUMMER21', 'FREESHIP'],
mode: 'async',
});
console.log(response.data);curl --request POST \
--url https://api.henrylabs.ai/v1/cart/{cartId}/details \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"buyer": {
"shippingAddress": {
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "Anytown",
"province": "CA",
"postalCode": "12345",
"countryCode": "US"
}
},
"coupons": [
"SUMMER21",
"FREESHIP"
],
"mode": "async"
}
'import requests
url = "https://api.henrylabs.ai/v1/cart/{cartId}/details"
payload = {
"buyer": { "shippingAddress": {
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "Anytown",
"province": "CA",
"postalCode": "12345",
"countryCode": "US"
} },
"coupons": ["SUMMER21", "FREESHIP"],
"mode": "async"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.henrylabs.ai/v1/cart/{cartId}/details",
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([
'buyer' => [
'shippingAddress' => [
'line1' => '123 Main St',
'line2' => 'Apt 4B',
'city' => 'Anytown',
'province' => 'CA',
'postalCode' => '12345',
'countryCode' => 'US'
]
],
'coupons' => [
'SUMMER21',
'FREESHIP'
],
'mode' => 'async'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://api.henrylabs.ai/v1/cart/{cartId}/details"
payload := strings.NewReader("{\n \"buyer\": {\n \"shippingAddress\": {\n \"line1\": \"123 Main St\",\n \"line2\": \"Apt 4B\",\n \"city\": \"Anytown\",\n \"province\": \"CA\",\n \"postalCode\": \"12345\",\n \"countryCode\": \"US\"\n }\n },\n \"coupons\": [\n \"SUMMER21\",\n \"FREESHIP\"\n ],\n \"mode\": \"async\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://api.henrylabs.ai/v1/cart/{cartId}/details")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"buyer\": {\n \"shippingAddress\": {\n \"line1\": \"123 Main St\",\n \"line2\": \"Apt 4B\",\n \"city\": \"Anytown\",\n \"province\": \"CA\",\n \"postalCode\": \"12345\",\n \"countryCode\": \"US\"\n }\n },\n \"coupons\": [\n \"SUMMER21\",\n \"FREESHIP\"\n ],\n \"mode\": \"async\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.henrylabs.ai/v1/cart/{cartId}/details")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"buyer\": {\n \"shippingAddress\": {\n \"line1\": \"123 Main St\",\n \"line2\": \"Apt 4B\",\n \"city\": \"Anytown\",\n \"province\": \"CA\",\n \"postalCode\": \"12345\",\n \"countryCode\": \"US\"\n }\n },\n \"coupons\": [\n \"SUMMER21\",\n \"FREESHIP\"\n ],\n \"mode\": \"async\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status": "<string>",
"message": "<string>",
"data": {
"jobs": [
{
"refId": "<string>",
"result": {
"items": [
{
"shippingOptions": [
{
"id": "<string>",
"name": "<string>",
"cost": {
"value": 123
},
"timeEstimate": "<string>",
"minDate": "<string>",
"maxDate": "<string>"
}
],
"costs": {
"subtotal": {
"value": 123
},
"total": {
"value": 123
},
"tax": {
"value": 123
},
"shipping": {
"value": 123
},
"discount": {
"value": 123
}
},
"coupons": [
{
"code": "<string>",
"available": true,
"savedAmount": {
"value": 123
}
}
]
}
],
"data": {
"shippingOptions": [
{
"id": "<string>",
"name": "<string>",
"cost": {
"value": 123
},
"timeEstimate": "<string>",
"minDate": "<string>",
"maxDate": "<string>"
}
],
"costs": {
"subtotal": {
"value": 123
},
"total": {
"value": 123
},
"tax": {
"value": 123
},
"shipping": {
"value": 123
},
"discount": {
"value": 123
}
},
"coupons": [
{
"code": "<string>",
"available": true,
"savedAmount": {
"value": 123
}
}
]
}
},
"error": {}
}
],
"metadata": {}
}
}{
"success": true,
"status": "<string>",
"message": "<string>"
}{
"success": true,
"status": "<string>",
"message": "<string>"
}Authorizations
Path Parameters
Unique identifier for the cart
Example:
"crt_sa2aEsCz9PRM"
Body
application/json
Show child attributes
Show child attributes
Response mode. Use sync to wait up to 30 seconds for the backing worker flow to complete.
Available options:
async, sync Example:
"async"
Per-product overrides keyed by product URL. Items with quantity null or 0 are excluded.
Show child attributes
Show child attributes
Example:
{
"https://www.nike.com/u/custom-nike-ja-3-by-you-10002205": { "quantity": 2 }
}
List of coupon codes applied to the cart
Example:
["SUMMER21", "FREESHIP"]
Additional metadata for the request
Show child attributes
Show child attributes
Was this page helpful?
⌘I