How you add Swish depends on your integration.
Choose the server-side flow that your integration uses:
Start integrating with Sessions flow Component
Choose your versionRequirements
Requirement | Description | |
---|---|---|
Integration type | Make sure that you have an existing Sessions flow Android Components integration. | |
Checkout API | Make sure that you use Checkout API v68 or later. | |
Setup steps | Before you begin, add Swish in your Customer Area. |
Add additional parameters to your /sessions request
You do not need to add any parameters when you create a payment session.
Import the Component for Swish
To import the library and include the module for Swish.
implementation "com.adyen.checkout:instant:YOUR_VERSION" implementation "com.adyen.checkout:components-compose:YOUR_VERSION"
Add additional configuration for Swish
Add a configuration object with the following parameters:
Parameter | Required | Description |
---|---|---|
setSubmitButtonVisible | Set if you want the submit button to be visible. |
{ .setSubmitButtonVisible(value) }
Launch and show the Component for Swish
To create the Component for Swish, use the InstantPaymentComponent
class.
import com.adyen.checkout.components.compose.get // Get the payment method. val paymentMethod = checkoutSession.getPaymentMethod(PaymentMethodTypes.SCHEME) @Composable private fun ComposableInstantPaymentComponent() { // Keep a reference to this Component in case you need to access it later. val instantComponent = InstantPaymentComponent.PROVIDER.get( checkoutSession = checkoutSession, paymentMethod = paymentMethod, configuration = checkoutConfiguration, componentCallback = callback, // This key is required to ensure a new Component gets created for each different screen or payment session. // Generate a new value for this key every time you need to reset the Component. key = "YOUR_UNIQUE_KEY_FOR_THIS_COMPONENT", ) // This is your composable, a wrapper around our xml view. AdyenComponent( component = instantComponent, modifier = YOUR_MODIFIER, ) }
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.