Implementation examples
See our example integration on GitHub! On this page we provide Adyen-specific information for building a Progressive Web Application (PWA) storefront. The PWA storefront works with a headless Adobe Commerce back-end that has the Adyen plugin installed and configured. You can use one of the following web APIs to get Adyen functionalities in your Adobe Commerce headless implementation:- REST: The most widely used web API. This method allows you to access all the functionalities provided by the Adyen plugin.
-
GraphQL:
Requires plugin v8.2.0 or later
The Adyen plugin utilizes the
/graphqlendpoint exposed by the Adobe Commerce back-end, and adds functionality that is related to the plugin. You can access all functionalities provided by the Adyen plugin with this method. For more information, checkout the Adobe Commerce GraphQL documentation.
Ecommerce checkout flow
Postman
- Get the payment methods that are available on the Adyen platform, and for each of them determine the data that you need to collect.
- Collect shopper details by presenting the payment methods on your payment form. Then, when the shopper selects a payment method, present the fields to fill out or the options to choose from, and collect these details.
- Place the order.
- Check the payment status to see if you need to perform any extra steps before redirecting the user to the success page or showing an error message.
- Handle additional actions like redirecting the customer to the issue page for additional authentication, or presenting a QR code to complete the payment. If the payment fails, the following attempts will need to handle the additional actions as well
Requirements
Before you start integrating a Adobe Commerce PWA storefront with the Adyen platform:-
Make sure that you have completed the steps to configure the Adobe Commerce back end:
- Set up the Adyen Customer Area.
- Set up the plugin in Adobe Commerce.
- Set up the payment methods in Adobe Commerce.
- Configured headless integration settings in Adobe Commerce.
- Get familiar with the front end components implementation. We suggest using the components to gather the payment related information in a secure way.
-
The plugin uses Adobe Commerce’s recommended authentication methods to authenticate requests coming from the front-end application. The endpoints use
selfresources for logged-in shoppers andanonymousresources for guest shoppers.
Therefore, an integration token is no longer required. Customer token needs to be used asBearer Tokenfor logged-in shoppers. For guest shoppers, no token is required because a maskedcard_idis used to authenticate requests.
Step 1: Get available payment methods
In this step, the Adobe Commerce back end retrieves the available payment methods from the /paymentMethods API endpoint and adds some extra information that you will need for rendering the components on the front end. To get the available payment methods and extra information:- Make an API request to get the payment methods and data that you need to collect.
- Parse the API response to get a JSON object that contains the Adyen
/paymentMethodsresponse and required extra information.
1. Make an API request
If you are using REST, the endpoint differs per use case. If you are using GraphQL, the endpoint is/graphql.
- REST
- GraphQL
- REST
- GraphQL
- REST
- GraphQL
- REST
- GraphQL
- REST
- GraphQL
-
Guest shoppers (not logged-in)
- GET
/V1/guest-carts/{cartId}/payment-information
Alternatively, - POST
/V1/guest-carts/{cartId}/shipping-information
- GET
-
Logged-in shoppers
- GET
/V1/carts/mine/payment-information
Alternatively, - POST
/V1/carts/mine/shipping-information
- GET
/payment-information and /shipping-information responses include extension_attributes. This field contains available payment methods and required extra information as adyen_payment_methods_response. The required extra information is relevant when collecting shopper details in Step 2.The payment_methods object in the response of /payment-information or /shipping-information endpoints is filtered and sorted according to the response of /paymentMethods endpoint.
