Find information on most frequently asked questions during integrating on commercetools-adyen-integration.
- Can I use Adyen web components >= v5.0.0 with this integration ?
- Does the integration support payment method X ?
- Can I pass additional fields to payment requests?
- Do we need to pass additional fields to payment requests for 3D Secure 2 payment method?
- Can I remove a subscription I created?
- How does the notification module find a matching payment?
- Will we lose a notification if it was not processed for some reason?
- Does the integration modify order/cart ?
- What are the best practices for deploying commercetools-adyen-integration ?
- Are there any recommendations for securing the integration services as those need to be publicly exposed?
- What are the best practices in regards to commercetools payment object lifecycle?
- Why payment status is not set?
- What do I do in case of errors?
- When I should create commercetools order ?
In v5.0.0 (released in October 2021) Adyen introduced a simplified way of integrating Web Components, using a single API endpoint /sessions
. It is considered as a simplification of existing functionalities.
The migration of this integration has been completed in February 2023. For new merchants, now you can use Adyen web components v5.0.0 with this integration to complete the checkout process.
Since the newly-introduced endpoint /sessions
aims at replacing the endpoints /payments
and /payments/details
. Our integration no longer supports the requests to these two existing endpoints.
Therefore, for the existing merchants, breaking change is required in case they are planning to upgrade the Ayden web components from version < v5.0.0
For the existing endpoint /paymentMethods
, it is kept unchanged and optional in Adyen web components >= v5.0.0 as users still need it to list out the supported payment methods of their merchant account.
Integration supports all Adyen Web Component based payment methods. For a full list of payment methods please refer to supported payment methods. If you encounter any problems during your integration, feel free to create a github issue.
Yes, you could include additional fields to payment session request such as add risk management fields or allow recurring payments based on the payment method that you use, for more details please check the note in important section on our integration docs.
According to the Adyen documentation, it is not required after web component version 5. Since we are now using /session` endpoint which does not require additional configuration for 3D secure. adyen documentation
If you accidentally created a subscription you can edit it and uncheck the Active checkbox so Adyen doesn't send notifications. Then you can contact the Adyen support and ask them to remove the subscription
It first find the payment by key
where key in (${merchantReference}, ${pspReference})
. If original reference exists in notification, the payment can be found by key
where key in (${merchantReference}, ${originalReference})
. And then it finds in this payment the corresponding transaction by interactionId
where interactionId=${pspReference}
.
Adyen will queue notifications when the notification service was not reachable or it didn't return a success message and will try to send it later.
Order/cart modifications should be part of the front end/merchant server business logic. commercetools-adyen-integration will neither change the cart nor the order.
- There are multiple ways to deploy the integration. Here we provided some deployment examples.
- Both modules should be deployed as a publicly exposed services.
- Modules are stateless which makes running multiple instances in parallel possible.
- If the modules are deployed into a Kubernetes cluster, it is recommended to enable horizontal scaling with at least 2 running instances behind the load balancer in order to omit a downtime.
Are there any recommendations for securing the integration services as those need to be publicly exposed?
- For production setups we strongly recommend to use HTTPS instead of HTTP.
- To protect your public extension service from unauthorised calls, we recommend to activate basic auth authentication on the API extension.
- To protect your notification service from unauthorised calls, we strongly recommend that you activate Hash-based message authentication code HMAC signatures during the Adyen notification setup.
- Create commercetools payment as described here.
- After successful payment creation always add it to the appropriate cart.
- Never delete or un-assign from cart the payment objects created during the checkout. Clean-up (if required) can be done asynchronously i.e.: after order creation.
Currently payment status is not maintained by the integration as status of the payment can be derived from the state of the payment transaction(s).
In case you encounter errors during the integration please refer to the error-handling section
There are 2 approaches for creating commercetools order. You can create an order either before or after a successful payment. Both approaches have their good and bad sides, but we found out that creating an order AFTER a successful payment is less harmful. Please read the details below for both approaches and decide based on your checkout scenarios.
- Shop (success redirect URL) is not reachable due to the network issues: Since shop creates an order and success shop redirect URL can not be reached we might end up with a successful payment but no order.
- Possible solution: Create an order asynchronously based on the payment transaction changes, which delivery is guaranteed due to the asynchronous notifications from Adyen. Depending on your preference you might either query for the latest messages of type PaymentTransactionAdded, PaymentTransactionStateChanged or subscribe to the mentioned message types. Every message will link its payment through the
resource
field and since every payment is attached to a cart one has all the informations at hand to decide if the cart has to be converted to order or not. Since the job or worker processing the message is not a usual place where the order is created it might be reasonable to pass the cart ID to another service or web shop URL which will verify the cart and create an order out of it. An example implementation which follows the described approach is shown by commercetools-payment-to-order-processor
- Possible solution: Create an order asynchronously based on the payment transaction changes, which delivery is guaranteed due to the asynchronous notifications from Adyen. Depending on your preference you might either query for the latest messages of type PaymentTransactionAdded, PaymentTransactionStateChanged or subscribe to the mentioned message types. Every message will link its payment through the
- More than 1 successful payments on the cart/order: It is possible to have more than 1 valid payments on the cart/order. It could happen for example when customer initiates a payment in two different tabs for the same cart and both payments are of type redirect (like credit card and paypal.
These two payments can be completed independently in both tabs. Since every payment should be always attached to the cart this would make a cart to link two successful payments.
- Possible solution: Refund one of the successful payments. Similar as in case of
Create an order based on transaction state changes
above one could process the same message types in order to figure out if the cart has to many successful payments and create a refund.
- Possible solution: Refund one of the successful payments. Similar as in case of
- The amount of the successful payment is lower than the cart amount: During the checkout the shopper might navigate with two tabs, one with the cart and the other tab might be already a redirected payment with fixed amount like PayPal. Shopper can add more items to the cart so that the cart value is not equal to the amount that will be paid in the payment provider tab.
- Possible solution: After a successful payment, validate the cart to check if the cart amount matches the paid amount. If not, refund/cancel the payment and ask the shopper to pay again.
- If the shopper never finishes (according to the stats most shoppers jump out of checkout when they actually have to pay) or cancels a payment the reserved stock with an order will not be released and thus there is a risk that simple automation (or even many users) will run the shop out of stock.
- There will be orders which will never be paid but shown in commercetools Merchant Center dashboard as revenue - which is not true.
- Not paid orders will falsely boost the concept of “best sellers” index of its products.
- Creating an order does not allow you to modify the original cart anymore. What happens if a shopper forgot something and would like to change the cart just after initiation of the payment?
- How to handle vouchers that can be applied only once but the shopper decided not to finish the payment and change the cart instead? It might require a new cart based on the old cart. The creation of a new cart with the same item might be an issue if an item had only stock = 1 and it has been used in not paid order already.