Create Adyen order
Before getting started the following steps need to be completed:
- Get your API key and client key
You can create them in Adyen Merchant Center. - Set up webhook
The webhook should be set it up towards https://api.${env}.brinkcommerce.com/orderv1/payments/adyen/notifications. If you are unsure which environment to point towards, please contact Brink support and we'll help you. - Install a server-side library.
The API key and the HMAC generated when setting up the webhook, must be provided to Brink for configuration purposes server side.
How it works
- First you will create an Adyen session through Brinks endpoint /orderv1/carts/adyen/orders with the
jwtToken
. Brink uses the latest api from Adyen. The return url will contain the following:
sessionId
redirectResult
signature
orderId
- Set up the Drop-in.
Instructions how can be found in Adyens documentation. - Get the payment outcome.
This is handled by endpoint that you've set up the webhook towards. - Use the signature to fetch the order from on the confirmation page.
sequenceDiagram
Customer->>FrontEnd: Fill out adress details
Customer->>FrontEnd: Go to Payment
FrontEnd->>BrinkCommerce: Pass shopper details
note over FrontEnd, BrinkCommerce: POST /carts/adyen/orders
BrinkCommerce->>Adyen: Submit session request
Adyen-->>BrinkCommerce: return sessionData
BrinkCommerce-->>FrontEnd: return sessionData
FrontEnd-->>FrontEnd: Initiate Drop In
note over FrontEnd : - Presents available Payment Methods <br>- Collects payment details <br> - Starts a payment <br> - Handles additional actions <br> - calls onPaymentCompleted <br> - Presents the payment result
Adyen->>BrinkCommerce: AUTHORISATION webhook
How to handle updates to the cart
If any changes are done to the cart, you need to create a new session through the enpoint /orderv1/carts/adyen/orders and then load the response into the Drop-in, as described earlier. [Ankar-länka till "How it works"]
Display an order on the confirmation page
Some payment methods will process payments on a hosted payment page (HHP). In these cases you can fetch the order with a HTTP GET towards /orderv1/payments/adyen/orders/{id}/confirmation, given the orderId and signature from the success redirect callback , example 'https://demo.brinkcommerce.com/success/?orderId=...&signature=...'.