This page explains how to integrate with our OMS package to manage orders for your Salesforce Commerce Cloud store that uses the Adyen payments cartridge.
Start integrating with Salesforce OMS package
Choose your versionRequirements
Before you begin, take into account the following requirements, limitations, and preparations.
Requirement | Description |
---|---|
Integration type | Make sure that you have a Salesforce Commerce Cloud (SFCC) storefront that uses the Adyen payments cartridge. |
Webhooks | Subscribe to the Standard webhooks. |
Setup steps | Before you begin:
|
How it works
With our Salesforce OMS package, you handle captures and refunds for the payments of your Salesforce Commerce Cloud storefront. The package keeps the Adyen and Salesforce systems in sync, so that you can seamlessly manage your order and payment flows.
To set up the package:
- Install the package.
- Configure package components in your OMS Org.
- Set up the payment gateway in your OMS Org.
- Set up webhooks in your OMS Org and the Adyen Customer Area.
- Set up alternative payment methods in your OMS Org.
- Configure capture settings in your SFCC Business Manager.
Install the app
- In your Salesforce OMS Org, enable multiple currencies.
- Install the Adyen Payments for Salesforce Order Management (SOM) app with the installation key Payments@Adyen.
- Follow the instructions on the Salesforce Application Installation Guide.
Set up the Payment Gateway
To set up the Payment Gateway:
- Create a Payment Gateway record.
- Only if you process in-person payments with endless aisle, create a payment gateway record for in-person payments.
- Get the Payment Gateway Provider ID.
Create a Payment Gateway record
Create a Payment Gateway record in Salesforce:
-
In the App Launcher, search for Payment Gateways and select it.
-
Select New and enter the following values into the corresponding fields:
Field Value Payment Gateway Name Adyen Payment Gateway Provider Select Adyen OMS Provider. Merchant Credential Select AdyenCheckout. Due to a known Salesforce issue, you may not be able to select AdyenCheckout. If you experience this, go to Setup > Named Credentials, and select Adyen Checkout. Then, go back to the Adyen Payment Gateway record, select Refresh, and try again.Status Active External Reference Adyen_Component. This value must match your SFCC B2C Payment Processor ID. -
Select Save.
Create a Payment Gateway record for in-person payments
This step is only required if you process in-person payments with endless aisle.
Create a Payment Gateway record in Salesforce:
-
In the App Launcher, search for Payment Gateways and select it.
-
Select New and enter the following values into the corresponding fields:
Field Value Payment Gateway Name AdyenPos Payment Gateway Provider Select Adyen OMS Provider. Merchant Credential Select AdyenCheckout. Status Active External Reference Adyen_POS. This value must match your SFCC B2C Payment Processor ID. -
Select Save.
Get the Payment Gateway Provider ID
Get the Payment Gateway Provider ID for the record you created. You will need this ID when you set up webhooks.
- In the Payment Gateway record you created, select the Adyen OMS Provider hyperlink.
This opens the Payment Gateway Provider page. - In the Site URL, find the ID, starting with 0cJ.
- Save this ID for later use.
Set up webhooks
Adyen uses webhooks to send you updates on payment statuses. To enable receiving these webhooks:
- Expose a Salesforce site endpoint. You need to expose different Salesforce site endpoints to receive default payment status updates, and updates related to payment modifications initiated from the Adyen Customer Area.
- Configure webhooks in the Customer Area, for each of your Salesforce site endpoints.
- Test your webhook configuration.
Expose Salesforce site endpoints
Default webhooks
-
In your Salesforce OMS Org, go to Setup > User Interface > Sites and Domains - Sites, and then select Sites.
-
Select New.
-
Enter a label, for example Adyen.
-
Enter a unique value for the default web address, for example
http://dev-myorganization--sandbox.cs17.force.com/adyen
. -
Select Active.
-
Select an Active Site Home Page, for example, UnderConstruction.
-
Select Guest Access to the Payments API.
-
Select Save to save your changes and make sure the site is active.
-
Go to Public Access Settings > Custom Metadata Type Access.
-
Select Edit and enable the Adyen Adapter metadata type by moving it to the Enabled column.
-
Select Save.
-
Construct your webhook endpoint URL with:
- The URL of your Salesforce site.
- The Payment Gateway Provider ID.
Webhook endpoint URL formatExpand viewCopy link to code blockCopy codeYOUR_SALESFORCE_SITE_URL/services/data/v60.0/commerce/payments/notify?provider=YOUR_PAYMENT_GATEWAY_PROVIDER_ID
For example:
Example Webhook endpoint URLExpand viewCopy link to code blockCopy codehttps://dev-clientname.cs17.force.com/adyen/services/data/v60.0/commerce/payments/notify?provider=0cJ4W000000XWnuUAG
-
Save the endpoint URL in your system, you will need it when you configure webhooks in the Customer Area.
Webhooks for modifications initiated from the Customer Area
Expose an additional Salesforce site endpoint to receive webhooks related to captures or refunds initiated from the Adyen Customer Area. Our OMS package creates a payment gateway log under the Salesforce Order Payment Summary. This lets you track the status of payments that are modified through the Customer Area.
- In your Salesforce OMS Org, go to Setup > User Interface > Sites and Domains - Sites, and then select Sites.
- From the site list, select Adyen.
- Select Public Access Settings.
- Under Apps, select Apex Class Access.
- Select Edit, and from the Available Apex Classes list, select adyen_payment.NonPaymentWebhookHandler.
- Select Add to move it to the Enabled Apex Classes list.
This exposes an additional site endpoint to receive webhooks:
YOUR_SALESFORCE_SITE_URL/adyen/services/apexrest/adyen_payment/nonPaymentWebhook/v1
Configure webhooks in the Customer Area
Configure webhooks for each of the Salesforce site endpoint URLs you exposed.
To configure a webhook:
-
In your Customer Area, go to Developers > Webhooks.
We recommend to configure webhooks for your company account. This ensures that you do not have duplicate webhook configurations, and improves performance.
-
Select Webhook.
-
From the list of webhooks, next to Standard webhook, select Add.
-
Under General, configure the following:
Setting Description Enabled Select the toggle to enable or disable the webhook. Version The webhook version. Description Your description of the webhook. Merchant accounts You can apply the webhook to all merchant accounts under a company account, or only to specific merchant accounts. -
Under Server configuration, configure the following:
Setting Description URL The webhook endpoint URL for either:
- Default webhooks
- Webhooks for modifications initiated from the Customer Area.Method JSON Encryption protocol The latest TLS version in the list. -
Under Security, configure the following:
Setting Description HMAC Key Generate the HMAC Key, copy it, and store it securely in your system. You need to enter the HMAC key when you configure package components.
You only have to generate the HMAC key once, if you are setting up the second webhook, use the HMAC key that you already generated. -
Under Events, in addition to the default events that are selected, select the following events:
- For default webhooks, select CAPTURE, CAPTURE_FAILED, REFUND, and REFUND_FAILED.
- For webhooks for modifications initiated from the Customer Area, select AUTHORISATION, CAPTURE, and REFUND.
-
Select Save configuration.
Rarely, a refund or capture can fail after you have received a REFUND or CAPTURE webhook with success:
true. After a payment is processed in Salesforce, the status cannot be changed. Therefore, we recommend to monitor these cases in the GatewayResultCode
field of the PaymentGatewayLog object in Salesforce. When a refund or capture fails, the GatewayResultCode
is marked with CAPTURE_FAILED, or REFUND_FAILED. Learn more in our Capture and Refund documentation.
Test your webhook configuration
Before you can test your webhook configuration, you have to add your HMAC key in your Salesforce custom metadata configuration.
- In your Customer Area, go to Developers > Webhooks.
- Next to Standard webhook, select the edit webhook icon .
- Select Test Configuration.
- If you are on a company account, select a Merchant account from the dropdown list.
- In the Event dropdown list, select the event code.
If your webhook configuration is correct, it shows a successful HTTP response status code, for example ResponseCode
: 200.
Configure package components
In your Salesforce OMS Org, configure package components:
- Add new Adyen fields to the layout.
- Set up the Principal Credential.
- Configure Adyen custom metadata type.
- Optionally, configure a merchant account for a sales channel.
Add new Adyen fields to the layout
- From Setup, go to Object Manager.
- Search for and click on the Sales Channel object.
- Click on Page Layouts and select the page layout that you want the new Adyen Merchant Account field to appear in.
- Drag and drop the field to your selected layout.
- Click Save.
Repeat these steps for the Payment and Payment Authorization objects by adding the Adyen Payment Method and Adyen Payment Method Variant fields.
Set up the Principal Credential
The package uses Named Credentials to perform authentication between the Salesforce OMS and Adyen. When you install the app, the Named Credential is set up automatically.
You must also set up a Principal Credential.
Legacy Named Credentials are deprecated by Salesforce and are not used in our package from this version onwards.
These steps below are based on the Salesforce Enhanced Profile User Interface. If you use the old view, the steps you have to take may differ.
In addition to the Named Credential, you need to set up a Principal Credential. To do this, in your OMS Org:
- Go to Setup > Security > Named Credentials.
- Under External Credential, select Adyen API.
- Under Principals, next to the AdyenParameterKey, select the Actions button, and then select Edit.
This opens a modal window. - Select Add, and add an authentication parameter with the following properties:
- Name: ApiKey
- Value: Your API key
After setting up the Principal, give access to this Principal with a permission set:
- Go to Setup > Users > Permission Sets.
- Select New.
- In the Label field, enter a name, and select Save.
- Select External Credential Principal Access.
- Select Edit and enable the Principal you have set up by moving it from the Available to the Enabled column.
- Go back to the permission set, and select Object Settings.
- Select User External Credentials, and select Edit.
- Next to Read, select the checkbox to give read access.
-
Assign the permission set you have created to the Automated Process user. This user is a hidden Salesforce user that runs scheduled flows and other automated processes, including the payment flows. If you have modified your process automation settings , this user may differ.
- Select Manage Assignments, and then select Add Assignment.
- In the user list, select the Automated Process user, and select Next.
If the user is not visible in the list, switch to the All Users list view and search for auto, - Select Assign.
Alternatively, you can assign also assign the permission set to the Automated Process user by:
-
In your Developer Console, query the Profile Id for this user with the following:
Expand viewCopy link to code blockCopy codeSELECT ProfileId FROM User WHERE Alias = 'autoproc'
-
Construct a URL to access the page where you can edit permissions.
Expand viewCopy link to code blockCopy codeYOUR_SF_ORG_URL/_ui/system/user/ProfileExternalCredentialPrincipalPermissionEdit/e?profile_id=PROFILE_ID
YOUR_SF_ORG_URL
: Your Salesforce Org Url.PROFILE_ID
: The profile Id you received as a result to the query.
-
Navigate to the URL that you constructed.
-
Select Edit and enable the Principal you have set up by moving it from the Available to the Enabled column.
-
Select Save.
Configure Adyen custom metadata type
- In your OMS Org, go to Setup > Custom Code > Custom Metadata Types.
- Next to Adyen Adapter, select Manage Records.
- Next to Adyen Default, select Edit.
- Fill the following fields:
- Merchant Account: your Adyen merchant account name. This field is case-sensitive.
- HMAC Key: your HMAC key.
- Select Save.
After you have added your HMAC key in Salesforce, test your webhook configuration.
(Optional) Configure sales channels
Optionally, you can link your sales channels to use specific Adyen merchant accounts. Sales channels that are not linked to a specific merchant account use the merchant account you configured in the Adyen Default custom metadata record.
Before you can link an Adyen merchant account to a sales channel, make sure that:
- The merchant account has API permissions.
- There is a custom metadata record with the merchant account name in the Adyen Adapter custom metadata object.
To link an Adyen merchant account to a sales channel:
- In your OMS Org, go to the App Launcher, , search for Sales Channels.
- Select the Sales Channel that you want to configure a merchant account for.
- Set the Adyen Merchant Account field to the name of the merchant account that you want to link to this sales channel.
Set up alternative payment methods
To set up alternative payment methods, add permissions in Salesforce:
- In your Salesforce OMS Org, go to Setup > Permission Sets > Order Management B2C service > Object Settings > Alternative Payment Methods > Edit.
- Under Record Type Assignments > Alternative Payment Method record type, select the Assigned Record Types checkbox.
- Click Save.
- Go back to Object Settings and go to Payment Authorizations > Edit.
- Under Field Permissions, add Edit access for the Adyen Payment Method and Adyen Payment Method Variant fields.
- Click Save.
- Go back to Object Settings and go to Payments > Edit.
- Under Field Permissions, add Edit access for the Adyen Payment Method and Adyen Payment Method Variant fields.
- Click Save.
Configure capture settings
With our OMS package, you can capture payments at any step in your order fulfillment flow. The steps you need to follow to configure captures in SFCC depends on your capture setting in the Adyen Customer Area:
- Manual capture : you can capture payments from the OMS after they have been authorized.
- Automatic capture : payments are captured automatically after authorization. You do not have to manually capture payments from the OMS. Our OMS package handles the automatic captures without disrupting the payment flow. If you have set up automatic capture in your Customer Area, follow the steps to enable automatic captures with OMS.
Regardless of your setting, payments for some payment methods are captured immediately after authorization. You must specify these payment methods in your Salesforce Business Manager to prevent duplicate capture requests.
Enable automatic captures
To prevent OMS from making duplicate capture requests to Adyen when you have set up automatic captures in your Adyen Customer Area, follow the steps below.
-
In your Salesforce OMS Org, go to Setup > Custom Code > Custom Metadata Types.
-
Select Adyen Adapter.
-
Scroll down to Adyen Adapter Layout, and select Edit.
-
Drag and drop the Auto Capture Enabled and Manual Capture Payment Methods fields to the Adyen Adapter Layout.
-
Select Save.
-
Select Manage Adyen Adapters.
-
Next to Adyen Default, select Edit.
-
Select the checkbox next to Auto Capture Enabled.
When you have set this up, OMS will process the payment record without an additional capture request, and the following payment gateway log will be created:[capture-complete] Auto Capture enabled
-
For some payment methods, manual captures are required even when you have set up automatic captures in your Adyen Customer Area. In the Manual Capture Payment Methods field, specify the payment methods that require manual capture, using the
paymentMethodVariant
for each payment method. Separate each variant with a comma, for example:klarna, klarna_account
-
Select Save.
Specify payments without separate captures in SFCC
Payments for some payment methods are captured immediately after authorization regardless of your capture settings. You need to specify these payment methods that you enabled in the Adyen Customer Area in your Salesforce Business Manager. This prevents OMS from initiating duplicate capture requests.
- In your Salesforce Business Manager, go to Merchant Tools > Site Preferences > Adyen settings > Local payment method settings.
- In the Payment methods without separate capture field, specify the payment methods that you added in your Customer Area. Separate each variant with a comma, for example:
ideal, paypal, applepay, visa_applepay, mc_applepay, amex_applepay, klarna_paynow, twint, sepadirectdebit, bcmc, wechatpay, multibanco, blik, mbway, pix, onlineBanking_PL
- Select Save Changes.
Go live
When you are ready to go live, apply for a live account. Review the process to start accepting payments on Get started with Adyen.
When you get your live account:
- Follow our SFCC go-live checklist. You do not need to follow the steps to configure the SFCC Business Manager in the checklist.
- Update the Adyen credentials you used to set up your Salesforce OMS Org:
- In the custom metadata record:
- Update your HMAC key.
- If you are using a different merchant account in the live environment, update the merchant account name.
- In the custom metadata record:
- Switch the URL for the Adyen Checkout named credential to your live URL:
- In your OMS Org, go to Setup > Security > Named Credentials.
- Select the Adyen Checkout named credential.
- Replace the test URL with
https://[YOUR_LIVE_PREFIX]-checkout-live.adyenpayments.com/checkout
. Get your live prefix from the live Customer Area.
- Switch your test API key to your live API Key:
- Select the External Credential linked to your Adyen Checkout named credential.
- Under Principals, update your API key authentication parameter to your live API key.