Salesforce Order Management
Last updated: April 29, 2022
Learn how to get started with our integration for Salesforce Order Management.
Minimum requirements
Our plugin (app) for Salesforce Order Management is compatible with:
- SFRA v.5.0.0 – 5.3.0
- SiteGenesis v.5.0
- Capture, partial capture, refund and partial refund, directly from Order Management
- Webhook fallback logic for payment capture
- Webhook signature for securing payment notifications
Information
Payment authorization is done through Salesforce Commerce Cloud, not Order Management.
Payment method | Countries |
---|---|
American Express | Global |
Diners | Global |
Discover | Global |
JCB | Global |
Mastercard | Global |
Visa | Global |
To install our plugin, you must first sign in to Salesforce as an administrator. The plugin can be installed in Professional, Enterprise, Force.com, Developer and Unlimited editions.
Before installing the plugin, make sure you've installed and configured Salesforce Order Management.
- Download the latest Checkout.com Payments for Order Management plugin from the Salesforce AppExchange.
- Choose the environment where you wish to install the plugin: production or sandbox.
- Select the terms and conditions checkbox and select Confirm and Install.
- Enter your credentials.
- Specify your desired security level and select Install.
- When the installation process has finished, select Done.
Creating a payment gateway provider is currently not supported from the UI. To create a payment gateway provider, follow the steps below:
- Sign in to Workbench using your organization’s credentials.
- Select Utilities > REST Explorer.
- Select
POST
as the HTTP method. - In the URL box, enter:
/services/data/v51.0/composite
- For Request Body enter:
1{2"allOrNone": true,3"compositeRequest": [4{5"method": "GET",6"url": "/services/data/v51.0/query/?q=SELECT+Id+FROM+ApexClass+WHERE+Name+=+'CheckoutAdapter'",7"referenceId": "refCheckoutAdapter"8},9{10"method": "POST",11"url": "/services/data/v51.0/sobjects/PaymentGatewayProvider",12"referenceId": "refPaymentGatewayProvider",13"body": {14"ApexAdapterId": "@{refCheckoutAdapter.records[0].Id}",15"DeveloperName": "Checkout_Payment_Provider",16"MasterLabel": "Checkout_Payment_Provider",17"IdempotencySupported": "Yes",18"Comments": "Comments"19}20}21]22}
- Select Execute and look for the success indicator (status codes in the
200
—299
range and IDs that are populated).
Next, you'll need to set up named credentials that are needed to connect to our APIs:
- In Salesforce Order Management, go to Setup > Security > Named Credentials and select New Named Credential.
- Set the fields to the following values:
Field name | Value |
---|---|
Label | Checkout Payment |
Name | Checkout_Payment |
URL |
|
Identity Type | Anonymous |
Authentication Protocol | No Authentication |
- Select the following checkboxes:
- Generate Authorization Header
- Allow Merge Fields in HTTP Header
- Allow Merge Fields in HTTP Body
- Select Save.
- Go to App Launcher > Payment Gateways and select New.
- Specify the Payment Gateway Name (for example,
Checkout CC
for credit cards). - For Payment Gateway Provider select the previously created Checkout.com payment gateway provider (
Checkout_Payment_Provider
). - For Merchant Credential select the previously created Checkout.com named credentials (
Checkout_Payment
). - Set Status to
Active
. - For External Reference enter the payment processor ID used on the SFCC side:
- For credit credit cards:
CHECKOUTCOM_CARD
- For APMs:
CHECKOUTCOM_APM
- For PayPal:
PAYPAL_EXPRESS
- For Google Pay:
CHECKOUTCOM_GOOGLE_PAY
- For Apple Pay:
CHECKOUTCOM_APPLE_PAY
- For credit credit cards:
- Select Save.
Note
You'll need to set up individual payment gateways for each payment method to be processed.
To enable us to send webhook notifications to Salesforce Order Management, you'll need to create a new site:
- In Order Management, go to Setup > User Interface > Sites and Domains > Sites.
- Follow the steps on the Sites page to register your site domain. Choose a site domain name that will be used for Checkout.com webhook notifications.
- Select New to create a new site.
- Set the fields to the following values:
Field name | Value |
---|---|
Site Label | Checkout_Notifications |
Site Name | Checkout_Notifications |
Site Description | Used for exposing REST services to Checkout Webhooks Notifications. |
- In the Active Site Home Page field, specify a home page (for example,
AnswersHome
). - Select the following checkboxes:
- Active
- Guest Access to the Payments API
- The rest of the settings can remain as they are. Select Save.
- On the Sites page, select the site label (
Checkout_Notifications
). - On the Site Details page, select Public Access Settings.
- In the list of app settings, select Apex Class Access.
- On the Apex Class Access page, select Edit.
- In the Available Apex Classes list, select
checkoutcom.CheckoutNotificationListener
and add it to the Enabled Apex Classes list. - Select Save.
- On the Site Details page for the
Checkout_Notifications
site, select Public Access Settings. - In the list of app settings, select Object Settings.
- In the All Object Settings list, select Checkout_Payment_Configs.
- Select Edit.
- Under Object Permissions, select Read.
- Under Field Permissions, select Active and Secret Key under the Read Access column.
- Leave the other settings as they are and select Save.
Since no authentication is used for the site, you must create a sharing rule for extending the access for the webhook notifications:
- Go to Setup > Security > Sharing Settings.
- Scroll down to Checkout_Payment_Config Sharing Rules and select New.
- Set the fields to the following values and select Save:
Field name | Value |
---|---|
Label | Share Config with Webhook Notification |
Rule Name | Share_Config_with_Webhook_Notification |
Description | Sharing rule for webhook notification |
Rule Type | Guest user access, based on criteria |
Criteria: Field | Active |
Criteria: Operator | Equals |
Criteria: Value | True |
Share with | Checkout_Notifications Site Guest User |
Access Level | Read Only |
Next, you'll need to set up named credentials that are used for the webhook listener:
- Go to Setup > Security > Named Credentials.
- Select New Named Credential.
- Set the fields to the following values:
Field name | Value |
---|---|
Label | Checkout Notification |
Name | Checkout_Notification |
URL | https://YourDomain/services/data/v51.0/commerce/payments/notify?provider=CheckoutPaymentProviderId |
Identity Type | Anonymous |
Authentication Protocol | No Authentication |
In the URL box, for YourDomain enter your organization’s site domain. For CheckoutPaymentProviderId, enter the ID of the payment gateway provider. To find the ID, open the Workbench and select Queries > SOQL Query. Set Object to PaymentGatewayProvider
, select all the fields, and select Query.
- Select Generate Authorization Header.
- Select Save.
We've implemented a fallback to ensure that payments are processed even if the webhook service is unavailable. You can schedule a job to check the payment status in the Checkout.com Hub and update the payment in Order Management. The check is done for payments with a Pending
status in Order Management. If a payment is captured in the Hub, it will be marked as processed in Order Management.
To schedule the job, follow the steps below:
- Go to Setup > Custom Code > Apex Classes and select Schedule Apex.
- Specify the job name (for example,
Checkout Webhook Fallback
). - For Apex Class select
WebhooksfallbackBatch_Scheduable
. - Specify how often the Apex class will run:
- Weekly: Select one or more days of the week (for example, Monday and Wednesday).
- Monthly: Select either the date the job is to run or the day (for example, the second Saturday of every month).
- Set the start and end dates for the Apex scheduled class. If you specify a single day, the job only runs once.
- Specify a preferred start time. The exact time the job starts depends on service availability.
- Select Save.
Information
You can view all scheduled jobs by selecting Setup > Environments > Jobs > Scheduled Jobs.
- Select the App Launcher and search for Checkout_Payment_Configs.
- Select New.
- In the Checkout_Payment_Config Name field, specify the name (for example,
Checkout Settings
). - For Webhook Endpoint enter the endpoint for the previously created site:
https://YourDomain/services/apexrest/checkoutcom/Checkout_Notifications
- Enter the secret key and public key from your Hub account.
- Select the Active checkbox.
- Select your organization’s currency.
- Select Save.
Information
When you create or update a Checkout Payment Config that is set as active, you are subscribed to the Checkout.com webhook notifications using the webhook endpoint as the URL. To see which events you are subscribed to, go to Setup > Custom Code > Custom Metadata Types > Webhook Event Types. By default, all webhook events are marked as subscribed and should remain as they are to ensure that the right webhook notifications are processed.