Compliance element

Gain a better understanding of what the compliance element does and how to use it.

The compliance element displays the selling entity facilitating a transaction and renders links to applicable disclosures, such as terms of sale, cookie policies, and cancellation rights.

On this page, you'll find information on how to create, mount, unmount, destroy, update, and configure the element.

For details on using the element in checkout flows, refer to Displaying compliance disclosures on the Building checkouts page.

Creating a compliance element

To create a compliance element, pass 'compliance' and its configuration object to createElement(), which is exposed by the DigitalRiver object.

var compliance = digitalRiver.createElement('compliance', complianceOptions);

mount()

Call this function to place the created compliance element on your page.

<div id="compliance"></div>

compliance.mount('compliance');

unmount()

Call this function to remove the compliance element from your page. The element may be re-added to your page by calling mount().

compliance.unmount();

destroy()

Call this function to remove both the compliance element and its functionality from your page. You cannot re-add a destroyed element to your page via mount().

compliance.destroy();

update()

To refresh the compliance element, pass its configuration object to update().

let complianceOptions = {
  compliance: {
    entity: 'DR_JAPAN-ENTITY'
  }
}
compliance.update(complianceOptions);

Compliance element configuration object

The compliance element's configuration object contains a nested classes and compliance.

classes

To stylize the compliance element, define the optional classes. For details, refer to Custom classes.

var complianceOptions = {
    classes: {
      base: 'DRElement'
    },
    ...
}
var compliance = digitalRiver.createElement('compliance', complianceOptions);

compliance

The compliance object consists of a language, country, and entity, all of which are required to make the element behave properly. Giving Digital River this data increases the probability that customers are shown accurately translated disclosures that apply to their shopping country.

For example, the following configuration results in the compliance element displaying the required disclosures, translated into Spanish, when customers are shopping in Germany, and Digital River Ireland Ltd. is facilitating the transaction.

var complianceOptions = {
    compliance: {
      entity: 'DR_IRELAND-ENTITY',
      language: 'es',
      country: 'DE'
    }
}
var compliance = digitalRiver.createElement('compliance', complianceOptions);

language

This required string determines the language of the text displayed in the element as well as the linked-to disclosure documents. The value you assign language doesn't affect what disclosures are displayed, only how their text is rendered.

For a list of accepted values, refer to Supported languages.

country

A required string, formatted as an ISO 3166-1 alpha-2 code, represents the customer's shopping country. Since legal requirements vary slightly from country to country, the value you assign to this property determines which specific disclosures are rendered in the element. For example, some country values display a link to the customer's cancellation rights, while others do not.

If the transaction involves physical products, country should ideally be the same as the customer’s ship to country. If customers only purchase digital products, you can use their billing country.

entity

A required string that represents the transaction's designated selling entity. Like compliance.country, this property affects which disclosures are displayed in the element.

In checkouts, you can find this value in sellingEntity.id.

For a list of accepted values, refer to Supported selling entities.

jpCommerceLawPageUrl

If compliance.country is jp, then the element displays a link to a disclosure that pertains to Japanese commercial transaction law.

If you'd like to replace the default URL behind this link with your own, use jpCommerceLawPageUrl.

var complianceOptions = {
    classes: {
      base: 'DRElement'
    },
    compliance: {
      ...
      country: 'JP',
      jpCommerceLawPageUrl: 'https://acme.com/JapaneseCommerceLaw'
    }
}
var compliance = digitalRiver.createElement('compliance', complianceOptions);

Last updated