Adyen APIs Postman collections
- Designed your implementation.
- Received your Issuing test account and API credential from your Adyen contact.
Verify your test credentials
To verify that your test API credentials are working, make your first requests. You need the API keys of the following credentials to make these requests:- ws_[123456]@BalancePlatform.[YourBalancePlatform]: use this API key to make requests to the Configuration API and the Transfers API.
- ws_[123456]@Scope.Company_[YourCompanyAccount]: use this API key to make requests to the Legal Entity Management API.
- Balance Platform
- Legal Entity
Use the API key for your ws_[123456]@BalancePlatform.[YourBalancePlatform] API credential.Try it out!If the call is successful, you receive an HTTP 200 result code along with the
curl https://balanceplatform-api-test.adyen.com/bcl/v2/balancePlatforms/{id} \
-H 'x-api-key: ADYEN_BALANCE_PLATFORM_API_KEY' \
-H 'content-type: application/json' \
-X GET
// Adyen Java API Library v25.0.0
import com.adyen.Client;
import com.adyen.enums.Environment;
import com.adyen.service.balancePlatform.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Make the API call
PlatformApi service = new PlatformApi(client);
BalancePlatform response = service.getBalancePlatform("id", null);
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Service\BalancePlatform\PlatformApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Make the API call
$service = new PlatformApi($client);
$response = $service->getBalancePlatform('id');
// Adyen .net API Library v14.4.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Service.BalancePlatform;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Make the API call
var service = new PlatformService(client);
var response = service.GetBalancePlatform("id");
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
const { Client, BalancePlatformAPI } = require('@adyen/api-library');
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Make the API call
const balancePlatformAPI = new BalancePlatformAPI(client);
const response = balancePlatformAPI.PlatformApi.getBalancePlatform("id");
// Adyen Go API Library v9.3.0
import (
"context"
"github.com/adyen/adyen-go-api-library/v9/src/common"
"github.com/adyen/adyen-go-api-library/v9/src/adyen"
"github.com/adyen/adyen-go-api-library/v9/src/balancePlatform"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Make the API call
service := client.BalancePlatform()
req := service.PlatformApi.GetBalancePlatformInput("id")
res, httpRes, err := service.PlatformApi.GetBalancePlatform(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
# Make the API call
result = adyen.balancePlatform.platform_api.get_balance_platform(id="id")
# Adyen Ruby API Library v9.3.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
# Make the API call
result = adyen.balancePlatform.platform_api.get_balance_platform('id')
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, BalancePlatformAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Make the API call
const balancePlatformAPI = new BalancePlatformAPI(client);
const response = balancePlatformAPI.PlatformApi.getBalancePlatform("id");
id and status of your balance platform.Response{
"id": "YOUR_BALANCE_PLATFORM_ID",
"status": "Active"
}
Use the API key for your ws_[123456]@Scope.Company_[YourCompanyAccount] API credential.Try it out!If the call is successful, you receive an HTTP 200 result code along with the The response depends on whether you approved or declined the payment.
curl https://kyc-test.adyen.com/lem/v1/legalEntities \
-H 'x-api-key: ADYEN_LEGAL_ENTITY_MANAGEMENT_API_KEY' \
-H 'content-type: application/json' \
-d '{
"type": "individual",
"individual":
{
"residentialAddress": {
"city": "San Francisco",
"country": "US",
"postalCode": "94678",
"stateOrProvince": "CA",
"street": "Brannan Street",
"street2": "274"
},
"name": {
"firstName": "Simone",
"lastName": "Hopper"
},
"email": "s.hopper@example.com"
}
}'
// Adyen Java API Library v25.0.0
import com.adyen.Client;
import com.adyen.enums.Environment;
import com.adyen.model.legalEntityManagement.*;
import java.time.OffsetDateTime;
import java.util.*;
import com.adyen.service.legalEntityManagement.*;
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Create the request object(s)
Address address = new Address()
.country("US")
.stateOrProvince("CA")
.city("San Francisco")
.street("Brannan Street")
.postalCode("94678")
.street2("274");
Name name = new Name()
.firstName("Simone")
.lastName("Hopper");
Individual individual = new Individual()
.residentialAddress(address)
.name(name)
.email("s.hopper@example.com");
LegalEntityInfoRequiredType legalEntityInfoRequiredType = new LegalEntityInfoRequiredType()
.individual(individual)
.type(LegalEntityInfoRequiredType.TypeEnum.INDIVIDUAL);
// Make the API call
LegalEntitiesApi service = new LegalEntitiesApi(client);
LegalEntity response = service.createLegalEntity(legalEntityInfoRequiredType, null);
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\LegalEntityManagement\Address;
use Adyen\Model\LegalEntityManagement\Name;
use Adyen\Model\LegalEntityManagement\Individual;
use Adyen\Model\LegalEntityManagement\LegalEntityInfoRequiredType;
use Adyen\Service\LegalEntityManagement\LegalEntitiesApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
$client->setEnvironment(Environment::TEST);
// Create the request object(s)
$address = new Address();
$address
->setCountry("US")
->setStateOrProvince("CA")
->setCity("San Francisco")
->setStreet("Brannan Street")
->setPostalCode("94678")
->setStreet2("274");
$name = new Name();
$name
->setFirstName("Simone")
->setLastName("Hopper");
$individual = new Individual();
$individual
->setResidentialAddress($address)
->setName($name)
->setEmail("s.hopper@example.com");
$legalEntityInfoRequiredType = new LegalEntityInfoRequiredType();
$legalEntityInfoRequiredType
->setIndividual($individual)
->setType("individual");
// Make the API call
$service = new LegalEntitiesApi($client);
$response = $service->createLegalEntity($legalEntityInfoRequiredType);
// Adyen .net API Library v14.4.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.LegalEntityManagement;
using Adyen.Service.LegalEntityManagement;
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Create the request object(s)
Address address = new Address
{
Country = "US",
StateOrProvince = "CA",
City = "San Francisco",
Street = "Brannan Street",
PostalCode = "94678",
Street2 = "274"
};
Name name = new Name
{
FirstName = "Simone",
LastName = "Hopper"
};
Individual individual = new Individual
{
ResidentialAddress = address,
Name = name,
Email = "s.hopper@example.com"
};
LegalEntityInfoRequiredType legalEntityInfoRequiredType = new LegalEntityInfoRequiredType
{
Individual = individual,
Type = LegalEntityInfoRequiredType.TypeEnum.Individual
};
// Make the API call
var service = new LegalEntitiesService(client);
var response = service.CreateLegalEntity(legalEntityInfoRequiredType);
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
const { Client, LegalEntityManagementAPI } = require('@adyen/api-library');
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object(s)
const legalEntityInfoRequiredType = {
type: "individual",
individual: {
residentialAddress: {
city: "San Francisco",
country: "US",
postalCode: "94678",
stateOrProvince: "CA",
street: "Brannan Street",
street2: "274"
},
name: {
firstName: "Simone",
lastName: "Hopper"
},
email: "s.hopper@example.com"
}
}
// Make the API call
const legalEntityManagementAPI = new LegalEntityManagementAPI(client);
const response = legalEntityManagementAPI.LegalEntitiesApi.createLegalEntity(legalEntityInfoRequiredType);
// Adyen Go API Library v9.3.0
import (
"context"
"github.com/adyen/adyen-go-api-library/v9/src/common"
"github.com/adyen/adyen-go-api-library/v9/src/adyen"
"github.com/adyen/adyen-go-api-library/v9/src/legalEntityManagement"
)
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Create the request object(s)
address := legalEntityManagement.Address{
Country: "US",
StateOrProvince: common.PtrString("CA"),
City: common.PtrString("San Francisco"),
Street: common.PtrString("Brannan Street"),
PostalCode: common.PtrString("94678"),
Street2: common.PtrString("274"),
}
name := legalEntityManagement.Name{
FirstName: "Simone",
LastName: "Hopper",
}
individual := legalEntityManagement.Individual{
ResidentialAddress: address,
Name: name,
Email: common.PtrString("s.hopper@example.com"),
}
legalEntityInfoRequiredType := legalEntityManagement.LegalEntityInfoRequiredType{
Individual: &individual,
Type: "individual",
}
// Make the API call
service := client.LegalEntityManagement()
req := service.LegalEntitiesApi.CreateLegalEntityInput().LegalEntityInfoRequiredType(legalEntityInfoRequiredType)
res, httpRes, err := service.LegalEntitiesApi.CreateLegalEntity(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
adyen.client.platform = "test" # The environment to use library in.
# Create the request object(s)
json_request = {
"type": "individual",
"individual": {
"residentialAddress": {
"city": "San Francisco",
"country": "US",
"postalCode": "94678",
"stateOrProvince": "CA",
"street": "Brannan Street",
"street2": "274"
},
"name": {
"firstName": "Simone",
"lastName": "Hopper"
},
"email": "s.hopper@example.com"
}
}
# Make the API call
result = adyen.legalEntityManagement.legal_entities_api.create_legal_entity(request=json_request)
# Adyen Ruby API Library v9.3.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
adyen.env = :test # Set to "live" for live environment
# Create the request object(s)
request_body = {
:type => 'individual',
:individual => {
:residentialAddress => {
:city => 'San Francisco',
:country => 'US',
:postalCode => '94678',
:stateOrProvince => 'CA',
:street => 'Brannan Street',
:street2 => '274'
},
:name => {
:firstName => 'Simone',
:lastName => 'Hopper'
},
:email => 's.hopper@example.com'
}
}
# Make the API call
result = adyen.legalEntityManagement.legal_entities_api.create_legal_entity(request_body)
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, LegalEntityManagementAPI, Types } from "@adyen/api-library";
// Initialize the client object
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object(s)
const address: Types.legalEntityManagement.Address = {
country: "US",
stateOrProvince: "CA",
city: "San Francisco",
street: "Brannan Street",
postalCode: "94678",
street2: "274"
};
const name: Types.legalEntityManagement.Name = {
firstName: "Simone",
lastName: "Hopper"
};
const individual: Types.legalEntityManagement.Individual = {
residentialAddress: address,
name: name,
email: "s.hopper@example.com"
};
const legalEntityInfoRequiredType: Types.legalEntityManagement.LegalEntityInfoRequiredType = {
individual: individual,
type: Types.legalEntityManagement.LegalEntityInfoRequiredType.TypeEnum.Individual
};
// Make the API call
const legalEntityManagementAPI = new LegalEntityManagementAPI(client);
const response = legalEntityManagementAPI.LegalEntitiesApi.createLegalEntity(legalEntityInfoRequiredType);
id and type of the legal entity you created.Response{
"individual": {
"email": "s.hopper@example.com",
"name": {
"firstName": "Simone",
"lastName": "Hopper"
},
"residentialAddress": {
"city": "San Francisco",
"country": "US",
"postalCode": "94678",
"stateOrProvince": "CA",
"street": "Brannan Street",
"street2": "274"
}
},
"type": "individual",
"id": "LE322JC223222D5CR2PHBG46C"
}
Onboard legal entities
Before you can start issuing cards, your account holders need to go through verification checks. Adyen performs the checks against the legal entity of the account holder.- Identify the required information.
Check the required information based on the location where the account holder is operating in. - Create legal entities.
Create a legal entity resource for the account holder’s organization and for the individuals associated to the organization. - Add transfer instruments.
For use cases that involve moving funds between balance accounts and bank accounts, add a transfer instrument to represent the account holder’s bank account. - Upload additional documents.
Adyen may also require you to upload additional documents if needed.
Create account holders and balance accounts
Create an account holder and one or more balance accounts.- Create account holders.
Create an account holder and link it to their legal entity. - Create balance accounts.
Create balance accounts and link the accounts to the account holder(s).
Manage your platform
Learn how to update manage account holders and balance accounts to view details or update statuses.- Manage account holders.
View and update account holders in your platform. - Manage balance accounts.
View and update balance accounts in your platform.
Create cards
Create virtual or physical cards depending on your use case.When you successfully create virtual cards in the test environment, you receive the card number, expiry date, and CVC. You use these card details to make a test payment.Manage card status
Depending on your use case, you can change a card’s status.-
Suspend a single-use card after it has been used.
If a single-use card has been used, suspend the card to temporarily prevent payments. -
Close a card.
If a card should no longer be used, close the card. Closing a card is a permanent action and cannot be reversed.
Add and manage funds
To make test payments with an Adyen-issued card, you need to make sure the balance accounts have funds.- Add funds to your liable balance account.
Reach out to your Adyen contact to help you add funds to your liable balance account in the test environment.
- Manage funds.
Transfer funds to other balance accounts. The flow of funds between the liable balance account and other balance accounts depends your business logic and on how you designed your account structure.
Approve or decline payments
With relayed authorisation, you approve or decline a payment by responding to a webhook. With transaction rules, payments are approved or declined based on conditions. You can use relayed authorisation, transaction rules, or both.When combined, transaction rules are applied first, serving as a filtering mechanism for payment attempts before sending you the relayed authorisation webhook.Use relayed authorisation
If you decide to use relayed authorisation to approve or decline payments within 2000 milliseconds of the payment attempt, you have to:- Expose an endpoint to handle relayed authorisation webhooks.
Configure an endpoint to receive relayed authorisation webhooks. To differentiate relayed authorisation webhooks from webhooks for other platform events, make sure this a separate endpoint from your webhooks. - Configure the relayed authorisation webhook in Adyen.
- Respond to relayed authorisation webhooks.
Respond to the webhook within 2000 milliseconds of the payment attempt, specifying if you want to allow or decline the payment.
You can define default fallback logic for Adyen to apply to the payment attempt in cases when Adyen does not receive a response, or receives an invalid response, from you.
Use transaction rules
Before you start creating transaction rules, make sure that you have already clearly defined your business logic and requirements when approving or declining payments. You turn these requirements into rule conditions.- Create payment instrument groups.
Grouping together payment instruments is useful if you want to apply a transaction rule to multiple cards. Create a payment instrument group, assign cards to the group, and assign a transaction rule to the group. - Create transaction rules.
Define rule conditions. A payment is automatically approved or declined depending on the conditions in the transaction rule. A transaction rule must be linked to one payment instrument, payment instrument group, or the whole balance platform.
Make test payments
Ask your Adyen contact for your online payments API credential. This API credential is different from the one that you use with the Balance Platform or Legal Entity Management APIs.You use your online payments API credentials to simulate payments in the test environment using the /payments endpoint.For example, to make a EUR 10 payment, replace thenumber, expiryMonth, expiryYear, and cvc with the card details you received when you created the card.Make a test paymentcurl https://checkout-test.adyen.com/v68/payments \
-H 'x-api-key: ADYEN_API_KEY' \
-H 'content-type: application/json' \
-X POST \
-d '{
"merchantAccount": "YourCompanyECOM",
"reference": "My first Adyen test payment",
"amount": {
"value": 1000,
"currency": "EUR"
},
"paymentMethod": {
"type": "scheme",
"number": "4111111111111111",
"expiryMonth": "03",
"expiryYear": "2030",
"cvc": "737"
}
}'
// Adyen Java API Library v25.0.0
import com.adyen.Client;
import com.adyen.enums.Environment;
import com.adyen.model.checkout.*;
import java.time.OffsetDateTime;
import java.util.*;
import com.adyen.model.RequestOptions;
import com.adyen.service.checkout.*;
// For the live environment, additionally include your liveEndpointUrlPrefix.
Client client = new Client("ADYEN_API_KEY", Environment.TEST);
// Create the request object(s)
Amount amount = new Amount()
.currency("EUR")
.value(1000L);
CardDetails cardDetails = new CardDetails()
.number("4111111111111111")
.cvc("737")
.expiryMonth("03")
.expiryYear("2030")
.type(CardDetails.TypeEnum.SCHEME);
PaymentRequest paymentRequest = new PaymentRequest()
.reference("My first Adyen test payment")
.amount(amount)
.merchantAccount("YourCompanyECOM")
.paymentMethod(new CheckoutPaymentMethod(cardDetails));
// Make the API call
PaymentsApi service = new PaymentsApi(client);
PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
// Adyen PHP API Library v17.4.0
use Adyen\Client;
use Adyen\Environment;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\CheckoutPaymentMethod;
use Adyen\Model\Checkout\PaymentRequest;
use Adyen\Service\Checkout\PaymentsApi;
$client = new Client();
$client->setXApiKey("ADYEN_API_KEY");
// For the live environment, additionally include your liveEndpointUrlPrefix.
$client->setEnvironment(Environment::TEST);
// Create the request object(s)
$amount = new Amount();
$amount
->setCurrency("EUR")
->setValue(1000);
$checkoutPaymentMethod = new CheckoutPaymentMethod();
$checkoutPaymentMethod
->setNumber("4111111111111111")
->setCvc("737")
->setExpiryMonth("03")
->setExpiryYear("2030")
->setType("scheme");
$paymentRequest = new PaymentRequest();
$paymentRequest
->setReference("My first Adyen test payment")
->setAmount($amount)
->setMerchantAccount("YourCompanyECOM")
->setPaymentMethod($checkoutPaymentMethod);
$requestOptions['idempotencyKey'] = 'UUID';
// Make the API call
$service = new PaymentsApi($client);
$response = $service->payments($paymentRequest, $requestOptions);
// Adyen .net API Library v14.4.0
using Adyen;
using Environment = Adyen.Model.Environment;
using Adyen.Model;
using Adyen.Model.Checkout;
using Adyen.Service.Checkout;
// For the live environment, additionally include your liveEndpointUrlPrefix.
var config = new Config()
{
XApiKey = "ADYEN_API_KEY",
Environment = Environment.Test
};
var client = new Client(config);
// Create the request object(s)
Amount amount = new Amount
{
Currency = "EUR",
Value = 1000
};
CardDetails cardDetails = new CardDetails
{
Number = "4111111111111111",
Cvc = "737",
ExpiryMonth = "03",
ExpiryYear = "2030",
Type = CardDetails.TypeEnum.Scheme
};
PaymentRequest paymentRequest = new PaymentRequest
{
Reference = "My first Adyen test payment",
Amount = amount,
MerchantAccount = "YourCompanyECOM",
PaymentMethod = new CheckoutPaymentMethod(cardDetails)
};
// Make the API call
var service = new PaymentsService(client);
var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
const { Client, CheckoutAPI } = require('@adyen/api-library');
// Initialize the client object
// For the live environment, additionally include your liveEndpointUrlPrefix.
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object(s)
const paymentRequest = {
merchantAccount: "YourCompanyECOM",
reference: "My first Adyen test payment",
amount: {
value: 1000,
currency: "EUR"
},
paymentMethod: {
type: "scheme",
number: "4111111111111111",
expiryMonth: "03",
expiryYear: "2030",
cvc: "737"
}
}
// Make the API call
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
// Adyen Go API Library v9.3.0
import (
"context"
"github.com/adyen/adyen-go-api-library/v9/src/common"
"github.com/adyen/adyen-go-api-library/v9/src/adyen"
"github.com/adyen/adyen-go-api-library/v9/src/checkout"
)
// For the live environment, additionally include your liveEndpointUrlPrefix.
client := adyen.NewClient(&common.Config{
ApiKey: "ADYEN_API_KEY",
Environment: common.TestEnv,
})
// Create the request object(s)
amount := checkout.Amount{
Currency: "EUR",
Value: 1000,
}
cardDetails := checkout.CardDetails{
Number: common.PtrString("4111111111111111"),
Cvc: common.PtrString("737"),
ExpiryMonth: common.PtrString("03"),
ExpiryYear: common.PtrString("2030"),
Type: common.PtrString("scheme"),
}
paymentRequest := checkout.PaymentRequest{
Reference: "My first Adyen test payment",
Amount: amount,
MerchantAccount: "YourCompanyECOM",
PaymentMethod: checkout.CardDetailsAsCheckoutPaymentMethod(&cardDetails),
}
// Make the API call
service := client.Checkout()
req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
# Adyen Python API Library v12.2.0
import Adyen
adyen = Adyen.Adyen()
adyen.client.xapikey = "ADYEN_API_KEY"
# For the live environment, additionally include your liveEndpointUrlPrefix.
adyen.client.platform = "test" # The environment to use library in.
# Create the request object(s)
json_request = {
"merchantAccount": "YourCompanyECOM",
"reference": "My first Adyen test payment",
"amount": {
"value": 1000,
"currency": "EUR"
},
"paymentMethod": {
"type": "scheme",
"number": "4111111111111111",
"expiryMonth": "03",
"expiryYear": "2030",
"cvc": "737"
}
}
# Make the API call
result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
# Adyen Ruby API Library v9.3.0
require "adyen-ruby-api-library"
adyen = Adyen::Client.new
adyen.api_key = 'ADYEN_API_KEY'
# For the live environment, additionally include your liveEndpointUrlPrefix.
adyen.env = :test # Set to "live" for live environment
# Create the request object(s)
request_body = {
:merchantAccount => 'YourCompanyECOM',
:reference => 'My first Adyen test payment',
:amount => {
:value => 1000,
:currency => 'EUR'
},
:paymentMethod => {
:type => 'scheme',
:number => '4111111111111111',
:expiryMonth => '03',
:expiryYear => '2030',
:cvc => '737'
}
}
# Make the API call
result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
// Adyen Node API Library v16.2.0
// Require the parts of the module you want to use
import { Client, CheckoutAPI, Types } from "@adyen/api-library";
// Initialize the client object
// For the live environment, additionally include your liveEndpointUrlPrefix.
const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});
// Create the request object(s)
const amount: Types.checkout.Amount = {
currency: "EUR",
value: 1000
};
const cardDetails: Types.checkout.CardDetails = {
number: "4111111111111111",
cvc: "737",
expiryMonth: "03",
expiryYear: "2030",
type: Types.checkout.CardDetails.TypeEnum.Scheme
};
const paymentRequest: Types.checkout.PaymentRequest = {
reference: "My first Adyen test payment",
amount: amount,
merchantAccount: "YourCompanyECOM",
paymentMethod: cardDetails
};
// Make the API call
const checkoutAPI = new CheckoutAPI(client);
const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
Process webhooks
Adyen sends webhooks to communicate asynchronous events in your platform such as payments, captures, refunds, and fund transfers.-
Configure a webhook endpoint on your server.
Set up a webhook endpoint in your system to receive webhooks from Adyen. If you are also accepting relayed authorisation webhooks, make sure to use separate endpoints. - Configure the endpoint in Adyen.
-
Receive and accept webhooks.
Accept and process different webhook types.
Download reports
You can use reports to reconcile payments and balances in your system.- Set up your reports credentials.
Your Adyen contact will provide you with a reports credential, which you need if you want to programmatically download reports. - Download reports.
Listen to the balancePlatform.report.created webhook to know when a report was generated and is ready to be downloaded. To download a report, you must authenticate your GET requests with your report credentials.
Going live
To start issuing cards in the live environment, you need to apply for a live account. When you have your live account, follow the steps below to take your integration live.- Replicate your test account setup. The setup from your test Adyen Issuing account is not replicated to your live Adyen Issuing account. If you created the following resources in your test environment, make sure that you replicate your setup in your live account:
-
Update your code base.
Update your code base and Issuing account settings.-
Switch to live Balance Platform and Legal Entity Management API credentials.
Get your live API credentials from your Adyen contact. Copy these keys to your live platform. -
Switch from test to live endpoints.
Change the test endpointhttps://balanceplatform-api-test.adyen.com/to live
https://balanceplatform-api-live.adyen.com/.
-
Switch to live Balance Platform and Legal Entity Management API credentials.
-
Run end-to-end tests.
- Live Balance Platform and Legal Entity Management API credentials: Make your first live API request to make sure that your live API credentials are working.
- Account holders and balance accounts: Confirm you can create and retrieve account holders and balance accounts.
- Cards: Confirm that you can create cards.
- Transaction rules: Confirm that you can create and manage transaction rules.
- Relayed authorisation: Confirm that you can receive relayed authorisation webhooks, and that you can successfully respond to approve or decline payments.
-
Payments:
- Test the happy flow by making payments with cards you created in the live environment.
- Test non-happy payment flows where payments are declined through relayed authorisation or transaction rules.
- Webhooks: Confirm that you can receive and accept webhooks in the live environment.
- Verification errors: Test your error handling scenarios when onboarding users.
- Reports: Confirm that you can download reports for transactions in the live environment.