Swish

Seamless View Events

schedule 11 min read

Possible events during Seamless View payments.

Edit "Seamless View Events" on GitHub

Seamless View Events

During operation in the Seamless View, several events can occur. They are described below.

info

Event Overrides

Adding an event handler to one of the following events overrides the default event handler, meaning your custom event handler will have to do what the default event handler did. If you don’t, the behaviour of the event is going to be undefined. Just adding an event handler for logging purposes is therefore not possible, the event handler will have to perform some functionality similar to the event handler you are overriding.

onPaymentPending

This events triggers when a payment enters a paying state ( Sale, Authorize, Canceletc). The onPaymentPending event will be followed by either onPaymentCompleted, onPaymentFailed or onPaymentTransactionFailed based on the result of the payment. Read more about these events below.

onPaymentPending event object

1
2
3
{
    "id": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1"
}
Field Type Description
id string The relative URI and unique identifier of the payment resource . Please read about URI Usage to understand how this and other URIs should be used in your solution.

onPaymentCompleted

This event triggers when a payment has completed successfully. The onPaymentCompleted event is raised with the following event argument object:

onPaymentCompleted event object

1
2
3
4
{
    "id": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "redirectUrl": "https://example.com/complete"
}
Field Type Description
id string The relative URI and unique identifier of the payment resource . Please read about URI Usage to understand how this and other URIs should be used in your solution.
redirectUrl string The URI the user will be redirect to after a completed payment.

onPaymentCanceled

This event triggers when the user cancels the payment. The onPaymentCanceled event is raised with the following event argument object:

onPaymentCanceled event object

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

onPaymentFailed

This event triggers when a payment has failed, disabling further attempts to perform a payment. The onPaymentFailed event is raised with the following event argument object:

onPaymentFailed event object

1
2
3
4
{
    "id": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "redirectUrl": "https://example.com/failed"
}
Field Type Description
id string The relative URI and unique identifier of the payment resource . Please read about URI Usage to understand how this and other URIs should be used in your solution.
redirectUrl string The URI the user will be redirect to after a failed payment.

onPaymentToS

This event triggers when the user clicks on the “Display terms and conditions” link. The onPaymentToS event is raised with the following event argument object:

onPaymentToS event object

1
2
3
4
{
    "origin": "owner",
    "openUrl": "https://example.com/terms-of-service"
}
Field Type Description
origin string owner, merchant. The value is always merchant unless Swedbank Pay hosts the view.
openUrl string The URI containing Terms of Service and conditions.

onError

This event triggers during terminal errors or if the configuration fails validation. The onError event will be raised with the following event argument object:

onError event object

1
2
3
4
5
{
    "origin": "swish",
    "messageId": "ec2a9b09-601a-42ae-8e33-a5737e1cf177",
    "details": "Descriptive text of the error"
}
Field Type Description
origin string swish, identifies the system that originated the error.
messageId string A unique identifier for the message.
details string A human readable and descriptive text of the error.