Online Payments

Seamless View Events

Possible events during Seamless View payments.

Edit "Seamless View Events" on GitHub

Payment Menu Events

During operation in the Payment Menu, several events can occur. They are described below.

Event Overrides: When you add an event handler to any of these events, you are overriding the original event. This means you can’t simply add an event for logging purposes. You have to either add back the original behavior, or replace it with your own custom logic. If you do not do this, you may risk undefined behavior or, at worst, a broken payment flow.

onAborted

Triggered when the payer clicks the “Abort” link on the redirect page in Payment Menu.

This event mirrors onPaymentCanceled from Checkout v2.

This event can be overridden if you want to handle the payer aborting their payment attempt in the Swedbank Pay payment frame. Do note that only the Redirect integration provides a cancel button. Using a Seamless integration, you will have to provide your own button, link or method to allow the payer to cancel the payment from your site.

If you do not override the event, the payer will be redirected to the cancelUrl in the same tab if possible.

This is the object that is provided if you override the event:

onAborted event object

1
2
3
4
5
{
    "event": "OnAborted",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "redirectUrl": "https://example.com/cancelled"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
redirectUrl string The URL the user will be redirect to after a cancelled payment.

onCheckoutLoaded

Triggered when the payment menu is rendered after being opened.

Subscribe to this event if you need total control over the height of Swedbank Pay’s payment frame. This is the initial height of the frame when loaded.

If no callback method is set, no handling action will be done. It will be raised with the following event argument object:

onCheckoutLoaded event object

1
2
3
4
5
{
    "event": "OnCheckoutLoaded",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "bodyHeight": "[clientHeight of iframe content]"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
bodyHeight string The height of the client’s iframe content.

onCheckoutResized

Triggered every time that a reconfiguration leads to resizing of the Checkout Seamless View.

This event mirrors onApplicationConfigured from Checkout v2.

This event can be overridden if you need to know when the height of the Swedbank Pay’s payment frame. This will be the new height after a resizing is performed. This event is triggered every time a resizing is needed.

If you do not override the event, no action will be done. This event is only provided for informational purposes.

This is the object that is provided if you override the event:

onCheckoutResized event object

1
2
3
4
5
{
    "event": "OnCheckoutResized",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "bodyHeight": "[clientHeight of iframe content]"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
bodyHeight string The height of the client’s iframe content.

onError

Triggered during terminal errors or if the configuration fails validation.

This event can be overridden if you want the details if an error occurs during the payment flow. This will be provided in a human readable format.

If you do not override the event, no action will be done. This event is only provided for informational purposes.

This is the object that is provided if you override the event:

onError event object

1
2
3
4
5
{
    "event": "OnError",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "details": "English descriptive text of the error"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
details string A human readable and descriptive text of the error.

onEventNotification

Triggered whenever any other public event is called. It does not prevent their handling.

This event can be overridden if you want a better overview of the payment flow. Whenever one of the events in the example below is triggered, a message with the name of the event is provided.

If you do not override the event, no action will be done. This event is only provided for informational purposes.

This is the object that is provided if you override the event:

onEventNotification event object

1
2
3
4
5
6
7
8
{
     "event": "OnEventNotification",
     "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
     "sourceEvent": "OnPaid | OnFailed | OnAborted | OnPaymentAttemptAborted |
      OnOutOfViewReidrect | OnTermsOfServiceRequested | OnCheckoutResized |
      OnCheckoutLoaded | OnConsumerGuestSelected | OnInstrumentSelected |
      OnError | OnPaymentAttemptStarted | OnPaymentAttemptFailed"
 }
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
sourceEvent string A human readable and descriptive text with the event name.

onInstrumentSelected

Triggered when a user actively changes payment method in the Payment Menu.

This event mirrors onPaymentMenuInstrumentSelected from Checkout v2.

This event can be overridden if you want to know when the payer selects a payment method in the Swedbank Pay payment frame.

If you do not override the event, no action will be done. This event is only provided for informational purposes.

This is the object that is provided if you override the event:

onInstrumentSelected event object

1
2
3
4
5
{
    "event": "OnInstrumentSelected",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "instrument": "creditcard | vipps | swish | invoice",
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
instrument string Creditcard, vipps, swish, invoice. The payment method selected by the user.

onOutOfViewOpen

Triggered when another tab is opened in the browser, like the information page for onboarding of stored cards, or Swedbank Pay’s owner TOS.

This event can be overridden if you want to handle openeing a redirect intended to be opened up in a new window or tab. This is ideal if you want to handle this type of redirects yourself, such as opening up the link inside of a modal.

If you do not override the event, we will attempt to open up the link in a new tab or window, if possible.

This is the object that is provided if you override the event:

onOutOfViewOpen event object

1
2
3
4
5
{
    "event": "OnOutOfViewOpen",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "openUrl": "https://example.com/external"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
openUrl string The external URL where the user will be redirected.

onOutOfViewRedirect

Triggered when a user is redirected to a separate web page, like 3-D Secure or BankID signing.

This event mirrors onExternalRedirect from Checkout v2.

This event can be overridden if you want to handle redirects to another page yourself. This is ideal if you want to show any alerts or warnings before passing the payer to the next page or if you want to show a status on your page before redirecting.

If you do not override the event, the redirect will happen in the same tab if possible.

This is the object that is provided if you override the event:

onOutOfViewRedirect event object

1
2
3
4
5
{
    "event": "OnOutOfViewRedirect",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "redirectUrl": "https://example.com/external"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
redirectUrl string The external URL where the user will be redirected.

onPaid

This event triggers when the payer successfully completes or cancels the payment.

This event mirrors onPaymentCompleted from Checkout v2.

This event can be overridden if you want to handle redirects on completed payments yourself, for example if you want to close the payment window to display a receipt for the payment or want to handle closing the page first before sending the payer to the paymentComplete url. If you do this, we highly recommend you perform a GET on the payment to check the actual payment status and act accordingly.

If you do not override the event, the redirect will happen in the same tab if possible.

This is the object that is provided if you override the event:

onPaid event object

1
2
3
4
5
{
    "event": "OnPaid",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "redirectUrl": "https://example.com/success"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
redirectUrl string The URL the user will be redirected to after completing the payment.

onPaymentAttemptAborted

This event mirrors onPaymentAborted from Checkout v2.

This event can be overridden if you want a notification when the payer cancels a payment attempt. This does not mean that the payer can’t attempt another payment, or switch to another payment method, just that they canceled one of their attempts.

If you do not override the event, no action will be done. This event is only provided for informational purposes.

This is the object that is provided if you override the event:

onPaymentAttemptAborted event object

1
2
3
4
5
{
    "event": "OnPaymentAttemptAborted",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "redirectUrl": "https://example.com/cancelled"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
redirectUrl string The URL the user will be redirected to after a cancelled payment.

onPaymentAttemptFailed

This event mirrors onPaymentTransactionFailed from Checkout v2.

This event can be overridden if you want a notification when a payment attempt has failed. An error message will also appear in the payment UI, where the payer can either try again or choose another payment method.

If you do not override the event, no action will be done. This event is only provided for informational purposes.

This is the object that is provided if you override the event:

onPaymentAttemptFailed event object

1
2
3
4
5
{
    "event": "OnPaymentAttemptFailed",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "details": "[HttpCode ProblemTitle]"
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
details string A human readable and descriptive text of the error.

onPaymentAttemptStarted

This event mirrors onPaymentCreated from Checkout v2.

This event can be overridden if you want a notification when a payment attempt is started. It contains the name of the payment method started.

If you do not override the event, no action will be done. This event is only provided for informational purposes.

This is the object that is provided if you override the event:

onPaymentAttemptStarted event object

1
2
3
4
5
{
    "event": "OnPaymentAttemptStarted",
    "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1" },
    "instrument": "creditcard",
}
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
instrument string Creditcard, vipps, swish, invoice. The payment method selected when initiating the payment.

onTermsOfServiceRequested

Triggered when the user clicks on the “Display terms and conditions” link.

This event mirrors onPaymentToS from Checkout v2.

This event can be ovrriden if you want to handle opening the termsOfServiceUrl on your own. This could be if you want to open it inside of a modal, inside of an iFrame on your own page or otherwise.

If you do not override the event, we will attempt to open up the termsOfServiceUrl inside of a new tab in the same browser, if possible.

This is the object that is provided if you override the event:

onTermsOfServiceRequested event object

1
2
3
4
5
{
     "event": "OnTermsOfServiceRequested",
     "paymentOrder": { "id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1"},
     "termsOfServiceUrl": "https://example.org/terms.html"
 }
Field Type Description
event string The name of the event raised.
paymentOrder.id string The relative URL and unique identifier of the paymentOrder resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
termsOfServiceUrl string The URL containing Terms of Service and conditions.