Seamless View Events
During operation in the Seamless View, several events can occur. They are described below.
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 behavior 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.
onApplicationConfigured
This event triggers whenever a reconfiguration leads to resizing of the payment
menu. No action will be done if callback is not set. The
onApplicationConfigured
event is raised with the following event argument
object:
onApplicationConfigured event object
1
2
3
{
"details": "source: "PaymentMenuClient", bodyHeight: "[clientHeight of iframe content]""
}
Field | Type | Description |
---|---|---|
details |
string |
The source of the reconfiguration, and the new height of the iframe. |
onBillingDetailsAvailable
This event triggers when a consumer has been identified. The
onBillingDetailsAvailable
event will be raised with the following event
argument object:
onBillingDetailsAvailable event object
1
2
3
4
{
"actionType": "OnBillingDetailsAvailable",
"url": "/psp/consumers//billing-details",
}
Field | Type | Description |
---|---|---|
actionType |
string |
The type of event that was raised. |
url |
string |
The URL containing billing details. |
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": "invoice",
"id": "/psp/paymentorders/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"details": "English descriptive text of the error"
}
Field | Type | Description |
---|---|---|
origin |
string |
invoice , identifies the system that originated the error. |
id |
string |
The relative URL and unique identifier of the payment 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. |
onExternalRedirect
This event triggers when a user is redirected to a separate web page, like 3D-Secure or BankID signing.
Subscribe to this event if it’s not possible to redirect the payer directly from within Swedbank Pay’s payment frame.
If no callback method is set, you will be redirected to the relevant url. It will be raised with the following event argument object:
onExternalRedirect event object
1
2
3
4
5
{
"event": "OnExternalRedirect",
"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 |
string |
The relative URL and unique identifier of the payment 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. |
onPaymentAborted
This event triggers when the user cancels the payment.
The onPaymentAborted
event is raised with the following event argument
object:
onPaymentAborted event object
1
2
3
4
{
"id": "/psp/invoicepayments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"redirectUrl": "https://example.com/cancelled"
}
Field | Type | Description |
---|---|---|
id |
string |
The relative URL and unique identifier of the payment 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. |
onPaymentCanceled
This event triggers when the payer aborts the purchase from the payment menu. As the Seamless View payment menu doesn’t have a cancel button (present in the Redirect integration), you need to provide this button for the payer at your end. When the payer presses the cancel button, we recommend sending an API request aborting the payment so it can’t be completed at a later time. When we receive the request, an abort event will be raised the next time the UI fetches information from the server. Because of that, you should also refresh after aborting, as this will trigger the event.
It will be raised with the following event argument object:
onPaymentCanceled event object
1
2
3
4
5
{
"event": "OnPaymentCanceled",
"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 |
string |
The relative URL and unique identifier of the payment 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. |
onPaymentCompleted
This event triggers when the payer successfully completes or cancels the payment.
Subscribe to this event if actions are needed on you side other than the default
handling of redirecting the payer to your completeUrl
. Call GET on the
paymentOrder
to receive the actual payment status, and take appropriate
actions according to it.
It will be raised with the following event argument object:
onPaymentCompleted event object
1
2
3
4
5
{
"event": "OnPaymentCompleted",
"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 |
string |
The relative URL and unique identifier of the payment 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 completing the payment. |
onPaymentCreated
Triggered when the payer has selected a payment instrument and actively attempts to perform a payment.
The onPaymentCreated
event is raised with the following event argument object:
onPaymentCreated event object
1
2
3
4
{
"id": "/psp/invoice/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"instrument": "creditcard",
}
Field | Type | Description |
---|---|---|
id |
string |
The relative URL and unique identifier of the payment 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 instrument selected when initiating the payment. |
onPaymentFailed
Triggered 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/invoice/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"redirectUrl": "https://example.com/failed"
}
Field | Type | Description |
---|---|---|
id |
string |
The relative URL and unique identifier of the payment 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 failed payment. |
onPaymentInstrumentSelected
This event triggers when a user actively changes payment instrument in the Payment Menu.
Subscribe to this event if actions, e.g. showing an information text, are required on your side if the payer changes payment instrument.
If no callback method is set, no handling action will be done. It will be raised with the following event argument object:
onPaymentInstrumentSelected event object
1
2
3
4
5
{
"event": "OnPaymentInstrumentSelected",
"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 |
string |
The relative URL and unique identifier of the payment 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 instrument selected by |
the user. |
onPaymentPaid
This event triggers when a payment has completed successfully.
The onPaymentPaid
event is raised with the following event argument
object:
onPaymentPaid event object
1
2
3
4
{
"id": "/psp/invoice/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"redirectUrl": "https://example.com/complete"
}
Field | Type | Description |
---|---|---|
id |
string |
The relative URL and unique identifier of the payment 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 completed payment. |
onPaymentPending
Triggered when a payment enters a paying state ( Sale
, Authorize
, Cancel
, etc).
Read more about these events below.
onPaymentPending event object
1
2
3
{
"id": "/psp/invoice/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1"
}
Field | Type | Description |
---|---|---|
id |
string |
The relative URL and unique identifier of the payment resource . Please read about URL Usage to understand how this and other URLs should be used in your solution. |
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 URL containing Terms of Service and conditions. |
onPaymentTransactionFailed
This event triggers when a payment attempt fails, further attempts can be made for the payment.
An error message will appear in the payment UI, and the payer will be able to
try again or choose another payment instrument. The onPaymentTransactionFailed
event is raised with the following event argument object:
onPaymentTransactionFailed event object
1
2
3
4
{
"id": "/psp/invoice/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"details": "[HttpCode ProblemTitle]"
}
Field | Type | Description |
---|---|---|
id |
string |
The relative URL and unique identifier of the payment 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. |
onShippingDetailsAvailable
This event triggers when a consumer has been identified or their shipping
address has been updated. The onShippingDetailsAvailable
event will be raised
with the following event argument object:
onShippingDetailsAvailable event object
1
2
3
4
{
"actionType": "OnShippingDetailsAvailable",
"url": "/psp/consumers//shipping-details",
}
Field | Type | Description |
---|---|---|
actionType |
string |
The type of event that was raised. |
url |
string |
The URL containing shipping details. |
Updating Payment Menu
When the contents of the shopping cart changes or anything else that affects
the amount occurs, the paymentorder
must be updated and the Payment Menu
must be refresh
ed.