1 min read

High Level customisation example

In the case of customization on High level we are going to show an example of Controller level logic modification in order to meet specific functionality needs.

Let us imagine that during the development of the Dev version of the client application we are facing an issue of the client Dev Website environment being password protected. This means that /checkout/start endpoint is not going to work out of the box as expected because the checkout web view is going to load. In other words we have the following user story to handle: As a User I want to have a checkout page working on the Dev environment as Expected. One of the solutions could like like this:

  1. Introduce custom property in app config that hold Basic Authorisation Headers
  2. When property from point 1 is configured grab headers on /checkout/start and attach them to headers collection in response

Let us proceed to the implementation.


  • Sfcc Based BFC API up and running locally (pls note that this logic already presents in Sfcc based BFC API Template)
  • Basic authentication credentials for clients Dev Web site


  1. Open AppConfig.cs file
  2. Add following properties to the file
/// <summary>
/// Header to attach to CheckoutUrl call if required. This collection is being initialized via CheckoutHeadersDictionary property.
/// </summary>
/// <example>
/// "CheckoutHeadersDictionary": {
/// "Authorization": "Basic someBase64EncodedCredentialsHere"
/// }
/// </example>
public List<HttpHeaderResponse> CheckoutHeaders { get; private set; }
private Dictionary<string, string> _checkoutHeadersDictionary = new Dictionary<string, string>();
/// <summary>
/// Helper property to initialize CheckoutHeaders collection.
/// </summary>
public Dictionary<string, string> CheckoutHeadersDictionary
get => _checkoutHeadersDictionary;
_checkoutHeadersDictionary = value;
CheckoutHeaders = _checkoutHeadersDictionary.Select(x => new HttpHeaderResponse(x.Key, x.Value)).ToList();

CheckoutHeadersProperty is what we are looking for, while CheckoutHeadersDictionary is a nice helper property for move convenient initialization of CheckoutHeadersProperty, it allows specifying data in a dictionary format in appsettings.json file, for ex:

"CheckoutHeadersDictionary": {
"Authorization": "Basic someBase64EncodedCredentialsHere"
  1. Open CheckoutController and add following logic to StartAsync method just before response is returned :
// add headers from configuration if required
if (config.CheckoutHeaders.Count > 0)
result.Content!.Headers = config.CheckoutHeaders;

This way we are going to add headers from app config into the checkout headers collection when those are specified.

  1. Open appsettings.Development.json file
  2. Add following section for your application configuration
"Apps": {
"yourAppIdentifier": {
"AppId": "yourAppId",
CheckoutHeadersDictionary": {
"Authorization": "Basic someBase64EncodedCredentialsHere"
  1. Build and Run the API
  2. Invoke endpoint locally and make sure that configured authorization header now presents in checkout/start headers collection
  3. Add unit tests for /checkout/start endpoint
  4. Submit the PR
Congratulations, you have successfully implemented High level customisation
Having in mind password restrictions for lower level environments is a common thing for Sfcc based clients we have added above customisation to the standard BFC Template.

See Next