> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tabby.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce

<Note>
  Tabby works on the Salesforce Commerce Cloud platform for all supported countries.
</Note>

## Installation Steps

<Steps>
  <Step
    stepNumber={1}
    title={(
  <span>
    <a href="https://merchant.tabby.ai/">
      Register with Tabby
    </a>
    <span style={{ fontWeight: 'normal', fontSize: '0.9em' }}>
      &nbsp;(KSA: <a href="https://merchant.tabby.sa/">merchant.tabby.sa</a>)
    </span>
    <span style={{ fontWeight: 'normal' }}>
      &nbsp;and fill all the business details
    </span>
  </span>
)}
  />

  <Step
    stepNumber={2}
    title={(
  <span style={{ fontWeight: 'normal' }}>
    Receive your Testing API keys from your Tabby account manager
  </span>
)}
  />

  <Step
    stepNumber={3}
    title={(
  <span>
    Download and install Tabby Cartridge for your platform:<br />
    <span style={{ fontWeight: 'normal' }}>
      To download SFRA (Store Front Reference Architecture) Cartridge,&nbsp;
    </span>
    <a href="https://storage.googleapis.com/plgns/salesforce-1.0.4.zip">
      click here
    </a><br />
    <span style={{ fontWeight: 'normal' }}>
      To download SiteGenesis Cartridge,&nbsp;
    </span>
    <a href="https://storage.googleapis.com/plgns/salesforce-sitegenesis-1.0.0.zip">
      click here
    </a>
  </span>
)}
  />

  <Step
    stepNumber={4}
    title={(
  <span style={{ fontWeight: 'normal' }}>
    Test your integration and contact Tabby to have a green light for going live
  </span>
)}
  />

  <Step
    stepNumber={5}
    title={(
  <span style={{ fontWeight: 'normal' }}>
    Collect your Live API Keys, populate them for your store, make sure Live Webhooks are installed. You are ready for going live now
  </span>
)}
  />
</Steps>

Salesforce integration supposes adding the necessary cartridges into an SFCC reference application.

Tabby cartridge package contains 3 folders:

1. int\_tabby\_core – Tabby core implementations both for Sitegenesis and SFRA
2. int\_tabby\_sfra – Tabby SFRA changes/implementations
3. bm\_tabby – Tabby Business Manager module

<Warning>
  Compatibility: SFRA v6.0.0 Compatibility Mode 21.7
</Warning>

### Cartridges Installation

#### Adding Cartridges in Salesforce Commerce Cloud Studio

1. Open package.json and ensure the base path mentioned is correctly resolved (please provide the correct path to app\_storefront\_base)
2. Open the command prompt and run ‘npm install’ (assuming node.js (12.21.0 and above) is installed) to install all of the local dependencies
3. Run the “npm run compile”
4. Create the dw\.json file:

```
{
    "hostname": "your-sandbox-hostname.demandware.net",
    "username": "yourlogin",
    "password": "yourpwd",
    "code-version": "version_to_upload_to"
}
```

5. Upload this code to the environment using the command ‘npm run uploadCartridge’, that will upload the **int\_tabby\_core** , **int\_tabby\_sfra** and **bm\_tabby** cartridges to the sandbox you specified in dw\.json file

#### Activating Cartridges in Business Manager

Before Tabby functionality can become available to Reference Architecture, the cartridges need to be added to the cartridge path of the site. In order to do this, follow the following instructions:

* Log into Business Manager
* Navigate to *Administration -> Sites -> Manage Sites*
* Click on the site name
* Go to the "Settings" tab
* In the textbox cartridges add **int\_tabby\_sfra:int\_tabby\_core** before **app\_storefront\_base**

<Check>
  example: **int\_tabby\_sfra:int\_tabby\_core: app\_storefront\_base**
</Check>

* Click **Apply**
* Repeat steps 3 to 5 for each site that is to use Tabby
* To run the Jobs and have tabby BM module, Navigate to *Administration -> Sites -> Manage Sites*
* Go to the "Manage the Business Manager site” tab
* In the textbox cartridges add **int\_tabby\_core:bm\_tabby** to the start

### Configuration

#### Importing Meta Data with a single Site Import

All import files are located in the import folder (metadata) within the cartridge installation pack. To import necessary Tabby settings:

* Open the metadata folder from the repository structure (open jobs.xml) and change the references of RefArchGlobal to your site id;
* Open the metadata/sites folder from the repository structure and change the folder name from RefArchGlobal to your site id. If you have multiple sites with Tabby, then copy RefArchGlobal folder and rename it with your other site id(s).
* Open the metadata/sites/YourSiteID/preferences.xml file from the repository structure;
* Fill in **tabbyServiceCredentialPublicKey** and **tabbyServiceCredentialSecretKey** with keys provided by your account manager from Tabby;
* Fill in **tabbyWebhooksTitle** and **tabbyWebhooksValue** values;
* Compress the metadata folder from the repository structure;
* Log in to the Business Manager and navigate to *Administration -> Site Development -> Site Import & Export*, upload the zipped folder, go back and use the import button to import the file;
* After a successful import, the entire configuration requirements needed for Tabby are available according to your Tabby account data.

#### Managing Tabby Custom Site Preferences

In Business Manager, navigate to the *Site -> Merchant Tools -> Site Preferences -> Custom Preferences*. A custom site preference group "Tabby" is available. Please select it and edit the attributes according to your Tabby account data.

