Cancel
The cancellations
resource lists the cancellation transactions on a
specific payment.
Create cancellation transaction
To cancel a previously created payment, you must perform the cancel
operation
against the accompanying href
returned in the operations
list. You can only
cancel a payment - or part of a payment - which has not been captured yet.
Request
1
2
3
4
5
6
7
8
9
10
11
POST /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/cancellations HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json
{
"transaction": {
"description": "Test Cancellation"
"payeeReference": "ABC123"
}
}
Required | Field | Type | Description |
---|---|---|---|
check | transaction |
object |
The transaction object. |
check | └➔ description
|
string |
A textual description of why the transaction is cancelled. |
check | └➔ payeeReference
|
string(30) |
A unique reference from the merchant system. It is set per operation to ensure an exactly-once delivery of a transactional operation. See payeeReference for details. |
If the cancellation request succeeds, the response should be similar to the example below:
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
HTTP/1.1 200 OK
Content-Type: application/json
{
"payment": "/psp/paymentorders/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
"cancellation": {
"id": "/psp/paymentorders/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/cancellations/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
"transaction": {
"id": "/psp/paymentorders/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
"created": "2022-01-31T09:49:13.7567756Z",
"updated": "2022-01-31T09:49:14.7374165Z",
"type": "Cancellation",
"state": "Completed",
"number": 71100732065,
"amount": 1500,
"vatAmount": 375,
"description": "Test Cancellation",
"payeeReference": "AB123"
}
}
}
Property | Type | Description |
---|---|---|
payment |
string |
The relative URL of the payment this cancellation transaction belongs to. |
cancellation |
object |
The cancellation object, containing information about the cancellation transaction. |
└➔ id
|
string |
The relative URL of the cancellation transaction. |
└➔ transaction
|
object |
The transaction object, containing information about the current transaction. |
└─➔ id
|
string |
The relative URL of the current transaction resource. |
└─➔ created
|
string |
The ISO-8601 date and time of when the transaction was created. |
└─➔ updated
|
string |
The ISO-8601 date and time of when the transaction was updated. |
└─➔ type
|
string |
Indicates the transaction type. |
└─➔ state
|
string |
Initialized , Completed or Failed . Indicates the state of the transaction. |
└─➔ number
|
string |
The transaction number , useful when there’s need to reference the transaction in human communication. Not usable for programmatic identification of the transaction, for that id should be used instead. |
└─➔ 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. |
└─➔ 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 |
A human readable description of maximum 40 characters of the transaction. |
└─➔ payeeReference
|
string |
A unique reference from the merchant system. It is set per operation to ensure an exactly-once delivery of a transactional operation. See payeeReference for details. In Invoice Payments payeeReference is used as an invoice/receipt number, if the receiptReference is not defined. |
Cancel Sequence
Cancel can only be done on a authorized transaction. If you perform a cancel after doing a partial capture, you will cancel the remaining authorized amount.
sequenceDiagram
participant SwedbankPay as Swedbank Pay
Merchant->>SwedbankPay: POST < cancellation>
activate Merchant
activate SwedbankPay
SwedbankPay-->>Merchant: transaction resource
deactivate SwedbankPay
deactivate Merchant