Swish

Problems

schedule 4 min read

Information when something goes wrong.

Edit "Problems" on GitHub

Problems

When performing operations against a resource in the Swedbank Pay API Platform, it will respond with a problem message that contain details of the error type if the request could not be successfully performed. Regardless of why the error occurred, the problem message will follow the same structure as specified in the Problem Details for HTTP APIs (RFC 7807) specification.

We generally use the problem message type and status code to identify the nature of the problem. The problems array contains objects with name and description that will often help narrow down the specifics of the problem, usually to the field in the request that was missing or contained invalid data.

The structure of a problem message will look like this:

Problem Example

1
2
3
4
5
6
7
8
9
10
11
{
    "type": "https://api.payex.com/psp/errordetail/<resource>/inputerror",
    "title": "There was an input error",
    "detail": "Please correct the errors and retry the request",
    "instance": "ec2a9b09-601a-42ae-8e33-a5737e1cf177",
    "status": 400,
    "problems": [{
        "name": "CreditCardParameters.Issuer",
        "description": "minimum one issuer must be enabled"
    }]
}
Field Type Description
type string The URL that identifies the error type. This is the only field usable for programmatic identification of the type of error! When dereferenced, it might lead you to a human readable description of the error and how it can be recovered from.
title string The title contains a human readable description of the error.
detail string A detailed, human readable description of the error and how you can recover from it.
instance string The identifier of the error instance. This might be of use to Swedbank Pay support personnel in order to find the exact error and the context it occurred in.
status integer The HTTP status code that the problem was served with.
action string The action indicates how the error can be recovered from.
problems array The array of problem detail objects.
└➔ name string The name of the field, header, object, entity or likewise that was erroneous.
└➔ description string The human readable description of what was wrong with the field, header, object, entity or likewise identified by name.

Common Problems

All common problem types will have a URL in the format https://api.payex.com/psp/errordetail/<error-type>. The URL is an identifier that you can hard-code and implement logic around. It is currently not not possible to dereference this URL, although that might be possible in the future.

Type Status Description
inputerror 400 The server cannot or will not process the request due to an apparent client error (e.g. malformed request syntax, size to large, invalid request).
forbidden 403 The request was valid, but the server is refusing the action. The necessary permissions to access the resource might be lacking.
notfound 404 The requested resource could not be found, but may be available in the future. Subsequent requests are permissible.
systemerror 500 A generic error message.
configurationerror 403 A error relating to configuration issues.

Swish Problems

There are a few problems specific to the swish resource that you may want to guard against in your integrations. All Swish problem types will have the following URL structure:

https://api.payex.com/psp/errordetail/<error-type>

inputerror

Caused By:

  • MSISDN is invalid.
  • Payer’s MSISDN is not enrolled at Swish.

Example response inputerror

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/inputerror",
    "title": "Input error",
    "status": 400,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "Msisdn is invalid."
}

configerror

Caused By:

  • Payee alias is missing or not correct.
  • PaymentReference is invalid.
  • Amount value is missing or not a valid number.
  • Amount is less than agreed minimum.
  • Amount value is too large.
  • Invalid or missing currency.
  • Wrong formatted message.
  • Amount value is too large, or amount exceeds the amount of the original payment minus any previous refunds.
  • Counterpart is not activated.
  • Payee not enrolled.

Example response configerror

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/configerror",
    "title": "Config error",
    "status": 403,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "Payee alias is missing or not correct."
}

swishdeclined

Caused By:

  • Original payment not found or original payment is more than than 13 months old.
  • It appears that merchant’s organization number has changed since sale was made.
  • The MSISDN of the original payer seems to have changed owner.
  • Transaction declined. Could be that the payer has exceeded their swish limit or have insufficient founds.
  • Payment request not cancellable.

Example response swishdeclined

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/swishdeclined",
    "title": "Swish Declined",
    "status": 403,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "The MSISDN of the original payer seems to have changed owner."
}

swisherror

Caused By:

  • Bank system processing error.
  • Swish timed out waiting for an answer from the banks after payment was started.

Example response swisherror

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 502 Bad Gateway
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/swisherror",
    "title": "Error in Swish",
    "status": 502,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "Bank system processing error."
}

swishalreadyinuse

Caused By:

  • The payer’s Swish is already in use.

Example response swishalreadyinuse

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/swishalreadyinuse",
    "title": "Error in Swish",
    "status": 403,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "The payer's Swish is already in use."
}

swishtimeout

Caused By:

  • Swish timed out before the payment was started.

Example response swishtimeout

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/swishtimeout",
    "title": "Swish Timed Out",
    "status": 403,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "Swish timed out before the payment was started."
}

bankidcancelled

Caused By:

  • The payer cancelled BankID authorization.

Example response bankidcancelled

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 409 Conflict
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/bankidcancelled",
    "title": "BankID Authorization Cancelled",
    "status": 409,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "The payer cancelled BankID authorization."
}

bankidalreadyinuse

Caused By:

  • The payer’s BankID is already in use

Example response bankidalreadyinuse

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 409 Conflict
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/bankidalreadyinuse",
    "title": "BankID Already in Use",
    "status": 409,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "The payer's BankID is already in use."
}

bankiderror

Caused By:

  • Something went wrong with the payer’s BankID authorization.

Example response bankiderror

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 502 Bad Gateway
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/bankiderror",
    "title": "BankID error",
    "status": 502,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "Something went wrong with the payer's BankID authorization."
}

socialsecuritynumbermismatch

Caused By:

  • The payer’s social security number does not match with the one required by this payment.

Example response socialsecuritynumbermismatch

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/socialsecuritynumbermismatch",
    "title": "Social Security Number Mismatch",
    "status": 403,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "The payer's social security number does not match with the one required by this payment."
}

paymentagelimitnotmet

Caused By:

  • The payer does not meet the payment’s age limit.

Example response paymentagelimitnotmet

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/paymentagelimitnotmet",
    "title": "Payment Age Limit Not Met",
    "status": 403,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "The payer does not meet the payment's age limit."
}

usercancelled

Caused By:

  • The payer cancelled the payment in the Swish app.

Example response usercancelled

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/usercancelled",
    "title": "User Cancelled",
    "status": 403,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "The payer cancelled the payment in the Swish app."
}

swishgatewaytimeout

Caused By:

  • During a create a sale call to e-com, Swish responded with 504 (Gateway Timeout).

Example response swishgatewaytimeout

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 504 Gateway Timeout
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/swishgatewaytimeout",
    "title": "Swish Gateway Timeout",
    "status": 504,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "Request to Swish timed out."
}

systemerror

Example response systemerror

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 500 Internal Server Error
Content-Type: application/json

{
    "sessionId": "570ad610-3bd5-43d2-a270-ca1510562972",
    "type": "https://api.payex.com/psp/errordetail/systemerror",
    "title": "Error in System",
    "status": 500,
    "instance": "https://api.payex.com/psp/swish/payments/0cf55e0f-9931-476b-249d-08d7a3ee4e14/sales",
    "detail": "A system error occurred. We are working on it."
}