Skip to content

Latest commit

 

History

History

checkout-example

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Adyen Online Payments Integration Demo - Sessions Flow

Node.js CI E2E (Playwright)

Run demo in one-click

Open in Gitpod
 First time with Gitpod?

Description

This repository showcases a PCI-compliant integration of the Sessions Flow, the default integration that we recommend for merchants. Explore this simplified e-commerce demo to discover the code, libraries and configuration you need to enable various payment options in your checkout experience.

It includes a NodeJS + Express application that supports Adyen Drop-in and Components (ACH, Alipay, Cards, Dotpay, iDEAL, Klarna, PayPal, etc..) using the Adyen's API Library for Node.js (GitHub).

Note: For a three-steps advanced use case check out the Advanced Flow demo in the checkout-example-advanced folder.

Card checkout demo

Requirements

1. Installation

git clone https://github.com/adyen-examples/adyen-node-online-payments.git

2. Set the environment variables

Create a ./.env file with the environment variables.

export ADYEN_API_KEY=yourAdyenApiKey
export ADYEN_MERCHANT_ACCOUNT=yourAdyenMerchantAccount
export ADYEN_CLIENT_KEY=yourAdyenClientKey
export ADYEN_HMAC_KEY=yourHmacKey

3. Configure allowed origins (CORS)

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:8080 in the list of Allowed Origins associated with the Client Key.

4. Run the application

cd checkout-example
    
npm install
npm run dev

Visit http://localhost:8080/ to choose an integration type.

Try out the different payment methods with our test card numbers and other payment method details.

Webhooks

Webhooks deliver asynchronous notifications about the payment status and other events that are important to receive and process. You can find more information about webhooks in this blog post.

Webhook setup

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.

Expose an endpoint

This demo provides a simple webhook implementation exposed at /api/webhooks/notifications that shows you how to receive, validate and consume the webhook payload.

Test your webhook

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).