Coder Social home page Coder Social logo

adyen-java-api-library's Introduction

Coverage Status

Adyen Java API Library

This is the officially supported Java library for using Adyen's APIs.

The library supports all APIs under the following services:

For more information, refer to our documentation or the API Explorer.

Prerequisites

Installation

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>18.1.0</version>
</dependency>

Alternatively, you can download the release on GitHub.

Using the library

General use with API key

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

// Setup Client and Service
Client client = new Client("Your X-API-KEY", Environment.TEST);
Checkout checkout = new Checkout(client);

// Create PaymentsRequest 
PaymentsRequest paymentsRequest = new PaymentsRequest();
paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT");
String encryptedCardNumber = "test_4111111111111111";
String encryptedExpiryMonth = "test_03";
String encryptedExpiryYear = "test_2030";
String encryptedSecurityCode = "test_737";
paymentsRequest.addEncryptedCardData(encryptedCardNumber,encryptedExpiryMonth, encryptedExpiryYear, encryptedSecurityCode);
Amount amount = new Amount();
amount.setCurrency("EUR");
amount.setValue(1000L);
paymentsRequest.setAmount(amount);
paymentsRequest.setReference("Your order number");
paymentsRequest.setReturnUrl("https://your-company.com/checkout?shopperOrder=12xy..");

// Make a call to the /payments endpoint
PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);

General use with API key for live environment

For requests on live environment, you need to pass the Live URL Prefix to the Client object:

// Setup Client and Service
Client client = new Client("Your X-API-KEY", Environment.LIVE, "Your live URL prefix");
Checkout checkout = new Checkout(client);

...

General use with basic auth

 // Setup Client and Service
 Client client = new Client("Your username", "Your password", Environment.LIVE, "Your live URL prefix", "Your application name");
 Checkout checkout = new Checkout(client);
 
 ...

Using notification webhooks parser

 String json = "The notification message sent to your webhook";
 NotificationHandler notificationHandler = new NotificationHandler();
 GenericNotification notificationMessage = notificationHandler.handleMarketpayNotificationJson(json);
 ...

Proxy configuration

You can configure a proxy connection by injecting your own AdyenHttpClient on your client instance.

Example:

...
AdyenHttpClient adyenHttpClientWithProxy = new AdyenHttpClient();

Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("PROXY_HOST", PROXY_PORT));
adyenHttpClientWithProxy.setProxy(proxy);

client.setHttpClient(adyenHttpClientWithProxy);

Example integrations

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.

Contributing

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 our contributing guidelines to find out how to raise a pull request.

Support

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.

Licence

This repository is available under the MIT license.

See also

adyen-java-api-library's People

Contributors

abhilash-adyen avatar achawki avatar aleffio avatar alexandrosmor avatar amortj avatar andrei-dediu avatar dbaneman avatar dependabot-preview[bot] avatar dependabot[bot] avatar jillingk avatar jnorkus avatar kadobot avatar lancergr avatar lukasdrp avatar maassenbas avatar martinsrenato avatar maxsumrall avatar michaelngangom avatar michaelpaul avatar morerice avatar renovate-bot avatar rickwieman avatar rikterbeek avatar rkewlani avatar sanmibuh avatar saquibsayyad avatar smic1909 avatar vladimirbutch avatar wboereboom avatar zurmalik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.