Integrating with Salesforce Commerce Cloud
  • 15 Nov 2024
  • Dark
    Light
  • PDF

Integrating with Salesforce Commerce Cloud

  • Dark
    Light
  • PDF

Article summary

You can integrate your Salesforce Commerce Cloud (SFCC) store so you can create, fulfill, and track your influencers' orders from within GRIN. This is ideal for managing large numbers of orders and scaling up your influencer program!

Note
This is a premium feature in GRIN, meaning it is only available with a paid subscription to GRIN. By default, the integration will have a Request button in GRIN, which notifies our support team that you’d like the integration enabled. After you click to request the integration, a representative from GRIN will reach out to you.


Before you can connect to the Commerce Cloud from within GRIN, you'll need to configure a few additional credentials in your Commerce Cloud by Connecting to GRIN. You'll also need to enable order fulfillment and affiliate conversion tracking by Installing the Cartridge. Finally, you'll need to specify how the integration will function on both GRIN and the Commerce Cloud platforms by Configuring Settings. We’ll go through each part of the process below.

Note
We highly recommend a developer or integration partner on your team completes the Salesforce Commerce Cloud integration process. There are steps that require prior developer experience and familiarity with the Salesforce platform. If you need further technical support, please contact your Account Manager.


What You'll Need

  • A Salesforce Commerce Cloud account with Administrator access.
Note
Depending on your Salesforce version, you may need both the Account Manager and the Business Manager.
  • The brand you want to integrate with already set up in GRIN.


Part 1: Access the Open Commerce API

To allow GRIN to integrate smoothly with Salesforce Commerce Cloud, you’ll create an API client, a Business Manager user, and a Business Manager role to access the Open Commerce API. The API client will let GRIN access your Commerce Cloud’s Products, Categories, Coupons, Customers, Baskets, and Orders. Business Managers are needed to create orders on behalf of your Influencers when they request products through GRIN. Business Managers will also apply price adjustments to these orders based on settings you’ll configure in Part 4: Configuring Settings. Once you create all of those items, you’ll be able to connect to GRIN.


Creating the API Client

  1. Log into your Salesforce Commerce Cloud Account Manager.
  2. Click API Client in the navigation menu.
  3. Click the Add API Client button in the API Clients window that appears. This will open the Add API Client form.
  4. Enter a Display Name, a Password, and Confirm Password for your new API Client under General Settings.
  5. Click the checkbox to enable access controls under Access Control.
  6. Click Add under Organizations. This opens the Assign Organizations popup.
  7. Select your store's organization.
  8. Click Add. Your organization should now be listed.
  9. Click Add under Roles. This opens the Assign Roles popup.
  10. Select the Salesforce Commerce API role.
  11. Click Add. The role should now be listed.
  12. Click the Filter icon from the Salesforce Commerce API role. This opens the Salesforce Commerce API - Filters popup.
  13. Select your organization in the dropdown menu.
  14. Select the production and staging environments in the window that appears.
  15. Click Add.
  16. Skip all the JWT fields.
  17. Skip to the Token Endpoint Auth Method field in the OpenID Connect section.
  18. Set the Token Endpoint Auth Method to client_secret_post.
  19. Set the Access Token Format to JWT.
  20. Click Save.


After saving, you will be redirected to a list of your existing API clients. You should now see your new API client in the list.


Updating Open Commerce API Settings

Now that you have your API client, you must update the settings to connect to GRIN.

Note
All changes to your settings should be done in your primary Staging instance. These changes will be replicated in your Production instance.
  1. Log into your Salesforce Commerce Cloud Business Manager
  2. Click on Administration > Site Development > Open Commerce API Settings. This will open the Open Commerce API Settings editing window.
  3. Select Shop in the Select Type dropdown field.
  4. Select Global (organization-wide) in the Select Context dropdown field.
  5. Download the Shop JSON file.
  6. Replace API_CLIENT_IDwith your API client’s Client ID in the file. 
  7. Add the updated file to your API client’s Settings.
    • If you do not have any existing clients, you can copy and paste the JSON file directly into your Settings.
    • If you do have existing clients, you must add GRIN’s API client settings according to the settings you already have.
  8. Change the Select Type dropdown field to Data. Keep the Select Context option as Global (organization-wide). 
  9. Download the Data JSON file.
  10. Replace API_CLIENT_ID with your API client’s Client ID in the file.
  11. Add the updated file to your Settings, keeping in mind your existing settings, if any.


