Checkout
Set Consents
Updates consent preferences for the current cart session
POST
Set Consents
Overview
Updates the consent preferences for a customer’s cart session. This endpoint allows customers to grant or revoke consent for various purposes like marketing communications. All consent changes are tracked with signatures for compliance purposes.Both
POST and PUT methods are supported for this endpoint, providing flexibility for different client implementations.Request Body
Array of consent updates to apply.Consent Update Object:
id(string, required): Unique identifier of the consent to updaterevoke(boolean, optional): Set totrueto revoke consent. Omit or set tofalseto grant consent. Default:false
Response
Returns an updated array of all consent objects with the same structure as the Get Consents response, reflecting the changes made.Consent Signatures
When consent is granted, the system automatically creates a signature containing:- Timestamp: When consent was given
- IP Address: Customer’s IP address
- User Agent: Browser/client information
- Session ID: Cart session identifier
Code Examples
Grant Single Consent
Revoke Consent
Update Multiple Consents
Response Example
Consent Rules
Granting Consent
- Customer must explicitly opt-in when
explicit: true - Consent signature is created with timestamp and metadata
- Required consents must be signed before checkout completion
Revoking Consent
- Only consents with
revokable: truecan be revoked - Attempting to revoke non-revokable consent returns an error
- Revocation is tracked with timestamp for audit purposes
Error Responses
Common Errors
| Error Code | Description | Resolution |
|---|---|---|
ErrorCartNotFound | Cart does not exist | Verify cart ID and domain |
ErrorInvalidInputBody | Invalid request format | Check request body structure |
ErrorConsentNotFound | One or more consent IDs not found | Verify consent IDs with Get Consents |
ErrorConsentNotRevokable | Attempted to revoke non-revokable consent | Check consent revokable status |
ErrorStoreUnavailable | Store service unavailable | Retry request |
MissingAuthHeader | Missing authorization header | Include x-firmly-authorization header |
Set Consents