|                                                      |                                                                                                                                                                                                                                    |                                                                                                            |
| ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **Site Preference**                                  | **Description**                                                                                                                                                                                                                    | **Values**                                                                                                 |
| Is Tabby Enable                                      | This field represents the enable/disable tabby implementation.                                                                                                                                                                     | Boolean: True/FalseDefault: True                                                                           |
| Tabby Environment                                    | This field represents the type of the environment.                                                                                                                                                                                 | Enum of String: Development -> Development instancesProduction -> Production instancesDefault: Development |
| Service Credential Public Key                        | This field represents the tabby service credential public key (pk\_...).                                                                                                                                                           | String: (Mandatory) The public API key that Tabby provided to you                                          |
| Service Credential Secret Key                        | This field represents the tabby service credential secret key (sk\_...).                                                                                                                                                           | String: (Mandatory) The secret API key that Tabby provided to you                                          |
| Is Tabby Installments Enable                         | This field represents the Installments payment method is enabled.                                                                                                                                                                  | Boolean: True/False Default: True                                                                          |
| Is Tabby Credit Card Installments Enable(Deprecated) | This field represents the Credit Card Installments payment method is enabled.                                                                                                                                                      | Boolean: True/False Default: False                                                                         |
| Is Tabby Pay Later Enable                            | This field represents the Pay Later payment method is enabled.                                                                                                                                                                     | Boolean: True/False Default: False                                                                         |
| Immediate Capture On Authorize                       | This field represents if the Immediate Capture on Authorize is enabled. If Yes -> Capture request will be triggered automatically after success Authorization. If No -> Tabby-Capture scheduled job will send the capture request. | Boolean: True/False Default: True                                                                          |
| Installments Count                                   | This field represents Installments counts.                                                                                                                                                                                         | Integer:Default: 4                                                                                         |
| Tabby Merchant Code Per Country                      | This field represents the Merchant codes per country in a JSON format: \{ "AE": "uae","SA": "ksa","KW": "kwt"}                                                                                                                     | Text (JSON) \{ "AE": "uae","SA": "ksa","KW": "kwt"} - need to define Site countries only.                  |
| Card Size                                            | This field represents the tabby card size, can be narrow or wide, depending on the width                                                                                                                                           | Enum of String: Narrow/Wide Default: Narrow                                                                |
| Card Theme                                           | This field represents the tabby card theme, can be default or black, depending on the styles                                                                                                                                       | Enum of String: Default/Black Default: Default                                                             |
| Webhooks Title                                       | This field represents the arbitrary header name to sign the request for the webhooks.Will be used to verify webhook requests that tabby system sends.                                                                              | String:                                                                                                    |
| Webhooks Value                                       | This field represents the random string to sign the request for the webhooks.Will be used to verify webhook requests that tabby system sends.                                                                                      | String:                                                                                                    |

#### Managing Tabby Payment Processor

In Business Manager select the required site from the dropdown and navigate to *Merchant Tools -> Ordering -> Payment Processors*.

#### Managing Tabby Payment Methods

In the integration package, a payment method definition is provided in the file that you have already imported

1. Navigate to *Merchant Tools -> Ordering -> Payment Methods*;
2. Enable/Disable the Payment Method under *Ordering -> Payment Methods* section that needs to be activated. Repeat these steps for all the Payment Methods that are required to be supported on the site.

#### Managing Jobs

In the integration package, a job definition is provided in the import zip (metadata.zip) file (jobs.xml). Make sure to associate the jobs with the respective merchant site.

*Tabby-CaptureShippedOrders*

It captures the payments that are authorized by Tabby. This job fetches the orders which have confirmationStatus=CONFIRMED, paymentStatus=NOTPAID, shippingStatus=SHIPPED and custom.tabbyPaymentStatus: AUTHORIZED.

<Check>
  Script file: int\_tabby\_core/cartridge/scripts/jobs/capture.js
</Check>

If the site preference “**Immediate Capture On Authorize**” is set to "True", it is not necessary to enable this job.

*Tabby-RegisterWebhooks*

It registers the Webhooks for the sites defined by merchant*codes from the "Site preference" tab. Each* merchant\_code needs to be registered separately. This job is a one time job to register the Webhooks. It is important to fill in “Webhooks Title” and “Webhooks Value” in the "Site Preferences" before running this job.

<Check>
  Script file int\_tabby\_core/cartridge/scripts/jobs/webhooks.js
</Check>

*Tabby-Feedback*

It processes the TabbyFeedback custom objects that are saved within the TabbyWebhooks-Process endpoint. Custom object details are to compare with the order payment statuses. If there is a difference between the order/payment status, the job will synchronize the order/payment statuses based on the TabbyFeedback details.

<Check>
  Script file int\_tabby\_core/cartridge/scripts/jobs/feedback.js
</Check>

#### Tabby Business Manager Module

The cartridge for Business Manager module bm\_tabby is present in the installation package. It helps processing capture and refund APIs. To enable/activate it, do the following:

1. Navigate to *Administration -> Organization -> Roles & Permissions*;
2. Click **Administrator** in the Roles;
3. Click **Business Manager Modules**;
4. Select the sites where you have Tabby;
5. Click **Apply**;
6. Scroll to *Ordering -> Tabby Orders* and check the checkbox;
7. Click **Update** at the bottom of the page;

Once it is enabled, “Tabby Orders” will be placed under *Merchant Tools > Ordering*
