Digital Payments

Abort

Aborting a created payment or payment attempt.

Edit "Abort" on GitHub

Abort

To abort a payment order, perform the abort operation that is returned in the payment order response. You need to include the following in the request body:

Abort PATCH Request

Request

1
2
3
4
PATCH /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json;version=3.x/2.0      // Version optional for 3.0 and 2.0
1
2
3
4
5
6
7
{
{
  "paymentorder": {
    "operation": "Abort",
    "abortReason": "CancelledByConsumer"
  }
}
Field Type Description
paymentOrder object The payment order object.
operation string Abort
abortReason string CancelledByConsumer or CancelledByCustomer. Why the payment was aborted.

Abort PATCH Response

The response given when aborting a payment order is equivalent to a GET request towards the paymentorders resource, as displayed above, with its status set to Aborted.

Response

1
2
3
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8; version=3.x/2.0
api-supported-versions: 3.x/2.0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
    "paymentOrder": {
        "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd",
        "created": "2022-01-24T10:54:05.6243371Z",
        "updated": "2022-01-24T10:54:19.2679591Z",
        "operation": "Purchase",
        "status": "Aborted",
        "currency": "SEK",
        "amount": 32000,
        "vatAmount": 0,
        "description": "Abort test",
        "initiatingSystemUserAgent": "swedbankpay-sdk-dotnet/3.0.1",
        "language": "sv-SE",
        "availableInstruments": [
            "CreditCard",
            "Invoice-PayExFinancingSe",
            "Invoice-PayMonthlyInvoiceSe",
            "Swish",
            "CreditAccount",
            "Trustly"
        ],    
        "instrumentMode": false,
        "guestMode": false,
        "orderItems": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/orderitems"
        },
        "urls": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/urls"
        },
        "payeeInfo": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/payeeinfo"
        },
        "payer": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/payers"
        },
        "history": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/history"
        },
        "failed": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/failed"
        },
        "aborted": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/aborted"
        },
        "paid": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/paid"
        },
        "cancelled": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/cancelled"
        },
        "financialTransactions": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/financialtransactions"
        },
        "failedAttempts": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/failedattempts"
        },
        "metadata": {
            "id": "/psp/paymentorders/2c3f7a3e-65ca-4493-ac93-08d9dcb313fd/metadata"
        }
    },
    "operations": [  
    ]
}
Field Type Description
paymentOrder object The payment order object.
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.
created string The ISO-8601 date of when the payment order was created.
updated string The ISO-8601 date of when the payment order was updated.
operation string Purchase
status string Initialized, Paid, Failed, Cancelled or Aborted. Indicates the state of the payment order.
currency string The currency of the payment order.
amount integer The transaction amount (including VAT, if any) entered in the lowest monetary unit of the selected currency. E.g.: 10000 = 100.00 SEK, 5000 = 50.00 SEK. The amount displayed is the final amount the payer paid for their order, including any payment method specific discounts or fees.
vatAmount integer The payment’s VAT (Value Added Tax) amount, entered in the lowest monetary unit of the selected currency. E.g.: 10000 = 100.00 SEK, 5000 = 50.00 SEK. The vatAmount entered will not affect the amount shown on the payment page, which only shows the total amount. This field is used to specify how much of the total amount the VAT will be. Set to 0 (zero) if there is no VAT amount charged.
description string(40) A 40 character length textual description of the purchase.
initiatingSystemUserAgent string The user agent of the HTTP client making the request, reflecting the value sent in the User-Agent header with the initial POST request which created the Payment Order.
language string sv-SE, nb-NO, da-DK, en-US or fi-FI.
availableInstruments string A list of payment methods available for this payment.
implementation string The Digital Payments implementation type. Omit if the integration is for Payments Only.
integration string The merchant’s Digital Payments integration type. HostedView (Seamless View) or Redirect. This field will not be populated until the payer has opened the payment UI, and the client script has identified if Swedbank Pay or another URI is hosting the container with the payment iframe.
instrumentMode bool Set to true or false. Indicates if the payment is initialized with only one payment method available.
guestMode bool Set to true or false. Indicates if the payer chose to pay as a guest or not. When using the Enterprise implementation, this is triggered by not including a payerReference or nationalIdentifier in the original payment order request.
orderItems string The array of items being purchased with the order. Note that authorization orderItems will not be printed on invoices, so lines meant for print must be added in the Capture request. The authorization orderItems will, however, be used in the Merchant Portal when captures or reversals are performed, and might be shown other places later. It is required to use this field to be able to send Capture orderItems. Capture requests should only contain items meant to be captured from the order.
urls string The URL to the urls resource where information about the urls can be retrieved.
payeeInfo id The payeeInfo object, containing information about the payee (the recipient of the money). See payeeInfo for details.
payer id The URL to the payer resource where information about the payer can be retrieved.
history id The URL to the history resource where information about the payment’s history can be retrieved.
failed id The URL to the failed resource where information about the failed transactions can be retrieved.
aborted id The URL to the aborted resource where information about the aborted transactions can be retrieved.
paid id The URL to the paid resource whereinformation about the paid transactions, including any possibly created tokens,can be retrieved.
cancelled id The URL to the cancelled resource where information about the cancelled transactions can be retrieved.
financialTransactions id The URL to the financialTransactions resource where information about the financial transactions can be retrieved.
failedAttempts id The URL to the failedAttempts resource where information about the failed attempts can be retrieved.
metadata id The URL to the metadata resource where information about the metadata can be retrieved.
operations array The array of operations that are possible to perform on the payment order in its current state. See Operations for details.

