This page explains how to add Swish to your existing Web Components integration.
Requirements
Select which endpoint you are using:
Import resources for v6
If you are using Web Components v6, import the Component that you need for Swish:
import { AdyenCheckout, Swish } from '@adyen/adyen-web'
API reference
You do not need to send additional fields for Swish. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:
- /sessions: This is the default with Components v5.0.0 or later.
- /payments: If you implemented an additional use case.
Component configuration
Step 1: Create a DOM element
Create a DOM element on your checkout page, placing it where you want the payment method form to be rendered:
<div id="swish-container"></div>
Step 2: Create an instance of the Component
v6.0.0 or later
Create an instance of the Component, passing:
- Your instance of
AdyenCheckout
.
const swish = new Swish(checkout).mount('#swish-container');
v5.x.x or earlier
Use the create
method of your AdyenCheckout
instance, in this case checkout
, to create the Component:
const swishComponent = checkout.create('swish').mount('#swish-container');
Test and go live
When you make a Swish payment in the test environment, the payment is authorised within 15 seconds. You can simulate different refusal scenarios, as outlined in the Merchant Swish Simulator, by adding the error code to the shopperStatement
property. For example, "shopperStatement": "FF08"
.
Check the status of Swish test payments in your Customer Area > Transactions > Payments.
To accept live Swish payments, you must submit a request for Swish in your live Customer Area.