Search

Are you looking for test card numbers?

Would you like to contact support?

Developer-resource icon

Libraries

We provide server-side API libraries in several languages. Because the libraries are connected to managed package systems (Composer, Gradle, Maven, NPM, NuGet, PyPi, RubyGems) they are easy to include in your project. Installing a library is not required, but will save you development time, because a library:

  • Uses the latest API version.
  • Has generated models to help you construct requests.

    For a point-of-sale integration with Terminal API, the library includes all Terminal API models to create requests.

    • With a cloud Terminal API integration, you can use the C#, Java, Node, or PHP libraries.
    • With a local Terminal API integration, you can use the C#, Java, or Node libraries. These also take care of securing local communications.

  • Sends the request to Adyen using its built-in HTTP client, so you don't have to create your own.

The source code for all our libraries and example integrations is available on our GitHub.

On this page we provide instructions for the following libraries:

PHP

Requirements

  • PHP 5.3 or higher.
  • Curl with SSL support.
  • The JSON PHP extension.

Installation

You can use Composer. Follow the installation instructions if you do not already have composer installed.

composer require adyen/php-api-library

In your PHP script, make sure you include the autoloader:

require __DIR__ . '/vendor/autoload.php';

Alternatively, you can download the release on GitHub.

Using the library

Set up a client and set the credentials to the Adyen platform.

If you don't know your X-API-KEY, you can obtain it from the Customer Area, as described in How to get the API key.

For Test:

Set up the client as a singleton resource; you'll use it for the API calls that you make to Adyen:

$client = new \Adyen\Client();
$client->setXApiKey("YOUR X-API-KEY");
$client->setEnvironment(\Adyen\Environment::TEST);

For Live:

When you want to process on the live environment, include your live URL prefix:

$client->setEnvironment(\Adyen\Environment::LIVE, "Your live URL prefix"); //Live environment

To make your first payment, follow the instructions on our API integration guide

Java

Requirements

  • Java 8 or higher.

Installation

You can use Maven, adding this dependency to your project's POM.

<dependency>
  <groupId>com.adyen</groupId>
  <artifactId>adyen-java-api-library</artifactId>
  <version>LATEST_VERSION</version>
</dependency>

You can find the latest version version on GitHub, Alternatively, you can download the release on GitHub.

Using the library

Set up a client and set the credentials to the Adyen platform.

If you don't know your X-API-KEY, you can obtain it from the Customer Area, as described in How to get the API key.

For Test:

Set up the client as a singleton resource; you'll use it for the API calls that you make to Adyen:

Client client = new Client("Your X-API-KEY", Environment.TEST); //Test environment

For Live:

When you want to process on the live environment, include your live URL prefix:

Client client = new Client("Your X-API-KEY", Environment.LIVE, "Your live URL prefix"); //Live environment

To make your first payment, follow the instructions on our API integration guide

Clone our example integration

For a closer look at how our Java library works, clone our Java/SparkJava example integration. This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

Node

Requirements

  • Node 10 or higher.

Installation

You can use NPM:

npm install @adyen/api-library

Alternatively, you can download the release on GitHub.

Using the library

Set up a client and set the credentials to the Adyen platform.
If you don't know your X-API-KEY, you can obtain it from the Customer Area, as described in How to get the API key.

For Test:

Set up the client as a singleton resource; you'll use it for the API calls that you make to Adyen:

