Salesforce Order Management

Salesforce Order Management helps you manage orders and delivers a seamless, omnichannel commerce experience to your customers. It is integrated with B2C Commerce and supports Service Cloud to provide a single view of your order and service history.
With Salesforce Order Management:
  • Customers can submit orders from any commerce channel and manage their orders throughout the order cycle.
  • Merchants can manage order fulfilment, shipping, payment capture, invoicing, and service with integrated and custom business processes and workflows.
  • Service agents can access a central repository of order-related information to see the entire order lifecycle and to process cancellations and returns.

Requirements

You must fulfill these requirements to use Salesforce Order Management:
  • Open a Cybersource sandbox account to use for testing. For more information, see Signing Up for a Sandbox Account.
  • Open a Salesforce account with access to your cloud instance.
  • Obtain an API key and API shared secret key to authenticate requests. For more information, see Creating a Shared Secret Key Pair.
  • Know how to configure and work within Salesforce. This guide does not explain how to work with Salesforce software, so you must already be familiar with Salesforce products.

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.

Configuring a Custom Payment Method for Klarna

Create a payment method for Klarna as a custom payment method. The custom payment method is normally configured as an Alternative Payment Method. The Alternative Payment Method requires that you create a Gtwy Prov Payment Method Type record to associate the custom payment method with a payment gateway. Currently, the Salesforce user interface does not enable you to create a Gtwy Prov Payment Method Type record, so you must use Workbench to create the record type.
  1. To configure a new integration with Salesforce for the custom payment method, follow the steps described in Integrating with Salesforce.
  2. After the new integration is created, open Workbench and go to this endpoint:
    (MD/ToolingAPI):/services/data/v58.0/sobjects/GtwyProvPaymentMethodType
  3. Create your payload using these fields:

    ADDITIONAL INFORMATION

    • Comments
      : This optional value can be used to describe the record.
    • Developer Name
      : This value is the unique API name of the record.
    • Master Label
      : This value is a human-readable name for the record.
    • Gateway Provider Payment Method Type
      : This value is the name of the payment method in the storefront. This value must exactly match the payment method ID used in B2C Commerce.
    • Payment Gateway Provider Id
      : This value is the ID assigned to the Payment Gateway Provider record associated with the payment processor for the payment method.
    • Payment Method Type
      : This value can be one of these options:
      AlternativePaymentMethod
      ,
      CardPaymentMethod
      , or
      DigitalWallet
      . (When using
      AlternativePaymentMethod
      , you must first create a corresponding RecordType record.)
    • Record Type Id
      : This value is a reference to the RecordType record of the
      AlternativePaymentMethod
      .
This example shows what your payload should look like:
{ "DeveloperName": "Klarna", "MasterLabel": "Klarna Payment", "GtwyProviderPaymentMethodType": "KLARNA", "PaymentGatewayProviderId": <Id of Payment Gateway Provider>, "PaymentMethodType": "DigitalWallet", "RecordTypeId": <ID of Record type in Alternate Payment Method> }

Going Live

When the sandbox testing of your Salesforce integration is complete and all issues are resolved, you are ready to go live. You need to create a live version of your test integration by changing any test settings to production. Follow these steps to take your Salesforce Order Management integration live:
  1. Install the managed package in your production environment.
  2. Create a new Payment Gateway Provider record in your production environment by following the steps in Creating a Payment Gateway Provider.
  3. Create a new named credential called
    Payment_LIVE
    in your production environment by following the steps in Creating a Named Credentials Record.
  4. Create a new payment gateway record in your production environment by following the steps in Creating a Payment Gateway Record.
  5. Create a new payment configuration custom setting record in your production environment by following the steps in Creating a Payment Configuration Record. If you support a multi-site configuration for different merchant IDs, you must create a separate record for each merchant ID and each sales channel. When creating the payment configuration record, be sure to select
    PRODUCTION
    as the endpoint field.

Upgrading the Salesforce Package

When upgrading your Salesforce package, follow the standard Salesforce process to upgrade the
Cybersource
for Lightning Order Management package. For more information about upgrading Salesforce software, go to the Salesforce documentation at Upgrade Your Managed Package. Upgrading your Salesforce software does not affect the payment gateway providers and records you created earlier.