DEV Community

Cover image for Effortless API Testing with the Adyen Postman collections
Beppe Catanese for Adyen

Posted on • Originally published at adyen.com

Effortless API Testing with the Adyen Postman collections

As a global leading technology-driven company, at Adyen we recognise the importance of equipping developers with tools and resources that reduce time to value and make the integration with our platform faster and better.

That's why we have launched the Adyen Postman space. Leveraging the robust capabilities of Postman—a very popular tool in the API ecosystem - the developers, who work with the Adyen platform, can quickly discover, explore and test the Adyen APIs.

In this article..

…click, fork, play! Explore the benefits of using the Adyen Postman collections for discovering, exploring and testing the Adyen APIs. Checkout the step-by-step guide to getting started.

Adyen Postman Collections

Adyen Postman collections consist of preconfigured API requests that enable developers to effortlessly invoke Adyen's APIs. The collections are automatically generated from the OpenAPI specifications, ensuring all API endpoints and the JSON payloads are accurate and always up-to-date.
We provide a single workspace for all Adyen APIs. In the workspace there is a collection for each of the Adyen services, from Checkout to Recurring, Point of Sale and Platforms.

Image description

Streamlined integration

The primary advantage of adopting the Adyen Postman collections is the streamlined integration process we are able to offer. Following few simple steps the developers can perform API calls easily:

  • Fork the environment and define your own credentials
  • Fork the collection
  • Run the HTTP requests
  • Stay up to date

Fork the environment

By forking the preconfigured environment, developers obtain a template to configure essential settings such as the API key and other configuration options. It is important to keep the forked environment private to protect sensitive information.

Image description

The configuration can be defined at different levels: the preferred approach is using the Postman environment as it can be shared across collections. It is however possible to set the values in the Global scope (always available throughout the entire workspace) or in the Collection directly.

Fork the collection

To begin using the Adyen Postman collections, developers can fork a specific collection. By doing so, they can leverage the prebuilt requests, including parameters and payloads, saving valuable time and effort.
The collections are designed with flexibility in mind: they define variables that can be managed in one place and re-used across all requests (think of merchant and company accounts, platform code and other parameters).

Once the collection is forked it becomes available in the developer’s private workspace. The requests can be customized (when needed) and executed.

Image description

Developers using the Adyen Postman collections can invoke all API's endpoints using their own API key and access rights, validate the responses and verify the outcome.
The collections simplify the work of developers and testers providing many pre-defined scenarios:

  • make a payment using various payment methods
  • execute Adyen for Platforms Onboarding scenarios
  • issuing of physical and virtual cards
  • create different transaction rules
  • etc..

Stay Informed

The Adyen Postman space provides a convenient way to stay updated on changes and new releases. By watching a collection, users receive an email notification when there is a modification or something new in the collection.

New API releases might bring new features, corrections, or sometimes better documentation and examples. Any of those changes is pushed to the developers watching the collection allowing them to inspect the differences and pull the changes.

This proactive approach keeps developers informed about new versions and, ultimately, it is a great way to discover new features and upgrade their integration.

Image description

Payment subscriptions with Postman

Let’s see the Postman collections in action. We are going to look at the Payment Subscriptions (Tokenization) use case where the shopper authorizes a recurring payment for a subscription.

Set the API Key and Merchant Account

You start with forking the environment called “Adyen APIs”. In your own local fork, configure the X-API-Key (API Key from the API credential) and the Merchant Account. Keep the environment private as it contains sensitive information.

Image description

Fork the Checkout API collection

Next fork the Checkout API collection, then browse to the “Payments” folder and take a look at the “Tokenize card details for a subscription” request.

Image description

The request payload is pre-configured with variables like the merchantAccount (defined in the environment above), dynamic variables (i.e. auto generated reference) and some data (like the amount) that can be changed.

{
 "amount": {
  "currency": "USD",
  "value": 1000
 },
 "reference": "{{$guid}}",
 "paymentMethod": {
  "type": "scheme",
  "number": "4111111111111111",
  "expiryMonth": "03",
  "expiryYear": "2030",
  "holderName": "John Smith",
  "cvc": "737"
 },
 "shopperReference": "SHOPPER_REF_1",
 "storePaymentMethod": true,
 "shopperInteraction": "Ecommerce",
 "recurringProcessingModel": "Subscription",
 "returnUrl": "https: //your-company.com/...",
 "merchantAccount": "{{YOUR_MERCHANT_ACCOUNT}}"
}
Enter fullscreen mode Exit fullscreen mode

You only need to enable the environment, in the top-right corner, and execute the request. The response body will include the resultCode ('Authorized') and the generated token (in the 'additionalData.recurring.recurringDetailReference' field).

{
 "additionalData": {
  "recurring.recurringDetailReference": "TOKEN_REF",
  "recurringProcessingModel": "Subscription",
  "paymentMethod": "visa",
  "recurring.shopperReference": "SHOPPER_REF_1"
 },
 "pspReference": "PSP00000001",
 "resultCode": "Authorised",
 "amount": {
  "currency": "USD",
  "value": 1000
 },
 "merchantReference": "111ab222-abcd-1234-aaaa-0f0f0f0f0fOf",
 "paymentMethod": {
  "brand": "visa",
  "type": "scheme"
 }
}
Enter fullscreen mode Exit fullscreen mode

The last step is to make a subscription payment using the token.
Find the “Make a card payment with a token” request, set the token in the 'storedPaymentMethodId' field and execute the payment.

Image description

Adyen Postman on Github

The Adyen Postman space provides the latest and greatest version of the Adyen APIs. However it is sometimes necessary to work with an older version. This is why we also store the Postman (JSON) files for all API releases on the adyen-postman GitHub repository.
Import the JSON file in Postman and run the requests against a previous API version: test URLs, endpoint paths and payloads are already configured accordingly.

Conclusion

Adyen Postman collections provide developers with a powerful toolset for the discovery, configuration and testing of the Adyen's APIs. Using automation we ensure the collections are always up-to-date and the information is consistent. Leveraging on Postman notifications and its Git-alike version control developers are informed as soon as a new version is available.

Save valuable time and effort by avoiding manual uploads of the OpenAPI files. Instead take advantage of a readily available collection for an effortless and effective utilization.

Get started with the Adyen Postman collections. Start by forking the environment, exploring the collections and invoking the endpoints. Reduce time to value and make your integration journey simpler and better.

Top comments (0)