This repository showcases an integration example of some features and capabilities of Adyen Payments integration with Salesforce Composable Storefront (PWA) for B2C Commerce.
Before you start this demo, make sure that:
- You have created an Adyen Test Account
- You have a Salesforce sandbox connected to your Salesforce Commerce Cloud (SFCC) instance. You can create an on-demand sandbox.
- You have set up your sites and SLAS for Composable Storefront.
- You have set up and know where to find configuration values for your local environment.
You can run this demo on your local machine.
- Node v18 or later
- npm v9 or later
git clone https://github.com/adyen-examples/adyen-salesforce-pwa-headless-demo.git
- Create a
./.envfile with your environment variables.
- Copy the
./.env.examplefile and rename the file to .env.
- Set the variables in the .env file. Replace
YOUR_SITE_IDin the variables with your Salesforce Site ID, this value is identical to the value you have forCOMMERCE_API_SITE_IDf.e.RefArch_ADYEN_API_KEYwhereRefArchis your Site ID.
It is required to specify the domain or URL of the web applications that will make requests to Adyen.
In the Customer Area add http://localhost:3000 to the list of Allowed Origins associated with the Client Key.
npm install
npm run start
Visit http://localhost:3000/ to view storefront and make a test payment.
Try out the different payment methods with our test card numbers and other payment method details.
In the Customer Area under the Developers → Webhooks section, create a new Standard webhook.
A good practice is to set up basic authentication, copy the generated HMAC Key and set it as an environment variable. The application will use this to verify the HMAC signatures.
Make sure the webhook is enabled, so it can receive notifications.
This demo provides a simple webhook implementation exposed at /api/webhooks/notifications that shows you how to receive, validate and consume the webhook payload.
The following webhooks events should be enabled:
- AUTHORISATION
To make sure that the Adyen platform can reach your application, we have written a Webhooks Testing Guide that explores several options on how you can easily achieve this (e.g. running on localhost or cloud).
We commit all our new features directly into our GitHub repository. Feel free to request or suggest new features or code changes yourself as well!
Find out more in our Contributing guidelines.
MIT license. For more information, see the LICENSE file in the root directory.