Creating a Business Manager User

The Business Manager user is the user that will fulfill orders made by your Influencers in Salesforce Commerce Cloud. Depending on your version of SFCC, there are two different ways to create a Business Manager user: through Salesforce’s Business Manager or through Salesforce’s Account Manager. If you’re unsure which one to use, reach out to your integration partner or developer.

If you're using Business Manager:

  1. Navigate to Administration > Organization > Users.
  2. Click the New button.
  3. Fill in the required fields in the user form.
  4. Check the box next to Enabled.


If you're using Account Manager:

  1. Click on User in the navigation menu.
  2. Click the Add User button in the new Users window.
  3. Provide an email address for the user.
    • Note: You will need to access this email to activate the user’s account.
  4. Enter “GRIN ” for the first name.
  5. Enter “API ” for the last name.
  6. Click the Add button under Organizations.
  7. Select the organization for your store.
  8. Click the Add button under Roles.
  9. Search for “Business ” in the search bar that appears.
  10. Check the box next to Business Manager User.
  11. Click Add.
  12. Click the Filter icon next to the Business Manager User role that appears in the list.
  13. Select your organization.
  14. Check the box next to Production and Staging in the list of available instances that appear.
  15. Activate your account by going to the email you provided in Step 3 and clicking on the activation link.
  16. Log into the Business Manager instances you are connecting to using the new account to create the link between the account and the Business Manager.


You should now have a business manager user in Salesforce.


Creating a Business Manager Role 

The Business Manager role will have permission to fulfill orders on behalf of your influencers in your Commerce Cloud. While the Business Manager user can have the same permissions, having a role is more convenient because you can always add more users to the role without configuring each user’s permissions each time. 

  1. In your Business Manager, navigate to Administration > Organization > Roles & Permissions. This opens the Roles management window. 
  1. Click the New button. This opens the New Role window.
  1. Enter “GRIN Role” for the ID
  2. Enter “Order, customer, and adjustment permissions for GRIN" for the description. 
  3. Click the Apply button to create the role. 
  4. Click the Functional Permissions tab. 
  5. Check the Sites box in the Select Context window that appears.
  6. Click the Apply button.
  7. Check the box next to the following:
    • Adjust_Item_Price
    • Adjust_Shipping_Price
    • Adjust_Order_Price
    • Create_Order_On_Behalf_Of
    • Search_Orders
  1. Click Update to save the role. 
  2. Click on the Users tab.
  3. Click the Assign button. 
  4. Check the box next to the Business Manager user you created in the last section. 
  5. Click Assign to assign the Business Manager role to the user. The user should now appear in the list of users with the Business Manager role. 
  6. Click Update

You should now have a Business Manager role with the Business Manager user assigned to it. 


Part 2: Installing the Cartridge

While you’re now connected, there are still some configurations that need to be completed before you can access your store’s full functionality from within GRIN. One of these is to install and configure the cartridge and metadata to your Commerce Cloud environment.

  1. Download the cartridge and metadata files.
  2. Unzip the file. Notice there are two directories: 
    • int_grin (the cartridge)
    • config (system object type extensions)
  3. Copy the int_grin directory to your environment and upload it to the staging environment. 
  4. Log into your Business Manager.
  5. Navigate to Administration > Sites > Manage Sites. This will open the Storefront Sites window with a list of your sites.
  6. Click the site you’re integrating with GRIN. This opens the window to manage your site.
  7. Click the Settings tab.
  1. Add int_grin to the beginning of the path in the Cartridges section and click Apply
  1. Navigate to Administration > Site Development > Site Import & Export. This opens the Site Import & Export management window.
  2. Click the Choose File button under the Import section. 
  1. Open the config directory and select the grin-configuration-settings zip file. 
  2. Click Upload. The grin-configuration-settings zip file should now appear in a list.
  1. Select the grin-configuration-settings file from the list and click Import
  2. Click OK when prompted. 


