Skip to content

Latest commit

 

History

History
179 lines (143 loc) · 11.6 KB

File metadata and controls

179 lines (143 loc) · 11.6 KB

How to run

Environment variable

Extension module requires 1 environment variable to start. This environment variable name is ADYEN_INTEGRATION_CONFIG and it must contain settings as attributes in a JSON structure.

{
  "commercetools": {
    "commercetoolsProjectKey1": {
      "clientId": "xxx",
      "clientSecret": "xxx"
    },
    "commercetoolsProjectKey2": {
      "clientId": "xxx",
      "clientSecret": "xxx"
    }
  },
  "adyen": {
    "adyenMerchantAccount1": {
      "apiKey": "xxx"
    },
    "adyenMerchantAccount2": {
      "apiKey": "xxx"
    }
  }
}

The JSON structure will be described in details in the next sections of this documentation.

Adyen

  • For test environment follow the official Adyen get started guide to set up your test account, get your API key.
  • For live environment follow the official Adyen documentation for details.

Multiple child attributes can be provided in the adyen attribute. Each direct child attribute must represent 1 adyen merchant account like in the following example:

{
  "adyen": {
    "adyenMerchantAccount1": {  // The name of your first merchant account.
      "apiKey": "xxx"
      "apiBaseUrl": "https://checkout-test.adyen.com/v50",
      "legacyApiBaseUrl": "https://pal-test.adyen.com/pal/servlet/Payment/v50"
    },
    "adyenMerchantAccount2": {  // The name of your second merchant account.
      "apiKey": "xxx"
    }
  }
}
Name Content Required Default value (only for test environment)
apiKey You'll be making API requests that are authenticated with an API key. YES
apiBaseUrl Checkout endpoint of Adyen. NO https://checkout-test.adyen.com/v52
legacyApiBaseUrl Standart payment endpoint of Adyen. NO https://pal-test.adyen.com/pal/servlet/Payment/v52

Note: Sometimes it's necessary to regenerate the apiKey, when you get 403 Forbidden error from Adyen.

commercetools

If you don't have the commercetools OAuth credentials,create a commercetools API Client.

Extension module's recommended scope is manage_project.

Multiple child attributes can be provided in the commercetools attribute. Each direct child attribute must represent 1 commercetools project like in the following example:

{
  "commercetools": {
    "commercetoolsProjectKey1": { // commercetools project key of the first project
      "clientId": "xxx",
      "clientSecret": "xxx",
      "host": "https://api.us-east-2.aws.commercetools.com/",
      "authUrl": "https://auth.us-east-2.aws.commercetools.com/",
      "authentication" : {
        "scheme": "basic",
        "username": "xxx",
        "password": "xxx"
      }
    },
    "commercetoolsProjectKey2": { // commercetools project key of the second project
      "clientId": "xxx",
      "clientSecret": "xxx",
      "authentication" : {
        "scheme": "basic",
        "username": "xxx",
        "password": "xxx"
      }
    }
  }
}
Name Content Required Default value
clientId OAuth 2.0 client_id and can be used to obtain a token. YES
clientSecret OAuth 2.0 client_secret and can be used to obtain a token. YES
host The commercetools HTTP API is hosted at that URL. NO https://api.europe-west1.gcp.commercetools.com
authUrl The commercetools’ OAuth 2.0 service is hosted at that URL. NO https://auth.europe-west1.gcp.commercetools.com
authentication This setting only takes effect when basicAuth ( a child attribute in ADYEN_INTEGRATION_CONFIG ) is set to true. It enables authentication mechanism to prevent unauthorized access to the extension module. When it is provided as a JSON object, it must contain 3 separate attributes. They are scheme attribute which supports basic type, username and password attribute defined by user. NO

Other Configurations

Other configurations can be set as direct child attributes in ADYEN_INTEGRATION_CONFIG.

{
  "commercetools": {...},
  "adyen": {...},
  "logLevel": "DEBUG",
  "port": 8080,
  "keepAliveTimeout": 10000,
  "basicAuth" : true
}
Name Content Required Default value
port The port number on which the application will run. NO 8080
logLevel The log level (trace, debug, info, warn, error, fatal). NO info
keepAliveTimeout Milliseconds to keep a socket alive after the last response (Node.js docs). NO Node.js default (5 seconds)
basicAuth Boolean attribute to enable/disable basic authentication to prevent unauthorized 3rd-party from accessing extension endpoint NO false

Commercetools project requirements

Resources below are required for the extension module to operate correctly.

  1. The commercetools HTTP API Extension pointing to Adyen extension module

    It's required that the HTTP API Extension timeout limit is increased to 10000 milliseconds (default is 2000). Please contact Support via the commercetools support portal and provide the region, project key, and use case to increase the timeout to 10000 ms. Additionally, after the limit increased, timeout might be updated over API with setTimeoutInMs action.

  2. Payment custom type
  3. Payment-interface-interaction custom type

First, you will need to configure ExtensionDraft destination according to your deployment, A destination contains all info necessary for the commercetools platform to call the extension module. Please follow the commercetools HTTP API Extension documentation for details.

After you change the destination, you can set up required resources in your commercetools projects by running the script npm run setup-resources, the script requires the ADYEN_INTEGRATION_CONFIG to be set as an environment variable.

export ADYEN_INTEGRATION_CONFIG=xxxx
npm run setup-resources

Running

Docker

Refer to our docker hub page to see the latest releases and tags.

Running the Docker image

    docker run \
    -e ADYEN_INTEGRATION_CONFIG=xxxxxx \
    commercetools/commercetools-adyen-integration-extension:vX.X.X

Deployment

Extension module supports different deployment options. It could be either hosted on-premises (run docker containers behind the load balancer) or deployed as a serverless application.