Update Payment Order
If a payment is
attempted, failed or currently being processed, you will not be able to
update the orderItems
for the payment order. Should you need to update the
orderItems
, you will have to abort
the payment order and create a new order
with the updated orderItems
.
The UpdateOrder
operation is used when there is a change in the amount, vat
amount or there are added or removed order items in the payment order. This
feature is available in Seamless View only.
If you implement
UpdateOrder
you need to refresh()
the Payment Menu frontend after you have
called the UpdateOrder
API from the backend.
In case the shopping cart is changed in another browser tab, that should also
lead to an UpdateOrder
. On window.onfocus
in the tab that had Payment Menu
initialized, refresh()
should be invoked so the correct amount is authorized.
If the page is refreshed by a full page reload, refresh()
is not necessary.
The response given when changing a payment order is equivalent to a GET
request towards the paymentorders
resource. Even though the fields are the
same, the UpdateOrder
request will overwrite the fields that were sent in the
initial Purchase
request.
Request
1
2
3
PATCH /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce HTTP/1.1
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
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
{
"paymentorder": {
"operation": "UpdateOrder",
"amount": 1500,
"vatAmount": 375,
"orderItems": [
{
"reference": "P1",
"name": "Product1",
"type": "PRODUCT",
"class": "ProductGroup1",
"itemUrl": "https://example.com/shop/products/1234",
"imageUrl": "https://example.com/products/product1.jpg",
"description": "Product description",
"discountDescription": "Volume discount",
"quantity": 351.3514,
"quantityUnit": "pcs",
"unitPrice": 300,
"discountPrice": 200,
"vatPercent": 2500,
"amount": 1000,
"vatAmount": 250
},
{
"reference": "P2",
"name": "Product2",
"type": "PRODUCT",
"class": "ProductGroup1",
"description": "Product description",
"quantity": 9876.1531,
"quantityUnit": "pcs",
"unitPrice": 500,
"vatPercent": 2500,
"amount": 500,
"vatAmount": 125
}
]
}
}
paymentOrder
object
check
operation
string
check
Determines the initial operation, defining the type of payment order created. Possible options are Purchase, Abort Verify, UnscheduledPurchase, Recur and Payout.
amount
integer
check
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.
vatAmount
integer
check
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
check
orderItems
array
check
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.
reference
string
check
name
string
check
type
enum
check
PRODUCT
, SERVICE
, SHIPPING_FEE
, PAYMENT_FEE
, DISCOUNT
, VALUE_CODE
or OTHER
. The type of the order item.
class
string
check
MobilePhone
. Note that class
cannot contain spaces and must follow the regex pattern [\w-]*
. Swedbank Pay may use this field for statistics.
itemUrl
string
check
imageUrl
string
check
description
string
check
discountDescription
string
check
quantity
number
check
quantityUnit
string
check
pcs
, grams
, or similar. This is used for your own book keeping.
unitPrice
integer
check
discountPrice
integer
check
vatPercent
integer
check
25%
becomes 2500
.
amount
integer
check
10000
equals 100.00 NOK
and 500
0 equals 50.00 NOK
.
vatAmount
integer
check
10000
equals 100.00 NOK
and 500
0 equals 50.00 NOK
.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
payment
object
payment
object contains information about the specific payment.
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.
number
integer
The payment number
, useful when there’s need to reference the payment in human communication. Not usable for programmatic identification of the payment, where id
should be used instead.
created
string
updated
string
state
string
Ready
, Pending
, Failed
or Aborted
. Indicates the state of the payment, not the state of any transactions performed on the payment. To find the state of the payment's transactions (such as a successful authorization), see the transactions
resource or the different specialized type-specific resources such as authorizations
or sales
.
prices
object
prices
resource lists the prices related to a specific payment.
id
string
The relative URL and unique identifier of the prices
resource . Please read about URL Usage to understand how this and other URLs should be used in your solution.
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.
remainingCaptureAmount
integer
remainingCancelAmount
integer
remainingReversalAmount
integer
description
string(40)
A textual description of the purchase. Maximum length is 40 characters.
userAgent
string
The user agent of the payer. Should typically be set to the value of the User-Agent
header sent by the payer’s web browser.
language
string
sv-SE
, nb-NO
, da-DK
, en-US
or fi-FI
.
urls
string
payeeInfo
object
The payeeInfo
object, containing information about the payee (the recipient of the money). See payeeInfo
for details.
payers
string
payer
resource where the information about the payer can be retrieved.
operations
array
The array of operations that are possible to perform on the payment in its current state.