Part 3: Connecting to GRIN

Now that you’re set up in Commerce Cloud, you can integrate with Commerce Cloud in a few ways across GRIN: from the App Marketplace, from within your Brand, and from your Integrations Settings. Each method has similar steps.


Integrating from the App Marketplace 

  1. Navigate to Account > App Marketplace. This will open the App Marketplace page.
  2. Find the Salesforce Commerce Cloud integration by either:
    1. Searching “Salesforce Commerce Cloud” in the search bar.
    2. Navigating to the Ecommerce App Category.
  1. Click the Salesforce Commerce Cloud integration’s Request button. This will open the Request access to Salesforce Commerce Cloud popup.
  2. Click Send Request.
  3. Once Salesforce Commerce Cloud is enabled for your account, click the Salesforce Commerce Cloud integration’s Connect button. This will open the Connect Salesforce Commerce Cloud modal.
  4. Select your Brand you want to connect Salesforce Commerce Cloud to. You cannot integrate Salesforce Commerce Cloud with a store that already has a store connected to it. If you do not have any Brands created yet, you’ll be prompted to create one before connecting with Salesforce Commerce Cloud.
  5. Enter the remaining fields: your Salesforce Commerce Cloud URL, Site ID, API Client ID, Business Manager User Login, and Business Manager User Password.
    Note
    In the future, Salesforce will prevent external OCAPI connections using the *.demandware.net hostname.

    Although using this hostname will continue to work until then, we recommend you preemptively create a vanity domain and connect to it now. This will prevent any connection issues in the future when Salesforce implements its change. You can read more about this change and vanity domains in Salesforce's article.
  6. Click Connect. If you see a popup to log in to your Salesforce Commerce Cloud account, complete the login process.

Your Salesforce Commerce Cloud account should now be connected to your Brand and account.


Integrating from Your Brand

You can also integrate with Salesforce Commerce Cloud directly from your Brand you want to connect it to. To do so: 

  1. Navigate to Brands.
  2. Click the Edit Brand icon under the Brand you want to connect your Commerce Cloud store to. This opens the editing window for that Brand. 
  3. Click Step 3. Ecommerce Account
  4. Click the Connect button underneath the Salesforce integration. 
  5. Fill in the fields appropriately. 
    • Instance URL:  the URL for your Commerce Cloud instance, gathered from the Business Manager.
    • Site ID: the name of your Commerce Cloud instance, also from the Business Manager under Administration > Sites.
    • API Client ID: the id of the API client created in Account Manager. 
    • API Client Password: the password for the client you created in Account Manager.
    • Business Manager User Login: the user login for the Business Manager user you created. This can differ based on which Manager you used to create the user. 
    • Business Manager User Password: the password for the Business Manager user you created.
      • If you created the user through the Business Manager: the User Login is the username.
      • If you created the user through the Account Manager: the User Login is the user’s email address.
  1. Click the Connect button and wait for GRIN to verify the connection. 


Part 4: Configuring Settings

Now that you’ve connected to GRIN and you’ve installed the cartridge, you must now configure a few settings between GRIN and SFCC so your payments, shipping, and orders are fulfilled correctly. You’ll be adjusting settings in both the GRIN Connection Settings and the Business Manager’s Custom Preferences.


Configuring Orders and Shipping Settings

Before you can create orders from within GRIN, you must set your payment and shipping methods for either your domestic or international influencers - or both if you have them. 

Specifically, you must provide an SFCC payment method and ID to GRIN. This is because GRIN always adds order and shipping-level price adjustments to orders it makes, displaying the balance due as $0.00 and not requiring a payment instrument. However, because SFCC requires a valid payment instrument regardless, you must create one within SFCC and provide it to GRIN.