Abort Payment Attempt

The abort-paymentattempt operation should be used when you want to abort a payment attempt, but not the whole payment order. It is returned in the payment order response, but is only available for Digital Payments v3.x. Include the following in the request body when perfoming it:

Abort Payment Attempt PATCH Request

Abort Payment Attempt PATCH Request

1
2
3
4
PATCH /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json;version=3.x
1
2
3
4
5
6
7
{
{
  "paymentorder": {
    "operation": "PaymentAttemptAborted",
    "abortReason": "AbortedByUI"
  }
}

Abort Payment Attempt PATCH Response

The response after doing this PATCH will appear as an initial payment order response, since the payment order is still active and re-attempts are possible.

To see traces of the aborted payment attempt, you need to perform the PATCH with history expanded. It will appear as shown below.

Abort Payment Attempt Response

1
2
3
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8; version=3.x
api-supported-versions: 3.x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{
    "paymentOrder": {
        "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72",
        "created": "2024-12-05T14:19:17.1687855Z",
        "updated": "2024-12-05T14:20:34.3940075Z",
        "operation": "Purchase",
        "status": "Initialized",
        "currency": "SEK",
        "amount": 15572,
        "vatAmount": 0,
        "description": "Abort Payment Attempt Example",
        "initiatingSystemUserAgent": "PostmanRuntime/7.43.0",
        "language": "sv-SE",
        "availableInstruments": [
            "CreditCard",
            "Invoice-PayExFinancingSe",
            "CarPay",
            "Swish",
            "CreditAccount-CreditAccountSe",
            "Trustly",
            "MobilePay"
        ],
        "viewableInstruments": [
            "Swish"
        ],
        "implementation": "PaymentsOnly",
        "integration": "Redirect",
        "instrumentMode": false,
        "guestMode": true,
        "urls": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/urls"
        },
        "payeeInfo": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/payeeinfo"
        },
        "payer": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/payers"
        },
        "history": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/history",
            "historyList": [
                {
                    "created": "2024-12-05T14:19:17.1687855Z",
                    "name": "PaymentCreated",
                    "initiatedBy": "Merchant"
                },
                {
                    "created": "2024-12-05T14:19:17.1687855Z",
                    "name": "PaymentInstrumentSet",
                    "instrument": "Swish",
                    "initiatedBy": "Merchant"
                },
                {
                    "created": "2024-12-05T14:19:26.5750791Z",
                    "name": "PaymentLoaded",
                    "initiatedBy": "System"
                },
                {
                    "created": "2024-12-05T14:19:37.7938659Z",
                    "name": "PaymentAttemptStarted",
                    "instrument": "Swish",
                    "prefill": false,
                    "initiatedBy": "Payer"
                },
                {
                    "created": "2024-12-05T14:20:34.3879102Z",
                    "name": "PaymentAttemptAborted",
                    "instrument": "Swish",
                    "initiatedBy": "Payer"
                }
            ]
        },
        "failed": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/failed"
        },
        "aborted": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/aborted"
        },
        "paid": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/paid"
        },
        "cancelled": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/cancelled"
        },
        "reversed": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/reversed"
        },
        "financialTransactions": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/financialtransactions"
        },
        "failedAttempts": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/failedattempts",
            "failedAttemptList": []
        },
        "postPurchaseFailedAttempts": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/postpurchasefailedattempts"
        },
        "metadata": {
            "id": "/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72/metadata"
        }
    },
    "operations": [
        {
            "method": "PATCH",
            "href": "https://api.stage.payex.com/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72",
            "rel": "update-order",
            "contentType": "application/json"
        },
        {
            "method": "PATCH",
            "href": "https://api.stage.payex.com/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72",
            "rel": "abort",
            "contentType": "application/json"
        },
        {
            "method": "PATCH",
            "href": "https://api.stage.payex.com/psp/paymentorders/c37b8e5f-65a0-4a19-351b-08dd143bbe72",
            "rel": "set-instrument",
            "contentType": "application/json"
        },
        {
            "method": "GET",
            "href": "https://ecom.stage.payex.com/checkout/ecf2299debe471b2ade9df0e47e997dd590a7da62de1af4b5f71fc935227e996?_tc_tid=e8653437c60e410ca3fd3150395b1156",
            "rel": "redirect-checkout",
            "contentType": "text/html"
        },
        {
            "method": "GET",
            "href": "https://ecom.stage.payex.com/checkout/client/ecf2299debe471b2ade9df0e47e997dd590a7da62de1af4b5f71fc935227e996?culture=sv-SE&_tc_tid=e8653437c60e410ca3fd3150395b1156",
            "rel": "view-checkout",
            "contentType": "application/javascript"
        },
        {
            "method": "GET",
            "href": "https://api.stage.payex.com/psp/paymentsessions/ecf2299debe471b2ade9df0e47e997dd590a7da62de1af4b5f71fc935227e996?_tc_tid=e8653437c60e410ca3fd3150395b1156",
            "rel": "view-paymentsession",
            "contentType": "application/json"
        }
    ]
}
Field Type Description
paymentOrder object The payment order object.
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.
created string The ISO-8601 date of when the payment order was created.
updated string The ISO-8601 date of when the payment order was updated.
operation string Purchase
status string Initialized, Paid, Failed, Cancelled or Aborted. Indicates the state of the payment order.
currency string The currency of the payment order.
amount integer The transaction amount (including VAT, if any) entered in the lowest monetary unit of the selected currency. E.g.: 10000 = 100.00 SEK, 5000 = 50.00 SEK. The amount displayed is the final amount the payer paid for their order, including any payment method specific discounts or fees.
vatAmount integer The payment’s VAT (Value Added Tax) amount, entered in the lowest monetary unit of the selected currency. E.g.: 10000 = 100.00 SEK, 5000 = 50.00 SEK. The vatAmount entered will not affect the amount shown on the payment page, which only shows the total amount. This field is used to specify how much of the total amount the VAT will be. Set to 0 (zero) if there is no VAT amount charged.
description string(40) A 40 character length textual description of the purchase.
initiatingSystemUserAgent string The user agent of the HTTP client making the request, reflecting the value sent in the User-Agent header with the initial POST request which created the Payment Order.
language string sv-SE, nb-NO, da-DK, en-US or fi-FI.
availableInstruments string A list of payment methods available for this payment.
viewableInstruments string A list of payment methods with viewable details for this payment.
implementation string The Digital Payments implementation type. Omit if the integration is for Payments Only.
integration string The merchant’s Digital Payments integration type. HostedView (Seamless View) or Redirect. This field will not be populated until the payer has opened the payment UI, and the client script has identified if Swedbank Pay or another URI is hosting the container with the payment iframe.
instrumentMode bool Set to true or false. Indicates if the payment is initialized with only one payment method available.
guestMode bool Set to true or false. Indicates if the payer chose to pay as a guest or not. When using the Enterprise implementation, this is triggered by not including a payerReference or nationalIdentifier in the original payment order request.
orderItems string The array of items being purchased with the order. Note that authorization orderItems will not be printed on invoices, so lines meant for print must be added in the Capture request. The authorization orderItems will, however, be used in the Merchant Portal when captures or reversals are performed, and might be shown other places later. It is required to use this field to be able to send Capture orderItems. Capture requests should only contain items meant to be captured from the order.
urls string The URL to the urls resource where information about the urls can be retrieved.
payeeInfo id The payeeInfo object, containing information about the payee (the recipient of the money). See payeeInfo for details.
payer id The URL to the payer resource where information about the payer can be retrieved.
history id The URL to the history resource where information about the payment’s history can be retrieved.
failed id The URL to the failed resource where information about the failed transactions can be retrieved.
aborted id The URL to the aborted resource where information about the aborted transactions can be retrieved.
paid id The URL to the paid resource whereinformation about the paid transactions, including any possibly created tokens,can be retrieved.
cancelled id The URL to the cancelled resource where information about the cancelled transactions can be retrieved.
financialTransactions id The URL to the financialTransactions resource where information about the financial transactions can be retrieved.
failedAttempts id The URL to the failedAttempts resource where information about the failed attempts can be retrieved.
metadata id The URL to the metadata resource where information about the metadata can be retrieved.
operations array The array of operations that are possible to perform on the payment order in its current state. See Operations for details.