You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x
removeConsent
Method withdrawing consent on behalf of an authenticated user in SAP Commerce Cloud.
This method sends a POST request to the removeConsent endpoint of the Alokai Middleware. In turn, it exchanges data with the removeConsent endpoint exposed by the SAP OCC API Consents Controller.
The method removes consent on behalf of an authenticated user based on the vsf-sap-token cookie (which is assigned to that customer). The cookie must be present in the browser for the method to work properly.
You might also want to see the giveConsent method.
Signature
export declare function removeConsent<Props extends RemoveConsentProps = RemoveConsentProps>(
props: Props,
options?: MethodOptions
): Promise<void>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | Props | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions |
Returns
This method does not return anything.
Referenced Types
Examples
Withdrawing consent with a given consentCode.
import { sdk } from '~/sdk';
await sdk.commerce.removeConsent({ consentCode: '000007PU' });