No momento, esta página não está disponível em português
Plugin icon

Salesforce B2B Commerce Lightning

Use our app for Salesforce B2B Commerce Lightning to accept payments.

  Read more
Learn more about Salesforce B2B in our Partner Directory.

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:

  1. Apex API Lib Package v2.0.0.0
  2. B2B L Package 1.1.0.0.

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.

  1. Create a new Merchant Account/Use Existing Merchant account in your Customer Area and make sure that the Web Service user has API PCI role.
  2. From Setup, go to Security > Named Credentials.
  3. 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:

  1. Go to Custom Code > Custom Metadata Types from Setup.

  2. On Adyen Adapter type, select Manage Records.

  3. Click on AdyenDefault and enter the following values:

    Field Required Value
    Merchant Account -white_check_mark- 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.
  4. Select Save.

  5. From Setup go to Custom Code > Custom Metadata Types.

  6. On Adyen Adapter type, select Manage Records.

  7. 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.
  8. Select Save to complete.

Step 3: Set up the Payment Gateway

To set up the Payment Gateway:

  1. Create a Payment Gateway Provider record.
  2. Create a Payment Gateway record.

Create the Payment Gateway Provider record

First, get the Apex Adapter ID:

  1. From Setup go to Custom Code > Apex Classes
  2. Choose AdyenAsyncAdapter class.
  3. 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:

  1. Log in to Workbench.

  2. Choose API v56.

  3. Select Utilities > REST Explorer.

  4. Make a POST /services/data/v56.0/tooling/sobjects/PaymentGatewayProvider request with the following body:

    {
    "ApexAdapterId": "YOUR_APEX_ADAPTER_ID",
    "DeveloperName": "Adyen",
    "MasterLabel": "SalesforceOrderManagement-Adyen",
    "IdempotencySupported": "Yes"
    }
  5. You get a confirmation if the Payment Gateway Provider record was created successfully.

Create a Payment Gateway record

  1. In the Commerce app, select App Switcher and type Payment Gateways.

  2. 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.
  3. Select Save.

Step 4: Set up webhooks

Adyen uses webhooks to send JSON webhooks asynchronously to your Salesforce payment gateway adapter. To receive these webhooks, you need to:

  1. Expose a Salesforce site endpoint.
  2. Configure webhooks in the Customer Area.
  3. Test your webhook configuration.

Expose a Salesforce site endpoint

This site will accept Adyen's webhooks.

  1. From Setup, go to User Interface > Sites and Domains - Sites, and then select Site.
  2. Select New.
  3. Enter a label, for example Adyen. Select Active.
  4. Enter a unique value for the default web address, for example http://dev-myorganization--sandbox.cs17.force.com/adyen.
  5. Select Active.
  6. Select an Active Site Home Page, for example, UnderConstruction.
  7. Select Guest Access to the Payments API.
  8. Select Save to save your changes and make sure the site is active.
  9. Go to Public Access Settings > Custom Metadata Type Access.
  10. Select Edit and enable the Adyen Adapter metadata type by moving it to the Enabled column.
  11. Select Save.

To construct the webhook endpoint URL you need:

Configure webhooks in the Customer Area

  1. Log in to your Customer Area. If you want to configure webhooks for a merchant account, switch to that merchant account.
  2. Select Developers > Webhooks.
  3. Select + Webhook.
  4. Under Recommended webhooks > Standard webhook select Add.
  5. Select the toggle to make the standard webhook Enabled.
  6. Select the edit icon for Server configuration.
  7. Enter:

Select Apply.

  1. 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.
  2. Select Save changes.

Test your webhook configuration

  1. In your Customer Area, go to Developers > Webhooks.
  2. Next to Standard Webhook, select the edit webhook icon .
  3. Select Test Configuration.
  4. If you're on a company account, select a Merchant account from the dropdown list.
  5. In the Event dropdown list, select the event code.

Your webhook configuration is correct if your test webhook was accepted with a HTTP 2xx response code.

Step 5: Custom metadata access to Customer Community User Profile

  1. From Setup, go to Profiles > Customer Community User Profile - Sites.
  2. Select Enabled Custom metadata Type Access, click Edit.
  3. Choose AdyenAsyncAdapter and move it from Available Custom metadata types to Enabled Custom metadata types.
  4. Click Save.

Step 6: Go to Store Administration

Go to Card Payment Gateway settings and choose AdyenAsyncAdapter.