- Notifications
You must be signed in to change notification settings - Fork144
Adyen/adyen-java-api-library
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is the officially supported Java library for using Adyen's APIs.
The Library supports all APIs under the following services:
| API | Description | Service Name | Supported version |
|---|---|---|---|
| BIN lookup API | The BIN Lookup API provides endpoints for retrieving information based on a given BIN. | BinLookup | v54 |
| Checkout API | Our latest integration for accepting online payments. | Checkout | v71 |
| Configuration API | The Configuration API enables you to create a platform where you can onboard your users as account holders and create balance accounts, cards, and business accounts. | balanceplatform package subclasses | v2 |
| DataProtection API | Adyen Data Protection API provides a way for you to processSubject Erasure Requests as mandated in GDPR. Use our API to submit a request to delete shopper's data, including payment details and other related information (for example, delivery address or shopper email) | DataProtection | v1 |
| Legal Entity Management API | Manage legal entities that contain information required for verification. | legalentitymanagement package subclasses | v3 |
| Local/Cloud-based Terminal API | Our point-of-sale integration. | TerminalLocalAPI or TerminalCloudAPI | v1 |
| Management API | Configure and manage your Adyen company and merchant accounts, stores, and payment terminals. | management package subclasses | v3 |
| Open Banking API | The Open Banking API provides secure endpoints to share financial data and services with third parties. | openbanking package subclasses | v1 |
| Payments API | Our classic integration for online payments. | Payment | v68 |
| Payouts API | Endpoints for sending funds to your customers. | Payout | v68 |
| POS Terminal Management API | |||
| Recurring API | Endpoints for managing saved payment details. | Recurring | v68 |
| Session Authentication API | Create and manage the JSON Web Tokens (JWT) required for integratingOnboarding andPlatform Experience components. | SessionAuthentication | v1 |
| Stored Value API | Manage both online and point-of-sale gift cards and other stored-value cards. | StoredValue | v46 |
| Transfers API | The Transfers API provides endpoints that can be used to get information about all your transactions, move funds within your balance platform or send funds from your balance platform to a transfer instrument. | Transfers | v4 |
| Webhooks | Adyen uses webhooks to send notifications about payment status updates, newly available reports, and other events that can be subscribed to. For more information, refer to ourdocumentation. | Models only | v1 |
| Classic Platforms Account API | This API is used for the classic integration. If you are just starting your implementation, refer to our new integration guide instead. | ClassicPlatformAccountApi | v6 |
| Classic Platforms Fund API | This API is used for the classic integration. If you are just starting your implementation, refer to our new integration guide instead. | ClassicPlatformFundApi | v6 |
| Classic Platforms Hosted Onboarding Page API | This API is used for the classic integration. If you are just starting your implementation, refer to our new integration guide instead. | ClassicPlatformHopApi | v6 |
| Classic Platforms Notification Configuration API | This API is used for the classic integration. If you are just starting your implementation, refer to our new integration guide instead. | ClassicPlatformConfigurationApi | v6 |
| Disputes API | You can use theDisputes API to automate the dispute handling process so that you can respond to disputes and chargebacks as soon as they are initiated. The Disputes API lets you retrieve defense reasons, supply and delete defense documents, and accept or defend disputes. | DisputesApi | v30 |
| POS Mobile API | The POS Mobile API is used in the mutual authentication flow between an Adyen Android or iOSPOS Mobile SDK and the Adyen payments platform. The POS Mobile SDK for Android or iOS devices enables businesses to accept in-person payments using a commercial off-the-shelf (COTS) device like a phone. For example, Tap to Pay transactions, or transactions on a mobile device in combination with a card reader | POS Mobile | v68 |
| Payments App API | The Payments App API is used to Board and manage the Adyen Payments App on your Android mobile devices. | PaymentsAppApi | v1 |
The library supports all webhooks under the following model directories:
| Webhooks | Description | Model Name | Supported Version |
|---|---|---|---|
| Authentication Webhooks | Adyen sends this webhook when the process of cardholder authentication is finalized, whether it is completed successfully, fails, or expires. | acswebhooks | v1 |
| Balance Webhooks | Adyen sends webhooks to inform you of balance changes in your balance platform. | balancewebhooks | v1 |
| Configuration Webhooks | You can use these webhooks to build your implementation. For example, you can use this information to update internal statuses when the status of a capability is changed. | configurationwebhooks | v2 |
| Transfer Webhooks | You can use these webhooks to build your implementation. For example, you can use this information to update balances in your own dashboards or to keep track of incoming funds. | transferwebhooks | v4 |
| Report Webhooks | You can download reports programmatically by making an HTTP GET request, or manually from your Balance Platform Customer Area | reportwebhooks | v1 |
| Negative Balance Warning Webhooks | Adyen sends this webhook to inform you about a balance account whose balance has been negative for a given number of days. | negativebalancewarningwebhooks | v1 |
| Notification Webhooks | We use webhooks to send you updates about payment status updates, newly available reports, and other events that you can subscribe to. For more information, refer to our documentation | notification | v1 |
| Management Webhooks | Adyen uses webhooks to inform your system about events that happen with your Adyen company and merchant accounts, stores, payment terminals, and payment methods when using Management API | managementwebhooks | v3 |
| Classic Platform Webhooks | The Notification API sends notifications to the endpoints specified in a given subscription. Subscriptions are managed through the Notification Configuration API. The API specifications listed here detail the format of each notification. | marketpaywebhooks | v6 |
| Transaction Webhooks | Adyen sends webhooks to inform your system about incoming and outgoing transfers in your platform. You can use these webhooks to build your implementation. For example, you can use this information to update balances in your own dashboards or to keep track of incoming funds. | transactionwebhooks | v4 |
| Tokenization Webhooks | Adyen sends webhooks to inform you about the creation and changes to the recurring tokens. | tokenizationwebhooks | v1 |
For more information, refer to ourdocumentation ortheAPI Explorer.
- Adyen test account
- API key. For testing, your APIcredential needs to havetheAPI PCI Payments role.
- Java 11 or higher
You can use Maven and add this dependency to your project's POM:
<dependency> <groupId>com.adyen</groupId> <artifactId>adyen-java-api-library</artifactId> <version>40.1.0</version></dependency>Alternatively, you can download therelease on GitHub.
For every API, one or more corresponding service classes can be found in the folder with the same name.Check theSupported API versions.
Note: For requests onlive environment, you must define theLive URL Prefix in the Client object:
// Import the required classesimportcom.adyen.Client;importcom.adyen.enums.Environment;importcom.adyen.service.checkout.PaymentsApi;importcom.adyen.model.checkout.*;// Setup Client using Config objectConfigconfig =newConfig() .environment(Environment.LIVE) .liveEndpointUrlPrefix("myCompany") .apiKey(apiKey);Clientclient =newClient(config);PaymentsApipaymentsApi =newPaymentsApi(client);// Create PaymentRequestCardDetailscardDetails =newCardDetails() .type(CardDetails.TypeEnum.SCHEME) .encryptedCardNumber("5136333333333335") .holderName("John Doe") .cvc("737") .encryptedExpiryMonth("08") .encryptedExpiryYear("2018");PaymentRequestpaymentRequest =newPaymentRequest() .merchantAccount("YOUR_MERCHANT_ACCOUNT") .reference("YOUR_REFERENCE") .amount(newAmount() .currency("EUR") .value(1000L)) .returnUrl("https://your-company.example.org/checkout?shopperOrder=12xy..") .paymentMethod(newCheckoutPaymentMethod(cardDetails));// Make a call to the /payments endpointPaymentResponsepaymentResponse =paymentsApi.payments(paymentRequest);
// Import the required classesimportcom.adyen.Client;importcom.adyen.enums.Environment;importcom.adyen.service.checkout.PaymentLinksApi// Setup Client and Service passing prefixClientclient =newClient("Your username","Your password",Environment.LIVE,"mycompany123");// Or setup Client and Service passing prefix and application name//Client client = new Client("Your username", "Your password", Environment.LIVE, "mycompany123", "Your application name");PaymentLinksApipaymentLinksApi =newPaymentLinksApi(client); ...
You can include additional headers and anidempotency key in your API requests using theRequestOptions object.
importcom.adyen.Client;importcom.adyen.Config;importcom.adyen.enums.Environment;importcom.adyen.model.RequestOptions;importcom.adyen.service.checkout.PaymentsApi;importcom.adyen.model.checkout.PaymentRequest;importcom.adyen.model.checkout.PaymentResponse;importcom.adyen.model.checkout.Amount;importcom.adyen.model.checkout.CardDetails;importcom.adyen.model.checkout.CheckoutPaymentMethod;importjava.util.HashMap;importjava.util.Map;// Setup Client using Config objectConfigconfig =newConfig() .environment(Environment.TEST)// Or Environment.LIVE .apiKey("YOUR_API_KEY");Clientclient =newClient(config);// Create RequestOptionsHashMap<String,String>additionalHeaders =newHashMap<>();additionalHeaders.put("X-Custom-Header","custom-value");RequestOptionsrequestOptions =newRequestOptions() .idempotencyKey("YOUR_IDEMPOTENCY_KEY")// use UUID .additionalServiceHeaders(additionalHeaders);PaymentsApipaymentsApi =newPaymentsApi(client);// Create PaymentRequest (example from existing README)CardDetailscardDetails =newCardDetails() .type(CardDetails.TypeEnum.SCHEME) .encryptedCardNumber("5136333333333335") .holderName("John Doe") .cvc("737") .encryptedExpiryMonth("08") .encryptedExpiryYear("2018");PaymentRequestpaymentRequest =newPaymentRequest() .merchantAccount("YOUR_MERCHANT_ACCOUNT") .reference("YOUR_REFERENCE") .amount(newAmount() .currency("EUR") .value(1000L)) .returnUrl("https://your-company.example.org/checkout?shopperOrder=12xy..") .paymentMethod(newCheckoutPaymentMethod(cardDetails));// Make a call to the /payments endpoint with RequestOptionsPaymentResponsepaymentResponse =paymentsApi.payments(paymentRequest,requestOptions);// Process paymentResponseSystem.out.println("Payment response: " +paymentResponse.toJson());
In some setups you might need to deserialize JSON strings to request objects. For example, when using the libraries in combination withDropin/Components. Please use the built-in deserialization functions:
// Import the required model classimportcom.adyen.model.checkout.PaymentRequest;// Deserialize using built-in functionPaymentRequestpaymentRequest =PaymentRequest.fromJson("YOUR_JSON_STRING");
Use a try-catch block to handle API errors. Catch theApiException to inspect the response and handle specific cases:
try { service.getPaymentLink("1234");} catch (ApiException e) { // Obtain response int statusCode = e.getStatusCode(); String responseBody = e.getResponseBody(); // Check ApiError object ApiError apiError = e.getError(); String errorCode = apiError.getErrorCode(); List<String> invalidFields = apiError.getInvalidFields(); ....}// Import the required classesimportjava.util.List;importcom.adyen.util.HMACValidator;importcom.adyen.notification.WebhookHandler;importcom.adyen.model.notification.NotificationRequest;importcom.adyen.model.notification.NotificationRequestItem;// YOUR_HMAC_KEY from the Customer AreaStringhmacKey ="YOUR_HMAC_KEY";// The webhook payloadStringnotificationRequestJson ="NOTIFICATION_REQUEST_JSON";HMACValidatorhmacValidator =newHMACValidator();WebhookHandlerwebhookHandler =newWebhookHandler();NotificationRequestnotificationRequest =webhookHandler.handleNotificationJson(notificationRequestJson);// fetch first (and only) NotificationRequestItemvarnotificationRequestItem =notificationRequest.getNotificationItems().stream().findFirst();if (notificationRequestItem.isPresent()) {// validate the HMAC signatureif (hmacValidator.validateHMAC(notificationRequestItem,hmacKey) ) {// Process the notification based on the eventCodelog.info("Received webhook with event {} :\n" +"Merchant Reference: {}\n" +"Alias : {}\n" +"PSP reference : {}",notificationRequestItem.getEventCode(),notificationRequestItem.getMerchantReference(),notificationRequestItem.getAdditionalData().get("alias"),notificationRequestItem.getPspReference()); }else {// Non valid NotificationRequestthrownewRuntimeException("Invalid HMAC signature"); }}
When deserializing Banking or Management Webhooks, first check if the payload is authentic:
// The webhook payloadStringpayload ="WEBHOOK_JSON_PAYLOAD";// HMAC key from Customer AreaStringhmacKey ="HMAC_KEY_RETRIEVED_FROM_CA";// HMAC signature from hmacsignature headerStringhmacsignature =headers.get("hmacsignature");if (hmacsignature ==null ||hmacsignature.isBlank()) {thrownewRuntimeException("HMAC Signature not found");}// validate the HMAC signatureHMACValidatorhmacValidator =newHMACValidator();if (!hmacValidator.validateHMAC(hmacsignature,hmacKey,payload)) {thrownewRuntimeException("Invalid HMAC signature");}
Use then the relevant webhook handler (i.e. ConfigurationWebhooksHandler) to obtain the object representing the event:
ConfigurationWebhooksHandlerwebhookHandler =newConfigurationWebhooksHandler(payload);// onAccountHolderNotificationRequestwebhookHandler.getAccountHolderNotificationRequest().ifPresent((AccountHolderNotificationRequestevent) -> {System.out.println(event.getData().getBalancePlatform());});// onBalanceAccountNotificationRequestwebhookHandler.getBalanceAccountNotificationRequest().ifPresent((BalanceAccountNotificationRequestevent) -> {System.out.println(event.getData().getBalanceAccount());});
To deserialize Management Webhooks use instead the specific webhook handlerManagementWebhooksHandler:
ManagementWebhooksHandlerwebhookHandler =newManagementWebhooksHandler(payload);// onMerchantCreatedNotificationRequestwebhookHandler.getMerchantCreatedNotificationRequest().isPresent((MerchantCreatedNotificationRequestevent) -> {System.out.println(event.getData().getMerchantId());});
When using Attachments, ensure content is provided as a byte array. It's important to convert it to aBase64-encoded string before initiating the request.
You can configure a proxy connection by injecting your own AdyenHttpClient on your client instance.
Example:
...// Import the required classesimportcom.adyen.httpclient.AdyenHttpClient;importjava.net.InetSocketAddress;importjava.net.Proxy;// Set http proxyAdyenHttpClientadyenHttpClientWithProxy =newAdyenHttpClient();Proxyproxy =newProxy(Proxy.Type.HTTP,newInetSocketAddress("PROXY_HOST",PROXY_PORT));adyenHttpClientWithProxy.setProxy(proxy);client.setHttpClient(adyenHttpClientWithProxy);
If your proxy requires authentication, set all the settings as system properties instead (don't mix with previous approach), for example:
System.setProperty("https.proxyHost","129.0.0.1");System.setProperty("https.proxyPort","3128");System.setProperty("https.proxyUser","squid");System.setProperty("https.proxyPassword","ward");
// Import the required classesimportcom.adyen.Client;importjavax.net.ssl.KeyManagerFactory;importjavax.net.ssl.SSLContext;importjavax.net.ssl.TrustManagerFactory;importjava.security.KeyStore;// Initialize a KeyManagerFactory with the client KeyStore and passwordKeyManagerFactorykeyManagerFactory =KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());keyManagerFactory.init(clientKeyStore,clientKeyStorePassword);// Create a TrustManagerFactory that trusts the CAs in our Trust KeyStoreTrustManagerFactorytrustManagerFactory =TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());trustManagerFactory.init(trustStore);// Create an SSLContext with the desired protocol that uses our KeyManagers and TrustManagersSSLContextsslContext =SSLContext.getInstance("TLSv1.2");sslContext.init(keyManagerFactory.getKeyManagers(),trustManagerFactory.getTrustManagers(),null);Clientclient =newClient(sslContext,apiKey);// Use the client
For In-Person Payments integrations with theCloud Terminal API, you must initialise the Clientsetting the closestRegion:
// Step 1: Import the required classesimportcom.adyen.Client;importcom.adyen.enums.Environment;importcom.adyen.service.TerminalCloudAPI;importcom.adyen.model.nexo.*;importcom.adyen.model.terminal.*;// Step 2: Initialize the client objectConfigconfig =newConfig() .environment(Environment.LIVE) .terminalApiRegion(Region.EU) .apiKey(apiKey);Clientclient =newClient(config);// Step 3: Initialize the API objectTerminalCloudAPIterminalCloudApi =newTerminalCloudAPI(client);// Step 4: Create the request objectStringserviceID ="123456789";StringsaleID ="POS-SystemID12345";StringPOIID ="Your Device Name(eg V400m-123456789)";// Use a unique transaction for every other transaction you performStringtransactionID ="TransactionID";TerminalAPIRequestterminalAPIRequest =newTerminalAPIRequest();SaleToPOIRequestsaleToPOIRequest =newSaleToPOIRequest();MessageHeadermessageHeader =newMessageHeader();messageHeader.setMessageClass(MessageClassType.SERVICE);messageHeader.setMessageCategory(MessageCategoryType.PAYMENT);messageHeader.setMessageType(MessageType.REQUEST);messageHeader.setProtocolVersion("3.0");messageHeader.setServiceID(serviceID);messageHeader.setSaleID(saleID);messageHeader.setPOIID(POIID);saleToPOIRequest.setMessageHeader(messageHeader);com.adyen.model.nexo.PaymentRequestpaymentRequest =newcom.adyen.model.nexo.PaymentRequest();SaleDatasaleData =newSaleData();TransactionIdentificationtransactionIdentification =newTransactionIdentification();transactionIdentification.setTransactionID("001");XMLGregorianCalendartimestamp =DatatypeFactory.newInstance().newXMLGregorianCalendar(newGregorianCalendar());transactionIdentification.setTimeStamp(timestamp);saleData.setSaleTransactionID(transactionIdentification);SaleToAcquirerDatasaleToAcquirerData =newSaleToAcquirerData();ApplicationInfoapplicationInfo =newApplicationInfo();CommonFieldmerchantApplication =newCommonField();merchantApplication.setVersion("1");merchantApplication.setName("Test");applicationInfo.setMerchantApplication(merchantApplication);saleToAcquirerData.setApplicationInfo(applicationInfo);saleData.setSaleToAcquirerData(saleToAcquirerData);PaymentTransactionpaymentTransaction =newPaymentTransaction();AmountsReqamountsReq =newAmountsReq();amountsReq.setCurrency("EUR");amountsReq.setRequestedAmount(BigDecimal.valueOf(1000));paymentTransaction.setAmountsReq(amountsReq);paymentRequest.setPaymentTransaction(paymentTransaction);paymentRequest.setSaleData(saleData);saleToPOIRequest.setPaymentRequest(paymentRequest);terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);// Step 5: Make the requestTerminalAPIResponseterminalAPIResponse =terminalCloudApi.sync(terminalAPIRequest);
To perform anabort request you can use the following example:
TerminalAPIRequestterminalAPIRequest =newTerminalAPIRequest();SaleToPOIRequestsaleToPOIRequest =newSaleToPOIRequest();MessageHeadermessageHeader =newMessageHeader();messageHeader.setMessageClass(MessageClassType.SERVICE);messageHeader.setMessageCategory(MessageCategoryType.ABORT);messageHeader.setMessageType(MessageType.REQUEST);messageHeader.setProtocolVersion("3.0");messageHeader.setServiceID("Different service ID");messageHeader.setSaleID(saleID);messageHeader.setPOIID(POIID);AbortRequestabortRequest =newAbortRequest();abortRequest.setAbortReason("MerchantAbort");MessageReferencemessageReference =newMessageReference();messageReference.setMessageCategory(MessageCategoryType.PAYMENT);messageReference.setSaleID(saleID);messageReference.setPOIID(POIID);// Service ID of the payment you're abortingmessageReference.setServiceID(serviceID);abortRequest.setMessageReference(messageReference);saleToPOIRequest.setAbortRequest(abortRequest);saleToPOIRequest.setMessageHeader(messageHeader);terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);TerminalAPIResponseterminalAPIResponse =terminalCloudApi.sync(terminalAPIRequest);
To perform astatus request you can use the following example:
TerminalAPIRequestterminalAPIRequest =newTerminalAPIRequest();SaleToPOIRequestsaleToPOIRequest =newSaleToPOIRequest();MessageHeadermessageHeader =newMessageHeader();messageHeader.setMessageClass(MessageClassType.SERVICE);messageHeader.setMessageCategory(MessageCategoryType.TRANSACTION_STATUS);messageHeader.setMessageType(MessageType.REQUEST);messageHeader.setProtocolVersion("3.0");messageHeader.setServiceID("Different service ID");messageHeader.setSaleID(saleID);messageHeader.setPOIID(POIID);TransactionStatusRequesttransactionStatusRequest =newTransactionStatusRequest();transactionStatusRequest.setReceiptReprintFlag(true);transactionStatusRequest.getDocumentQualifier().add(DocumentQualifierType.CASHIER_RECEIPT);transactionStatusRequest.getDocumentQualifier().add(DocumentQualifierType.CUSTOMER_RECEIPT);MessageReferencemessageReference =newMessageReference();messageReference.setMessageCategory(MessageCategoryType.PAYMENT);messageReference.setSaleID(saleID);// serviceID of the transaction you want the status update frommessageReference.setServiceID(serviceID);transactionStatusRequest.setMessageReference(messageReference);saleToPOIRequest.setTransactionStatusRequest(transactionStatusRequest);saleToPOIRequest.setMessageHeader(messageHeader);terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);TerminalAPIResponseterminalAPIResponse =terminalCloudApi.sync(terminalAPIRequest);
UsePredefinedContentHelper to parse Display notification types which you find inPredefinedContent->ReferenceID
PredefinedContentHelperhelper =newPredefinedContentHelper(predefinedContent.getReferenceID());// Safely extract and use the event type with Optionalhelper.getEvent().ifPresent(event -> {System.out.println("Received event: " +event);if (event ==PredefinedContentHelper.DisplayNotificationEvent.PIN_ENTERED) {// Handle PIN entry eventSystem.out.println("The user has entered their PIN."); }});
The request and response payloads are identical to the Cloud Terminal API, however, additional encryption details are required to perform the requests.
// Import the required classesimportcom.adyen.Client;importcom.adyen.Config;importcom.adyen.enums.Environment;importcom.adyen.httpclient.TerminalLocalAPIHostnameVerifier;importcom.adyen.service.TerminalLocalAPI;importcom.adyen.model.terminal.security.*;importcom.adyen.model.terminal.*;importjavax.net.ssl.SSLContext;importjavax.net.ssl.TrustManagerFactory;importjava.security.KeyStore;importjava.security.SecureRandom;// Create a KeyStore for the terminal certificateKeyStorekeyStore =KeyStore.getInstance(KeyStore.getDefaultType());keyStore.load(null,null);keyStore.setCertificateEntry("adyenRootCertificate",adyenRootCertificate);// Create a TrustManagerFactory that trusts the CAs in our KeyStoreTrustManagerFactorytrustManagerFactory =TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());trustManagerFactory.init(keyStore);// Create an SSLContext with the desired protocol that uses our TrustManagersSSLContextsslContext =SSLContext.getInstance("SSL");sslContext.init(null,trustManagerFactory.getTrustManagers(),newSecureRandom());// Configure a client for TerminalLocalAPIConfigconfig =newConfig();config.setEnvironment(environment);config.setTerminalApiLocalEndpoint("https://" +terminalIpAddress);config.setSSLContext(sslContext);config.setHostnameVerifier(newTerminalLocalAPIHostnameVerifier(environment));Clientclient =newClient(config);// Create your SecurityKey object used for encrypting the payload (keyIdentifier/passphrase you set up beforehand in CA)SecurityKeysecurityKey =newSecurityKey();securityKey.setKeyVersion(1);securityKey.setAdyenCryptoVersion(1);securityKey.setKeyIdentifier("keyIdentifier");securityKey.setPassphrase("passphrase");// Use TerminalLocalAPITerminalLocalAPIterminalLocalAPI =newTerminalLocalAPI(client,securityKey);TerminalAPIResponseterminalAPIResponse =terminalLocalAPI.request(terminalAPIRequest);
When using Attachments, ensure content is provided as a byte array. It's important to convert it to aBase64-encoded string before initiating the request.
If you wish to develop the Local Terminal API integration parallel to your encryption implementation, you can opt for the unencrypted version. Be sure to remove any encryption details from the CA terminal config page. Consider this ONLY for development and testing on localhost.
// Step 1: Import the required classesimportcom.adyen.service.TerminalLocalAPI;importcom.adyen.model.nexo.*;importcom.adyen.model.terminal.*;importjavax.net.ssl.SSLContext;// Step 2: Add your Certificate Path and Local Endpoint to the config path.Clientclient =newClient();client.getConfig().setTerminalApiLocalEndpoint("The IP of your terminal (eg https://192.168.47.169)");client.getConfig().setEnvironment(Environment.TEST);config.setSSLContext(createTrustSSLContext());// Trust all certificates for testing onlyclient.setConfig(config);// Step 3: Create an SSL context that accepts all certificates (Use in TEST only).SSLContextcreateTrustSSLContext()throwsException {TrustManager[]trustAllCerts =newTrustManager[]{newX509TrustManager() {java.security.cert.X509Certificate[]getAcceptedIssuers() {returnnull; }checkClientTrusted(java.security.cert.X509Certificate[]certs,StringauthType) {}checkServerTrusted(java.security.cert.X509Certificate[]certs,StringauthType) {} } };SSLContextsc =SSLContext.getInstance("SSL");sc.init(null,trustAllCerts,newjava.security.SecureRandom());returnsc;}// Step 4: Construct a TerminalAPIRequest objectGsongson =newGsonBuilder().create();TerminalAPIRequestterminalAPIPaymentRequest =newTerminalAPIRequest();// Step 5: Make the requestTerminalAPIResponseterminalAPIResponse =terminalLocalAPI.request(terminalAPIRequest);
For a closer look at how our Java library works, you can clone one of our example integrations:
These include commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.
We value your input! Help us enhance our API Libraries and improve the integration experience by providing your feedback. Please take a moment to fill outour feedback form to share your thoughts, suggestions or ideas.
We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements.
Have a look at ourcontributing guidelines to find out how to raise a pull request.
If you have a feature request, or spotted a bug or a technical problem,create an issue here.
For other questions,contact our Support Team.
This repository is available under theMIT license.
- Example integrations:
- Adyen docs
- API Explorer
About
Adyen API Library for Java
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
