Checkout
Get Consents
Retrieves consent settings for the current cart session
GET
/
api
/
v2
/
domains
/
{domain}
/
cart
/
consents
Get Consents
curl --request GET \
--url https://api.firmly.work/api/v2/domains/{domain}/cart/consents \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.firmly.work/api/v2/domains/{domain}/cart/consents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.firmly.work/api/v2/domains/{domain}/cart/consents', 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://api.firmly.work/api/v2/domains/{domain}/cart/consents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.firmly.work/api/v2/domains/{domain}/cart/consents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.firmly.work/api/v2/domains/{domain}/cart/consents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firmly.work/api/v2/domains/{domain}/cart/consents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 404,
"error": "ErrorCartNotFound",
"description": "Cart does not exist for the specified domain"
}
Overview
Retrieves the current consent settings for a customer’s cart session. This endpoint returns all available consent options along with their current status, including whether they have been signed by the customer.How Consent Management Works
Consent management is integrated into the checkout flow to ensure compliance with data protection regulations:- Session-Based: Consents are stored in the cart session and persist until checkout completion
- Type-Based: Different consent types (marketing, terms, privacy) are supported
- UI Placement: Each consent includes a
ui_slothint for proper placement in your checkout UI - Audit Trail: Signed consents include timestamp, IP address, and user agent for compliance
Response
array
required
Array of consent objects
Show Consent Object
Show Consent Object
string
required
Unique identifier for the consent
string
required
UI placement hint for the consentPossible values:
UNDER_EMAIL_INPUT- Display under email fieldABOVE_PLACE_ORDER_BUTTON- Display above order buttonAFTER_SHIPPING_INFO- Display after shipping form
string
required
Plain text version of the consent for accessibility
string
required
HTML version with rich formatting and links
string
required
Type of consentPossible values:
marketing- Marketing communicationsterms- Terms of serviceprivacy- Privacy policycustom- Custom consent type
boolean
required
Whether explicit consent action is required
boolean
required
Whether this consent must be signed to complete checkout
boolean
required
Whether the consent can be revoked after being signed
boolean
required
Whether the customer has signed this consent
Code Examples
curl -X GET https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents \
-H "x-firmly-authorization: Bearer YOUR_TOKEN"
const response = await fetch('https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents', {
method: 'GET',
headers: {
'x-firmly-authorization': 'Bearer YOUR_TOKEN'
}
});
const consents = await response.json();
import requests
response = requests.get(
'https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents',
headers={
'x-firmly-authorization': 'Bearer YOUR_TOKEN'
}
)
consents = response.json()
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.firmly.work/api/v2/domains/staging.luma.gift/cart/consents');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'x-firmly-authorization: Bearer YOUR_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$consents = json_decode($response, true);
curl_close($ch);
Response Example
[
{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"ui_slot": "UNDER_EMAIL_INPUT",
"text": "I would like to receive marketing emails about special offers and new products.",
"html": "I would like to receive marketing emails about special offers and new products.",
"type": "marketing",
"explicit": true,
"required": false,
"revokable": true,
"signed": false
},
{
"id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"ui_slot": "ABOVE_PLACE_ORDER_BUTTON",
"text": "I agree to the Terms of Service and Privacy Policy.",
"html": "I agree to the <a href='/terms'>Terms of Service</a> and <a href='/privacy'>Privacy Policy</a>.",
"type": "terms",
"explicit": true,
"required": true,
"revokable": false,
"signed": true
}
]
Default Consent States
When no consents have been configured by the merchant:- A default marketing consent is provided if
marketing_consent_textis configured - The default marketing consent is optional and revokable
- No other consents are created by default
Error Responses
{
"code": 404,
"error": "ErrorCartNotFound",
"description": "Cart does not exist for the specified domain"
}
Common Errors
| Error Code | Description | Resolution |
|---|---|---|
ErrorCartNotFound | Cart does not exist | Verify cart ID and domain |
ErrorStoreUnavailable | Store service unavailable | Retry request |
MissingAuthHeader | Missing authorization header | Include x-firmly-authorization header |
InvalidToken | Invalid JWT token | Refresh authentication token |
⌘I
Get Consents
curl --request GET \
--url https://api.firmly.work/api/v2/domains/{domain}/cart/consents \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.firmly.work/api/v2/domains/{domain}/cart/consents"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.firmly.work/api/v2/domains/{domain}/cart/consents', 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://api.firmly.work/api/v2/domains/{domain}/cart/consents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.firmly.work/api/v2/domains/{domain}/cart/consents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.firmly.work/api/v2/domains/{domain}/cart/consents")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.firmly.work/api/v2/domains/{domain}/cart/consents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": 404,
"error": "ErrorCartNotFound",
"description": "Cart does not exist for the specified domain"
}