const client = new Client({apiKey: [YOUR_API_KEY], environment: 'TEST'});`

For Live:

When you want to process on the live environment, include your live URL prefix:

const client = new Client({apiKey: [YOUR_API_KEY], environment: 'LIVE', liveEndpointUrlPrefix: 'YOUR_LIVE_ENDPOINT_PREFIX'});

To make your first payment, follow the instructions on our API integration guide

Clone our example integration

For a closer look at how our Node library works, clone our example Node/Express or React/Express integrations. These include commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

Ruby

Requirements

  • Ruby 2.1 or higher.

Installation

You can use ruby gems:

gem install adyen-ruby-api-library

Alternatively, you can download the release on GitHub.

Run bundle install to install dependencies.

Using the library

Set up a client and set the credentials to the Adyen platform.

If you don't know your X-API-KEY, you can obtain it from the Customer Area, as described in How to get the API key.

For Test:

Set up the client as a singleton resource; you'll use it for the API calls that you make to Adyen:

require 'adyen-ruby-api-library'

adyen = Adyen::Client.new
adyen.api_key = "YOUR X-API-KEY"
adyen.env = :test # Test environment

For Live:

When you want to process on the live environment, include your live URL prefix:

adyen.env = :live # Live environment
adyen.live_url_prefix = "Your live URL prefix"

To make your first payment, follow the instructions on our API integration guide

Clone our example integration

For a closer look at how our Ruby library works, clone our Ruby on Rails example integration. This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

C#

Requirements

  • .NET standard 2.0.

Installation

You can use NuGet:

PM> Install-Package Adyen

Alternatively, you can download the release on GitHub.

Using the library

Set up a client and set the credentials to the Adyen platform.

If you don't know your X-API-KEY, you can obtain it from the Customer Area, as described in How to get the API key.

For Test:

Set up the client as a singleton resource; you'll use it for the API calls that you make to Adyen:

var client = new Client ("YOUR-X-API-KEY", Adyen.Model.Enum.Environment.Test); // Test Environment

For Live:

When you want to process on the live environment, include your live URL prefix:

var client = new Client ("YOUR X-API-KEY", Adyen.Model.Enum.Environment.Live, "Your live URL prefix"); //Live environment

To make your first payment, follow the instructions on our API integration guide

Python

Requirements

  • Python 2.7 or 3.6
  • Packages: Requests or PycURL (optional)

Installation

You can use pip:

pip install Adyen

Alternatively, you can download the release on GitHub.

Using the library

Set up a client and set the credentials to the Adyen platform.

If you don't know your X-API-KEY, you can obtain it from the Customer Area, as described in How to get the API key.

For Test:

Set up the client as a singleton resource; you'll use it for the API calls that you make to Adyen:

ady = Adyen.Adyen()
client = ady.client
client.xapikey = "YOUR X-API-KEY"
client.platform = "test"

For Live:

When you want to process on the live environment, include your live URL prefix:

client.xapikey = "YOUR X-API-KEY"
client.platform = "live"
client.live_endpoint_prefix= "Your live URL prefix"

To make your first payment, follow the instructions on our API integration guide

Clone our example integration

For a closer look at how our Python library works, clone our Python/Flask example integration. This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

Go

Requirements

  • Go 1.13 or higher.

Installation

You can use Go modules:

go get github.com/adyen/adyen-go-api-library/v2

Alternatively, you can download the release on GitHub.

Using the library

Set up a client and set the credentials to the Adyen platform.
If you don't know your X-API-KEY, you can obtain it from the Customer Area, as described in How to get the API key.

For Test:

Set up the client as a singleton resource; you'll use it for the API calls that you make to Adyen:

import (
    "github.com/adyen/adyen-go-api-library/v2/src/adyen"
    "github.com/adyen/adyen-go-api-library/v2/src/common"
)

client := adyen.NewClient(&common.Config{
    ApiKey:      "YOUR-API-KEY",
    Environment: common.TestEnv,
})

For Live:

When you want to process on the live environment, include your live URL prefix:

import (
    "github.com/adyen/adyen-go-api-library/v2/src/adyen"
    "github.com/adyen/adyen-go-api-library/v2/src/common"
)

client := adyen.NewClient(&common.Config{
    ApiKey:      "your api key",
    Environment: common.LiveEnv,
    LiveEndpointURLPrefix: "YOUR_LIVE_ENDPOINT_PREFIX",
})

To make your first payment, follow the instructions on our API integration guide

Next steps