Swish

Operations

The operations of the payments.

Edit "Operations" on GitHub

Operation paid-payment

The paid-payment operation confirms that the transaction has been successful and that the payment is completed.

A paid-payment operation looks like this:

`paid-payment` operation

1
2
3
4
5
6
{
   "href": "https://api.externalintegration.payex.com/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/paid",
   "rel": "paid-payment",
   "method": "GET",
   "contentType": "application/json"
}

To inspect the paid payment, you need to perform an HTTP GET request towards the operation’s href field. An example of the request and response is given below.

Request

1
2
3
4
GET /psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/paid HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

1
2
HTTP/1.1 200 OK
Content-Type: application/json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
    "payment": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "paid": {
        "id": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/paid",
        "number": 1234567890,
        "transaction": {
            "id": "/pspswish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions/",
            "number": 1234567891
        },
        "payeeReference": "CD123",
        "orderReference": "AB1234",
        "amount": 1500
    }
}
Field Type Description
payment string The relative URL and unique identifier of the payment resource this transaction belongs to. Please read about URL Usage to understand how this and other URLs should be used in your solution.
transaction string The object representation of the generic transaction resource, containing information about the current transaction.
id string The relative URL and unique identifier of the transaction resource this transaction belongs to. Please read about URL Usage to understand how this and other URLs should be used in your solution.
number integer The transaction number, useful when there’s need to reference the transaction in human communication. Not usable for programmatic identification of the transaction, where id should be used instead.
payeeReference string A unique reference from the merchant system. Set per operation to ensure an exactly-once delivery of a transactional operation. Length and content validation depends on whether the transaction.number or the payeeReference is sent to the acquirer. If Swedbank Pay handles the settlement, the transaction.number is sent and the payeeReference must be in the format of A-Za-z0-9 and string(30). If you handle the settlement, Swedbank Pay will send the payeeReference and it will be limited to the format of string(12). All characters must be digits.
orderReference string(50) The order reference, which should reflect the order reference found in the merchant’s systems.
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.
tokens integer A list of generated tokens.
details integer A human readable and descriptive text of the payment.
cardBrand string Visa, MC, etc. The brand of the card.
maskedPan string The masked PAN number of the card.
cardType string Credit Card or Debit Card. Indicates the type of card used for the authorization.
issuingBank string The name of the bank that issued the card used for the authorization.
countryCode string The country the card is issued in.
acquirerTransactionType string 3DSECURE or SSL. Indicates the transaction type of the acquirer.
acquirerStan string The System Trace Audit Number assigned by the acquirer to uniquely identify the transaction.
acquirerTerminalId string The ID of the acquirer terminal.
acquirerTransactionTime string The ISO-8601 date and time of the acquirer transaction.
nonPaymentToken string The result of our own card tokenization. Activated in POS for the merchant or merchant group.
externalNonPaymentToken string The result of an external tokenization. This value will vary depending on card types, acquirers, customers, etc. For Mass Transit merchants, transactions redeemed by Visa will be populated with PAR. For Mastercard and Amex, it will be our own token.

Operation failed-payment

The failed-payment operation means that something went wrong during the payment process. The transaction was not authorized, and no further transactions can be created if the payment is in this state.

A failed-payment operation looks like this:

`failed-payment` operation

1
2
HTTP/1.1 200 OK
Content-Type: application/json
1
2
3
4
5
6
{
   "href": "https://api.externalintegration.payex.com/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/failed",
   "rel": "failed-payment",
   "method": "GET",
   "contentType": "application/problem+json"
}

To inspect why the payment failed, you need to perform an HTTP GET request towards the operation’s href field.

The problem message can be found in details field. Under problems you can see which problem occurred, a description of the problem and the corresponding error code.

An example of the request and response is given below.

Response

1
2
HTTP/1.1 200 OK
Content-Type: application/json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
    "problem": {
        "type": "https://api.externalintegration.payex.com/psp/errordetail/swish/acquirererror",
        "title": "Operation failed",
        "status": 403,
        "detail":  "Unable to complete Authorization transaction, look at problem node!", 
        "problems": [
            {
                "name": "ExternalResponse",
                "description": "REJECTED_BY_ACQUIRER-unknown error, response-code: 51"
            }
        ]
    }
}

Operation aborted-payment

The aborted-payment operation means that the merchant aborted the payment before the payer fulfilled the payment process. You can see this under abortReason in the response.

An aborted-payment operation looks like this:

`aborted-payment` operation

1
2
HTTP/1.1 200 OK
Content-Type: application/json
1
2
3
4
5
6
{
    "href": "https://api.externalintegration.payex.com/psp/creditcard/payments/<paymentId>/aborted",
    "rel": "aborted-payment",
    "method": "GET",
    "contentType": "application/json"
}

To inspect why the payment was aborted, you need to perform an HTTP GET request towards the operation’s href field. An example of the request and response is given below.

Request

1
2
3
4
GET /psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/aborted HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

1
2
HTTP/1.1 200 OK
Content-Type: application/json
1
2
3
4
5
6
{
    "payment": "/psp/swish/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "aborted": {
        "abortReason": "Aborted by consumer"
    }
}