Note
While there are a few different ways to create a Payment Method in SFCC, we highly recommend creating a new payment method. That method will be outlined here. If you have both domestic and international Influencers, you’ll need to create two separate payment methods.

You can also use the int_grin cartridge code to control the Confirmation Status, Export Status, and Payment Status for orders after they’ve been submitted.


  1. Go to your Business Manager
  2. Navigate to Merchant Tools > Ordering > Payment Methods. This opens the Payment Methods management window. 
  3. Click the New button to create a new payment method.
  1. Enter an ID for the payment method. 
  2. Add a Description
  3. Set the Payment Processor to None.
  4. Set the remaining fields as appropriate. 
  5. Click Apply.
  6. Go to your Brand’s Connection Settings in GRIN.
  1. Scroll to the ORDERS AND SHIPPING section.
  2. Set the Order Management System to Commerce Cloud (Demandware)
  3. Fill in the Payment method ID (domestic) with your domestic payment method’s ID. If you do not have domestic Influencers, leave this field blank. 
  4. Fill in the Payment method ID (international) with your international payment method’s ID. If you do not have international Influencers, leave this field blank. 
  5. Fill in the Shipping method ID (domestic) with your domestic shipping method’s ID. This does not have any special requirements and can be set to any existing shipping method. If you do not have domestic shipping orders, leave this field blank. 
  6. Fill in the Shipping method ID (international) with your international shipping method’s ID. This does not have any special requirements and can be set to any existing shipping method. If you do not have international shipping orders, leave this field blank.
  1. Enable or disable the option to set the order shipment as a gift.
  1. Enable or disable the option to apply order price adjustments. This determines if discounts will apply to the full order’s total. If you enable it, you must provide a few extra fields:
    • Price adjustment item text: what the order will be named in the invoice in SFCC.
    • Price adjustment reason code: the reason code for the price adjustments that will appear in SFCC.
  1. Enable or disable the option to apply order item price adjustments. This determines if discounts will apply to individual items in an order. If you enable it, you must provide a few extra fields:
    • Price adjustment item text: what the order will be named in the invoice in SFCC.
    • Price adjustment reason code: the reason code for the price adjustments that will appear in SFCC.
Note
Apply order price adjustments and Apply item price adjustments should not be both enabled at the same time. Only one or the other should be enabled at a time.
  1. Provide Order Attributes as appropriate for your SFCC.

Your Orders and Shipping settings have now been set up! There are a few other fields that can be set in GRIN’s Connection Settings, but the ones listed above are the absolute minimum that needs to be set for your orders to be fulfilled correctly through GRIN.


Part 5: Configuring Your Commerce Cloud

Now that you’ve configured your GRIN settings, you must configure your Commerce Cloud’s settings. These settings will control how your orders will be processed in SFCC once they are created. You can also choose how to handle orders’ post-processing. Each Influencer order is created with the subject “GRIN”. To determine how Influencer orders are handled:

  1. Go to your Business Manager.
  2. Navigate to Merchant Tools > Site Preferences > Custom Preferences. This opens a list of custom site preferences.
  3. Select the GRIN cartridge. 
  4. Set each field as desired to handle orders. By default, all four options will be set to Yes
    • Automatically place orders: Set this to No if you want to completely avoid post-processing. If this is done, GRIN orders will come in as “Created”, and you will have full control over their journeys.
    • Automatically confirm orders: Determines whether the Order Status will be set to “Confirmed” automatically.
    • Automatically set orders as ready for export: Determines whether the Export Status will be set to “Ready for Export” automatically.
    • Automatically mark orders as paid: Determines whether the Payment Status will be set to “Paid” automatically.


Congratulations! You’ve finished integrating SFCC into GRIN with full functionality and capabilities! Any orders your Influencers make in GRIN will now fulfill orders in your SFCC and automatically complete payments and shipping based on your settings.


Was this article helpful?