Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

giveConsent

Give consent on behalf of an authenticated user in SAP Commerce Cloud.

This method exchanges data with the doGiveConsent endpoint exposed by the SAP OCC API Consents Controller.

The method gives 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 request for the method to work properly.

Signature

export declare function giveConsent(
	context: SapccIntegrationContext,
	props: GiveConsentProps
): Promise<ConsentTemplate>;

Parameters

NameRequiredTypeDescription
contextRequiredSapccIntegrationContext
propsRequiredGiveConsentPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of a Consent Template.

Referenced Types

Examples

Giving consent.

import { sdk } from '~/sdk';

const givenConsent = await sdk.commerce.giveConsent({
  consentTemplateId: 'MARKETING_NEWSLETTER',
  consentTemplateVersion: 0
});

On this page