Integrating with Salesforce

To integrate Salesforce Order Management with Salesforce, you must complete these procedures:

Connecting to the Salesforce Commerce Cloud

You must set up a connection between your B2C Commerce Business Manager and your Salesforce Commerce Cloud account. Follow this procedure for each storefront that needs a connection.
  1. After logging in to Salesforce, click
    Setup
    .
  2. In the Quick Find box, type
    B2C Commerce Connections
    .
  3. Click
    New Connection
    .
  4. Enter a connection name and the B2C instance ID (also known as the tenant ID from Business Manager).
  5. Click
    Save
    .
  6. Set the integration state to
    Active
    .
  7. In the Allow Tenant Linkage window, click
    Allow
    .
  8. In the Connection Type section,
    Order Integration
    and
    Cart and Checkout Data
    from the Available Connection Type list to the Selected Connection Type list.
  9. Click
    Save
    .

Creating a Payment Gateway Provider

This procedure cannot be completed from the user interface and must be done through Workbench by connecting to your organization:
  1. In Workbench, use this endpoint:
    (MD/ToolingAPI): /services/data/v58.0/tooling/sobjects/PaymentGatewayProvide
  2. Use this information as your payload:

    ADDITIONAL INFORMATION

    { "ApexAdapterId":<ID of PTS_PaymentAdapter.cls apex class> "DeveloperName": "
    Cybersource
    _Provider", "MasterLabel": "
    Cybersource
    _Provider ", "IdempotencySupported": "Yes", "Comments": "Comments" }

Creating a Named Credentials Record

The package comes with a default named credential called
Payment
. It points to Cybesource’s test endpoint:
https://apitest.cybersource.com
If you cannot find the default named credential, create a new named credential with these steps:
  1. Click
    Setup
    .
  2. In the Quick Find box, enter
    Named Credentials
    .
  3. Click
    New
    .
  4. In the
    Label
    field, enter either
    Payment_TEST
    or
    Payment_LIVE
    , whichever is appropriate.
  5. In the
    Name
    field, enter the same value that you used in the
    Label
    field.
  6. In the
    URL
    field, enter the URL of your endpoint.

    ADDITIONAL INFORMATION

    Production: https://api.cybersource.com/pts/v2/payments
    Test: https://apitest.cybersource.com/pts/v2/payments
  7. Leave the
    Certificate
    field blank.
  8. In the
    Identity Type
    field, select
    Anonymous
    .
  9. In the
    Authentication Protocol
    field, select
    No Authentication
    .
  10. In the
    Generate Authorization Header
    field, clear the checkbox.
  11. In the
    Allow Merge Fields in HTTP Header
    field, check the box.
  12. In the
    Allow Merge Fields in HTTP Body
    field, check the box.
  13. Leave the
    Outbound Network Connection
    field blank.
  14. Click
    Save
    .

Creating a Payment Gateway Record

You must create a payment gateway record for each payment processor that you use.
  1. Click the
    App Launcher
    , and in the search box that appears, enter
    Payment Gateways
    .
  2. In the search results, click on
    Payment Gateways
    . The Payment Gateways page appears.
  3. Click
    New
    .
  4. On the New Payment Gateway page, in the
    Payment Gateway Name
    field, enter the name of the payment gateway.
  5. In the
    Payment Gateway Provider
    field, enter the name of the gateway provider.
  6. In the
    Merchant Credential
    field:

    ADDITIONAL INFORMATION

    • For a test environment, enter
      Payment_TEST.
    • For a production/live environment, enter
      Payment_LIVE
      or the name of your Named Credential that points to the
      Cybersource
      production/live endpoint.
  7. In the
    Status
    field, select
    Active
    to activate the payment gateway.
  8. In the
    External Reference
    field, enter the processor ID for your Salesforce commerce cloud instance. You can find your processor ID by going to your Salesforce Commerce Cloud instance and selecting
    Merchant Tools > Ordering > Payment Processors
    .
  9. In the
    Comments
    field, enter a description or any comments about this payment gateway record.
  10. Click
    Save
    .

Assigning the Permission Set to Admin User

You must assign the permissions to the Admin user that are required to access the payment configuration settings.
  1. Click
    Setup
    .
  2. In the Quick Find box, enter
    Users
    .
  3. At the bottom of the Users list, click
    Users
    . The Users page that lists all of the users appears.
  4. In the list of users, find and click the Admin user.
  5. At the top of the page, click
    Permission Set Assignment
    . The Permission Set Assignment section appears.
  6. Click
    Edit Assignments
    . The Permission Sets page appears.
  7. In the Available Permissions Sets list, find the
    Payment Configuration Access
    permission set and select it.
  8. Click
    Add
    to move the permission set to the Enabled Permission Sets list.
  9. Click
    Save
    .

Activating the Create Invoice and Ensure Funds Flow

You must enable the flow process in Salesforce that creates invoices and allows funds to be exchanged between your customers and your business.
  1. Click
    Setup
    .
  2. In the Quick Find box, enter
    Flow
    . The All Flows page appears.
  3. In the list of flows, find and click
    Activate Create Invoice and Ensure Funds
    .
  4. In the
    Active
    column of the flow, check the box to enable the flow.

Creating a Payment Configuration Record

You must provide a REST API key and a shared key to authenticate the API requests that you send to
Cybersource
. These authentication credentials are created in the Business Center. You should register for a Business Center account, get a sandbox account, and generate your security certificates so that you can test your implementation before going live. For more information on how to do this, see Getting Started with REST.
When you have generated your authentication credentials, you must add them to a payment configuration record so that requests to Salesforce Order Management can be validated.
Follow these steps to create a payment configuration record. If you have a multi-site configuration with different merchant IDs, you must create a separate payment configuration record for each merchant ID and for each sales channel.
  1. From the App Launcher, search for
    Set Payment Configuration
    .
  2. Click the
    Set Payment Configuration
    result to open a tab.
  3. In the
    Store Name
    field, from the drop-down menu, select the name of the store that needs keys to be set.
  4. In the
    Merchant ID
    field, enter your merchant ID.
  5. In the
    Endpoint
    field, from the drop-down menu, select
    TEST
    or
    PRODUCTION
    .
  6. In the
    REST Key ID
    field, enter the key value generated in the Business Center.
  7. In the
    REST Shared Key
    field, enter the key value generated in the Business Center.
  8. In the
    Developer ID
    field, enter the unique identifier generated by
    Cybersource
    for a system integrator.
  9. Click
    Save
    .

Testing Your Integration

Before you start accepting payments, test your integration in the testing sandbox that is provided by
Cybersource
. The sandbox simulates the live payment gateway and enables you to test your configuration and resolve issues before going live.
The sandbox never processes an actual payment. Sandbox transactions are not submitted to financial institutions for processing. The sandbox environment is separate from the live production environment, and it requires separate authentication credentials. If you use your production credentials in the sandbox or vice versa, you get a 401 HTTP error.
After testing your integration to confirm that everything works properly, you can configure your production account to start processing live transactions.