The Adyen Payments app - B2B Commerce Lightning is a payment solution for your ecommerce site. The integration supports authorisations for credit cards to enable your B2B storefront.
Install the app
Install these packages in the same order:
This package only supports Salesforce's Main Checkout Flow
Step 1: Create a named credential
The Named Credential has the authentication details used between the Salesforce B2B Commerce and Adyen.
- Create a new Merchant Account/Use Existing Merchant account in Adyen Customer Area and make sure that the Web Service user has API PCI role.
- From Setup, go to Security > Named Credentials.
- Select Named Credential 'Adyen' and update these properties:
Field | Value |
---|---|
Username | The name of your Adyen API Credential, for example ws@Company. [YourAdyenCompanyAccount]. |
Password | The basic authentication password for your Adyen API credential. |
Step 2: Configure Adyen Adapter Custom metadata
Update AdyenDefault metadata record:
- Go to Custom Code > Custom Metadata Types from Setup.
- On Adyen Adapter type, select Manage Records.
- Click on AdyenDefault and enter the following values:
Field | Required | Value |
---|---|---|
Merchant Account | ![]() |
The name of your Adyen Merchant account. Case-sensitive. |
System Integrator Name | The name of your System Integrator. | |
Single Currency Code | The currency ISO Code the Org uses, for example USD. Leave the Single Currency Code blank if Org is using multi-currency. The adapter then looks for xxxlsoCode fields which are placed when multi-currency is enabled. |
- Select Save.
- From Setup go to Custom Code > Custom Metadata Types.
- On Adyen Adapter type, select Manage Records.
- Select New and add a new record for your Adyen Merchant Account:
- Label: A unique label.
- Adyen Adapter Name: The name of your Adyen Merchant account. Case-sensitive.
- Endpoint Path:
/checkout
- Endpoint API Version: /v68
- Endpoint Method: POST
- Authorize Endpoint:
/payments
- Capture Endpoint:
/payments/{paymentPspReference}/captures
- Refund Endpoint:
/payments/{paymentPspReference}/refunds
- Merchant Account: The name of your Adyen merchant account. Case-sensitive.
- Select Save to complete.
Step 3: Set up the Payment Gateway
To set up the Payment Gateway:
Create the Payment Gateway Provider record
First, get the Apex Adapter ID:
- From Setup go to Custom Code > Apex Classes
- Choose AdyenAsyncAdapter class.
- Make a note of the final part of the URL in your browser, for example 01pB0000004IvhM. This is the Apex Adapter ID.
Then, use Workbench to add the Payment Gateway Provider record:
-
Log in to Workbench.
-
Choose API v68.
-
Select Utilities > REST Explorer.
-
Make a POST
/services/data/v68.0/tooling/sobjects/PaymentGatewayProvider
request with the following body:{ "ApexAdapterId": "YOUR_APEX_ADAPTER_ID", "DeveloperName": "Adyen", "MasterLabel": "SalesforceOrderManagement-Adyen", "IdempotencySupported": "Yes" }
-
You get a confirmation if the Payment Gateway Provider record was created successfully.
Create a Payment Gateway record
- In the Commerce app, select App Switcher and type Payment Gateways.
- Select New, and enter the following values:
Field | Value |
---|---|
Payment Gateway Name | Adyen |
Payment Gateway Provider | Choose CommercePaymentsAdyenAsyncAdapter. |
Merchant Credential | Adyen. This is the Named Credential you created. |
Status | Active |
External Reference | Leave blank. |
- Select Save.
Step 4: Set up webhook notifications
Adyen uses webhooks to send JSON notifications asynchronously to your Salesforce payment gateway adapter. To receive these notifications, you need to:
- Expose a Salesforce site endpoint.
- Configure webhook notifications in the Adyen Customer Area.
- Test your webhook configuration.
Expose a Salesforce site endpoint
This site will accept Adyen's webhook notifications.
- From Setup, go to User Interface > Sites and Domains - Sites, and then select Site.
- Select New.
- Enter a label, for example Adyen. Select Active.
- Enter a unique value for the default web address, for example
http://dev-myorganization--sandbox.cs17.force.com/adyen
- Select Guest Access to the Payments API, and then save your changes.
- Select an Active Site Home Page, for example, UnderConstruction, and Save your changes.
- Activate the site.
- Go to Public Access Settings > Custom Metadata Types. Select Edit and enable the Adyen Adapter metadata type.
To construct the webhook endpoint URL you need:
- The URL of your Salesforce site.
- The Payment Gateway Provider ID you got when creating the payment gateway provider record.
Configure notifications in the Adyen Customer Area
- Log in to your Customer Area. If you want to configure webhooks for a merchant account, switch to that merchant account.
- Select Developers > Webhooks.
- Select + Webhook.
- Under Recommended webhooks > Standard notification select Add.
- Select the toggle to make the standard notification Enabled.
- Select the edit icon for Server configuration.
- Enter:
- URL: The webhook endpoint URL you constructed.
- Method: Select JSON.
- SSL Version: Select TLSv1.2.
Select Apply.
- Under General > Events, select the edit icon . Remove all events except CAPTURE and REFUND. Select Apply. Contact our Support Team to enable this if you don't have access.
- Select Save changes.
Test your webhook configuration
- In your Customer Area, go to Developers > Webhooks.
- Next to Standard notification, select the edit webhook icon .
- Under Test Notifications, toggle which notifications you want to test.
- Select Test Configuration.
Seeing [accepted]
in all of the test results confirms your webhook configuration is correct.
Step 5: Custom metadata access to Customer Community User Profile
- From Setup, go to Profiles > Customer Community User Profile - Sites.
- Select Enabled Custom metadata Type Access, click Edit.
- Choose AdyenAsyncAdapter and move it from Available Custom metadata types to Enabled Custom metadata types.
- Click Save.
Step 6: Go to Store Administration
Go to Card Payment Gateway settings and choose AdyenAsyncAdapter.