Swedbank Pay Checkout – Other Features

After a successful integration, it may be worth investigating which other features are available in Swedbank Pay Checkout. They are listed on this very page.

Payment Orders

The paymentorders resource is used when initiating a payment process through Payment Menu and Swedbank Pay Checkout. The payment order is a container for the payment instrument object selected by the payer. This will generate a payment that is accessed through the sub-resources payments and currentPayment.

Request

GET /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/ HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "paymentorder": {
        "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
        "created": "2018-09-14T13:21:29.3182115Z",
        "updated": "2018-09-14T13:21:57.6627579Z",
        "operation": "Purchase",
        "state": "Ready",
        "currency": "SEK",
        "amount": 1500,
        "vatAmount": 0,
        "remainingCaptureAmount": 1500,
        "remainingCancellationAmount": 1500,
        "remainingReversalAmount": 0,
        "description": "Test Purchase",
        "initiatingSystemUserAgent": "PostmanRuntime/3.0.1",
        "userAgent": "Mozilla/5.0...",
        "language": "nb-NO",
        "urls" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/urls" },
        "payeeInfo" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payeeinfo" },
        "settings": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/settings" },
        "payers": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payers" },
        "orderItems" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/orderItems" },
        "metadata": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/metadata" },
        "payments": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payments" },
        "currentPayment": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/currentpayment" }
    },
    "operations": [
        {
            "method": "PATCH",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
            "rel": "update-paymentorder-abort",
            "contentType": "application/json"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065",
            "rel": "redirect-paymentorder",
            "contentType": "text/html"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/core/scripts/client/px.paymentmenu.client.js?token=afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065&culture=nb-NO",
            "rel": "view-paymentorder",
            "contentType": "application/javascript"
        }
    ]
}
Property Type Description
paymentorder object The payment order object.
└➔ id string The relative URI to the payment order.
└➔ 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
└➔ state string Ready, Pending, Failed or Aborted. Indicates the state of the payment order. Does not reflect the state of any ongoing payments initiated from the payment order. This field is only for status display purposes.
└➔ currency string The currency of the payment order.
└➔ amount integer The amount including VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK, a 5000 quals 50.00 NOK.
└➔ vatAmount integer The amount of VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK and 5000 equals 50.00 NOK.
└➔ description string(40) A textual description of maximum 40 characters of the purchase.
└➔ userAgent string The user agent string of the consumer’s browser.
└➔ language string nb-NO, sv-SE or en-US
└➔ urls string The URI to the urls resource where all URIs related to the payment order can be retrieved.
└➔ payeeInfo string The URI to the payeeinfo resource where the information about the payee of the payment order can be retrieved.
└➔ payers string The URI to the payers resource where information about the payee of the payment order can be retrieved.
└➔ orderItems string The URI to the orderItems resource where information about the order items can be retrieved.
└➔ metadata string The URI to the payments resource where information about all underlying payments can be retrieved.
└➔ payments string The URI to the payments resource where information about all underlying payments can be retrieved.
└➔ currentPayment string The URI to the currentPayment resource where information about the current – and sole active – payment can be retrieved.
└➔ operations array The array of possible operations to perform, given the state of the payment order. See Operations for details.

Creating a payment order

To create a payment order, you perform a POST request towards the paymentorders resource:

Request

POST /psp/paymentorders HTTP/1.1
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
    "paymentorder": {
        "operation": "Purchase",
        "currency": "SEK",
        "amount": 1500,
        "vatAmount": 375,
        "description": "Test Purchase",
        "userAgent": "Mozilla/5.0...",
        "language": "sv-SE",
        "generateRecurrenceToken": false,
        "disablePaymentMenu": false,
        "restrictedToInstruments": ["creditCard", "invoice"],
        "urls": {
            "hostUrls": ["https://example.com", "https://example.net"],
            "completeUrl": "https://example.com/payment-completed",
            "cancelUrl": "https://example.com/payment-canceled",
            "paymentUrl": "https://example.com/perform-payment",
            "callbackUrl": "https://api.example.com/payment-callback",
            "termsOfServiceUrl": "https://example.com/termsandconditoons.pdf",
            "logoUrl": "https://example.com/logo.png"
        },
        "payeeInfo": {
            "payeeId": "5cabf558-5283-482f-b252-4d58e06f6f3b"
            "payeeReference": "CD1234",
            "payeeName": "Merchant1",
            "productCategory": "A123",
            "orderReference" : "or-123456",
            "subsite": "Subsite1"
        },
        "payer": {
            "consumerProfileRef": "7d5788219e5bc43350e75ac633e0480ab30ad20f96797a12b96e54da869714c4",
        },
        "orderItems": [
            {
                "reference": "P1",
                "name": "Product1",
                "type": "PRODUCT",
                "class": "ProductGroup1",
                "itemUrl": "https://example.com/products/123",
                "imageUrl": "https://example.com/product123.jpg",
                "description": "Product 1 description",
                "discountDescription": "Volume discount",
                "quantity": 4,
                "quantityUnit": "pcs",
                "unitPrice": 300,
                "discountPrice": 200,
                "vatPercent": 2500,
                "amount": 1000,
                "vatAmount": 250
            },
            {
                "reference": "P2",
                "name": "Product2",
                "type": "PRODUCT",
                "class": "ProductGroup1",
                "description": "Product 2 description",
                "quantity": 1,
                "quantityUnit": "pcs",
                "unitPrice": 500,
                "vatPercent": 2500,
                "amount": 500,
                "vatAmount": 125
            }
        ],
        "metadata": {
            "key1": "value1",
            "key2": 2,
            "key3": 3.1,
            "key4": false
        },
        "items": [
            {
                "creditCard": {
                    "rejectCreditCards": false,
                    "rejectDebitCards": false,
                    "rejectConsumerCards": false,
                    "rejectCorporateCards": false,
                    "no3DSecureForStoredCards": false,
                    "noCvcForStoredCards": false
                }
            },
            {
                "invoice": {
                    "feeAmount": 1900
                }
            },
            {
                "swish": {
                    "enableEcomOnly": false
                }
            }
        ]
    }
}
Required Property Type Description
✔︎︎︎︎︎ paymentorder object The payment order object.
✔︎︎︎︎︎ └➔ operation string The operation that the payment order is supposed to perform.
✔︎︎︎︎︎ └➔ currency string The currency of the payment.
✔︎︎︎︎︎ └➔ amount integer The amount including VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.
✔︎︎︎︎︎ └➔ vatAmount integer The amount of VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.
✔︎︎︎︎︎ └➔ description string The description of the payment order.
✔︎︎︎︎︎ └➔ userAgent string The user agent of the payer.
✔︎︎︎︎︎ └➔ language string The language of the payer.
✔︎︎︎︎︎ └➔ generateRecurrenceToken bool Determines if a recurrence token should be generated. A recurrence token is primarily used to enable future recurring payments - with the same token - through server-to-server calls. Default value is false
  └➔ restrictedToInstruments array Limits the options available to the consumer in the payment menu. Default value is all supported payment instruments. Usage of parameter requires special agreement with Swedbank.
✔︎︎︎︎︎ └➔ urls object The object containing the payee’s (such as the webshop or merchant) URLs that are relevant for this payment order. See URLs for details.
✔︎︎︎︎︎ └➔ payeeInfo object The object containing information about the payee.
✔︎︎︎︎︎ └─➔ payeeId string The ID of the payee, usually the merchant ID.
✔︎︎︎︎︎ └─➔ 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.
  └─➔ payeeName string The name of the payee, usually the name of the merchant.
  └─➔ productCategory string A product category or number sent in from the payee/merchant. This is not validated by Swedbank Pay, but will be passed through the payment process and may be used in the settlement process.
  └─➔ orderReference string(50) The order reference should reflect the order reference found in the merchant’s systems.
  └─➔ subsite string(40) The subsite field can be used to perform split settlement on the payment. The subsites must be resolved with Swedbank Pay reconciliation before being used.
  └➔ payer string The consumer profile reference as obtained through the Consumers API.
  └─➔ consumerProfileRef string The consumer profile reference as obtained through the Consumers API.
  └➔ orderItems array The array of items being purchased with the order. Used to print on invoices if the payer chooses to pay with invoice, among other things. See Order Items for details.
  └➔ metadata object The keys and values that should be associated with the payment order. Can be additional identifiers and data you want to associate with the payment.
  └➔ items array The array of items that will affect how the payment is performed.
  └➔ disablePaymentMenu boolean If set to true, disables the frame around the payment menu. Usefull when only showing one payment instrument.
  └➔ no3DSecureForStoredCards boolean true if 3-D Secure should be disabled for this payment in the case a stored card is used; otherwise false per default. To use this feature it has to be enabled on the contract with Swedbank Pay.
  └➔ noCvcForStoredCards boolean true if the CVC field should be disabled for this payment in the case a stored card is used; otherwise false per default. To use this feature it has to be enabled on the contract with Swedbank Pay.

Response

The response given when creating a payment order is equivalent to a GET request towards the paymentorders resource, as displayed above

URLs

When creating a Payment Order, the urls property of the paymentOrder contains the related URIs, including where the consumer gets redirected when going forward with or cancelling a payment session, as well as the callback URI that is used to inform the payee (merchant) of changes or updates made to underlying payments or transaction.

Required Property Type Description
✔ ︎︎︎︎︎ hostUrls array The array of URIs valid for embedding of Swedbank Pay Hosted Views.
✔︎︎︎︎︎ completeUrl string The URL that Swedbank Pay will redirect back to when the payer has completed his or her interactions with the payment. This does not indicate a successful payment, only that it has reached a final (complete) state. A GET request needs to be performed on the payment order to inspect it further.
✔︎︎︎︎︎ termsOfServiceUrl string The URI to the terms of service document the payer must accept in order to complete the payment. HTTPS is a requirement.
  cancelUrl string The URI to redirect the payer to if the payment is canceled, either by the payer or by the merchant trough an abort request of the payment or paymentorder.
  paymentUrl string The URI that Swedbank Pay will redirect back to when the payment menu needs to be loaded, to inspect and act on the current status of the payment.
  callbackUrl string The URI to the API endpoint receiving POST requests on transaction activity related to the payment order.
  logoUrl string The URI to the logo that will be displayed on redirect pages. HTTPS is a requirement.

Payment Url

For our Seamless Views, the property called paymentUrl will be used when the consumer is redirected out of the Seamless View (the iframe). The consumer is redirected out of frame when selecting the payment instrument Vipps or in the 3-D Secure verification for Credit Card Payments.

The URL should represent the page of where the Payment Order Seamless View was hosted originally, such as the checkout page, shopping cart page, or similar. Basically, paymentUrl should be set to the same URL as that of the page where the JavaScript for the Seamless View was added to in order to initiate the payment process.

info

Please note that the paymentUrl must be able to invoke the same JavaScript URL from the same Payment Order as the one that initiated the payment process originally, so it should include some sort of state identifier in the URL. The state identifier is the ID of the order, shopping cart or similar that has the URL of the Payment stored.

With paymentUrl in place, the retry process becomes much more convenient for both the integration and the payer.

URLs Resource

It is possible to perform a GET request on the urls resource to retrieve its contents.

Request

GET /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/urls/ HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "paymentorder": "/psp/payments/09ccd29a-7c4f-4752-9396-12100cbfecce",
    "urls": {
        "id": "/psp/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/urls",
        "hostUrls": [ "https://example.com", "http://example.net" ],
        "completeUrl": "http://example.com/payment-complete",
        "cancelUrl": "http://example.com/payment-canceled",
        "paymentUrl": "http://example.com/perform-payment",
        "callbackUrl": "http://api.example.com/payment-callback",
        "logoUrl": "http://merchant.com/path/to/logo.png",
        "termsOfServiceUrl": "http://merchant.com/path/to/tems"
    }
}
Property Type Description
paymentorder string The URI to the payment order the resource belong to.
urls object The URLs object.
└➔ id string The relative URI to the urls resource.
└➔ hostsUrl string An array of the whitelisted URIs that are allowed as parents to a Hosted View, typically the URI of the web shop or similar that will embed a Hosted View within it.
└➔ completeUrl string The URL that Swedbank Pay will redirect back to when the payer has completed his or her interactions with the payment. This does not indicate a successful payment, only that it has reached a final (complete) state. A GET request needs to be performed on the payment order to inspect it further.
└➔ cancelUrl string The URI to redirect the payer to if the payment is canceled, either by the payer or by the merchant trough an abort request of the payment or paymentorder.
└➔ paymentUrl string The URI that Swedbank Pay will redirect back to when the payment menu needs to be loaded, to inspect and act on the current status of the payment.
└➔ callbackUrl string The URI that Swedbank Pay will perform an HTTP POST against every time a transaction is created on the payment. See callback for details.
└➔ logoUrl string The URI that will be used for showing the customer logo. Must be a picture with at most 50px height and 400px width.
└➔ termsOfServiceUrl string A URI that contains your terms and conditions for the payment, to be linked on the payment page.

Order Items

The orderItems property of the paymentOrder is an array containing the items being purchased with the order. Used to print on invoices if the payer chooses to pay with invoice, among other things. Order items can be specified on both payment order creation as well as on Capture.

info

orderItems must be a part of Capture if orderItems is included in the paymentOrder creation.

Required Property Type Description
✔︎︎︎︎︎ reference string A reference that identifies the order item.
✔︎︎︎︎︎ name string The name of the order item.
✔︎︎︎︎︎ type string PRODUCT, SERVICE, SHIPPING_FEE, DISCOUNT, VALUE_CODE, or OTHER. The type of the order item.
✔︎︎︎︎︎ class string The classification of the order item. Can be used for assigning the order item to a specific product category, such as MobilePhone. Note that class cannot contain spaces. Swedbank Pay may use this field for statistics.
  itemUrl string The URL to a page that can display the purchased item, such as a product page
  imageUrl string The URL to an image of the order item.
  description string The human readable description of the order item.
  discountDescription string The human readable description of the possible discount.
✔︎︎︎︎︎ quantity decimal The 4 decimal precision quantity of order items being purchased.
✔︎︎︎︎︎ quantityUnit string The unit of the quantity, such as pcs, grams, or similar.
✔︎︎︎︎︎ unitPrice integer The price per unit of order item, including VAT.
  discountPrice integer If the order item is purchased at a discounted price. This property should contain that price, including VAT.
✔︎︎︎︎︎ vatPercent integer The percent value of the VAT multiplied by 100, so 25% becomes 2500.
✔︎︎︎︎︎ amount integer The total amount including VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.
✔︎︎︎︎︎ vatAmount integer The total amount of VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.

Items

The items property of the paymentOrder is an array containing items that will affect how the payment is performed.

Required Property Type Description
  creditCard object The credit card object.
  └➔ rejectDebitCards bool true if debit cards should be declined; otherwise false per default. Default value is set by Swedbank Pay and can be changed at your request.
  └➔ rejectDebitCards bool true if debit cards should be declined; otherwise false per default. Default value is set by Swedbank Pay and can be changed at your request.
  └➔ rejectCreditCards bool true if credit cards should be declined; otherwise false per default. Default value is set by Swedbank Pay and can be changed at your request.
  └➔ rejectConsumerCards bool true if consumer cards should be declined; otherwise false per default. Default value is set by Swedbank Pay and can be changed at your request.
  └➔ rejectCorporateCards bool true if corporate cards should be declined; otherwise false per default. Default value is set by Swedbank Pay and can be changed at your request.
  invoice object The invoice object.
  └➔ feeAmount integer The fee amount in the lowest monetary unit to apply if the consumer chooses to pay with invoice.
  swish object The swish object.
  └➔ enableEcomOnly bool true to only enable Swish on ecommerce transactions.

The paymentOrders resource utilize several sub-resources, relating to underlying payments, the current payment active, payers and URLs. Common sub-resources like payeeinfo, that are structurally identical for both payments and payments orders, are described in the Payment Resources section.

Operations

When a payment order resource is created and during its lifetime, it will have a set of operations that can be performed on it. The state of the payment order resource, what the access token is authorized to do, the chosen payment instrument and its transactional states, etc. determine the available operations before the initial purchase. A list of possible operations and their explanation is given below.

Operations

{
    "paymentOrder": {
        "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
    }
    "operations": [
        {
            "method": "PATCH",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
            "rel": "update-paymentorder-abort",
            "contentType": "application/json"
        },
        {
            "method": "PATCH",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
            "rel": "update-paymentorder-updateorder",
            "contentType": "application/json"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065",
            "rel": "redirect-paymentorder",
            "contentType": "text/html"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/core/scripts/client/px.paymentmenu.client.js?token=afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065&culture=nb-NO",
            "rel": "view-paymentorder",
            "contentType": "application/javascript"
        },
        {
            "method": "POST",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/captures",
            "rel": "create-paymentorder-capture",
            "contentType": "application/json"
        },
        {
            "method": "POST",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/cancellations",
            "rel": "create-paymentorder-cancel",
            "contentType": "application/json"
        },
        {
            "method": "POST",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/reversals",
            "rel": "create-paymentorder-reversal",
            "contentType": "application/json"
        }
    ]
}
Property Type Description
href string The target URI to perform the operation against.
rel string The name of the relation the operation has to the current resource.
method string GET, PATCH, POST, etc. The HTTP method to use when performing the operation.
contentType string The HTTP content type of the resource referenced in the href property.

The operations should be performed as described in each response and not as described here in the documentation. Always use the href and method as specified in the response by finding the appropriate operation based on its rel value. The only thing that should be hard coded in the client is the value of the rel and the request that will be sent in the HTTP body of the request for the given operation.

Operation Description
update-paymentorder-abort Aborts the payment order before any financial transactions are performed.
update-paymentorder-updateorder Updates the order with a change in the amount and/or vatAmount.
redirect-paymentorder Contains the URI that is used to redirect the consumer to the Swedbank Pay Payments containing the Payment Menu.
view-paymentorder Contains the JavaScript href that is used to embed the Payment Menu UI directly on the webshop/merchant site.
create-paymentorder-capture The second part of a two-phase transaction where the authorized amount is sent from the payer to the payee. It is possible to do a part-capture on a subset of the authorized amount. Several captures on the same payment are possible, up to the total authorization amount.
create-paymentorder-cancel Used to cancel authorized and not yet captured transactions. If a cancellation is performed after doing a part-capture, it will only affect the not yet captured authorization amount.
create-paymentorder-reversal Used to reverse a payment. It is only possible to reverse a payment that has been captured and not yet reversed.

View Payment Order

The view-paymentorder operation contains the URI of the JavaScript that needs to be set as a script element’s src attribute, either client-side through JavaScript or server-side in HTML as shown below.

<!DOCTYPE html>
<html>
    <head>
        <title>Swedbank Pay Checkout is Awesome!</title>
    </head>
    <body>
        <div id="checkout"></div>
        <script src="https://ecom.externalintegration.payex.com/paymentmenu/core/scripts/client/px.paymentmenu.client.js?token=afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065&culture=nb-NO"></script>
        <script language="javascript">
            payex.hostedView.paymentMenu({
                container: 'checkout',
                culture: 'nb-NO',
                onPaymentCompleted: function(paymentCompletedEvent) {
                    console.log(paymentCompletedEvent);
                },
                onPaymentFailed: function(paymentFailedEvent) {
                    console.log(paymentFailedEvent);
                },
                onPaymentCreated: function(paymentCreatedEvent) {
                    console.log(paymentCreatedEvent);
                },
                onPaymentToS: function(paymentToSEvent) {
                    console.log(paymentToSEvent);
                },
                onPaymentMenuInstrumentSelected: function(paymentMenuInstrumentSelectedEvent) {
                    console.log(paymentMenuInstrumentSelectedEvent);
                },
                onError: function(error) {
                    console.error(error);
                },
            }).open();
        </script>
    </body>
</html>

Update Order

Change amount and vat amount on a payment order. If you implement UpdateOrder you need to refresh() the Payment Menu front end so the new amount is shown to the end customer.

Request

PATCH /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce HTTP/1.1
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
    "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
            }
        ]
    }
}

Response

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "paymentorder": {
        "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
        "created": "2018-09-14T13:21:29.3182115Z",
        "updated": "2018-09-14T13:21:57.6627579Z",
        "operation": "Purchase",
        "state": "Ready",
        "currency": "SEK",
        "amount": 1500,
        "vatAmount": 0,
        "remainingCaptureAmount": 1500,
        "remainingCancellationAmount": 1500,
        "remainingReversalAmount": 0,
        "description": "Test Purchase",
        "initiatingSystemUserAgent": "PostmanRuntime/3.0.1",
        "userAgent": "Mozilla/5.0...",
        "language": "nb-NO",
        "urls" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/urls" },
        "payeeInfo" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payeeinfo" },
        "settings": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/settings" },
        "payers": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payers" },
        "orderItems" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/orderItems" },
        "metadata": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/metadata" },
        "payments": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payments" },
        "currentPayment": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/currentpayment" }
    },
    "operations": [
        {
            "method": "PATCH",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
            "rel": "update-paymentorder-abort",
            "contentType": "application/json"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065",
            "rel": "redirect-paymentorder",
            "contentType": "text/html"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/core/scripts/client/px.paymentmenu.client.js?token=afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065&culture=nb-NO",
            "rel": "view-paymentorder",
            "contentType": "application/javascript"
        }
    ]
}

The response given when changing a payment order is equivalent to a GET request towards the paymentorders resource, as displayed above.

info

After updating the Payment Order, remember to call .refresh() on the Payment Menu in JavaScript.

Capture

Capture can only be done on a payment with a successful authorized transaction, and if the authorization was not done on a one-phase payment instrument. Examples of one-phase payment instruments are Swish and Vipps, while payment instruments such as Credit Card are two-phase payments, requiring a Capture to be performed.

It is possible to do a part-capture where you only capture a smaller amount than the authorized amount. You can later do more captures on the same payment up to the total authorization amount.

This is done by requesting the order information from the server, to get the request link to perform the capture. With this, you can request the capture with the sum to capture, and get back the status.

sequenceDiagram
    participant Merchant
    participant SwedbankPay as Swedbank Pay

    rect rgba(81,43,43,0.1)
        activate Merchant
        note left of Payer: Capture
        Merchant ->>+ SwedbankPay: rel:create-paymentorder-capture
        deactivate Merchant
        SwedbankPay -->>- Merchant: Capture status
        note right of Merchant: Capture here only if the purchased<br/>goods don't require shipping.<br/>If shipping is required, perform capture<br/>after the goods have shipped.<br>Should only be used for <br>PaymentInstruments that support <br>Authorizations.
        end
info

Note that the orderItems property object is optional. If the POST request has orderItems in the paymentorder, remember to include orderItems in the capture operation. If the paymentorder is without orderItems, remember to leave this out in the capture operation.

To capture the authorized payment, we need to perform create-paymentorder-capture against the accompanying href returned in the operations list. See the abbreviated request and response below:

Request

POST /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/captures HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
    "transaction": {
        "description": "Capturing the authorized payment",
        "amount": 1500,
        "vatAmount": 375,
        "payeeReference": "AB832",
        "orderItems": [
            {
                "reference": "P1",
                "name": "Product1",
                "type": "PRODUCT",
                "class": "ProductGroup1",
                "itemUrl": "https://example.com/products/123",
                "imageUrl": "https://example.com/product123.jpg",
                "description": "Product 1 description",
                "discountDescription": "Volume discount",
                "quantity": 4,
                "quantityUnit": "pcs",
                "unitPrice": 300,
                "discountPrice": 200,
                "vatPercent": 2500,
                "amount": 1000,
                "vatAmount": 250
            },
            {
                "reference": "P2",
                "name": "Product2",
                "type": "PRODUCT",
                "class": "ProductGroup1",
                "description": "Product 2 description",
                "quantity": 1,
                "quantityUnit": "pcs",
                "unitPrice": 500,
                "vatPercent": 2500,
                "amount": 500,
                "vatAmount": 125
            }
        ]
    }
}
Required Property Type Description
✔︎︎︎︎︎ transaction object The transaction object.
✔︎︎︎︎︎ └➔ description string The description of the capture transaction.
✔︎︎︎︎︎ └➔ amount integer The amount including VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK and 5000 equals 50.00 NOK.
✔︎︎︎︎︎ └➔ vatAmount integer The amount of VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK and 5000 equals 50.00 NOK.
✔︎︎︎︎︎ └➔ 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.
✔︎︎︎︎︎ └➔ orderItems array The array of items being purchased with the order. Used to print on invoices if the payer chooses to pay with invoice, among other things. Required in capture requests if already sent with the initial creation of the Payment Order. Note that this should only contain the items to be captured from the order.
✔︎︎︎︎︎ └─➔ reference string A reference that identifies the order item.
✔︎︎︎︎︎ └─➔ name string The name of the order item.
✔︎︎︎︎︎ └─➔ type string PRODUCT, SERVICE, SHIPPING_FEE, PAYMENT_FEE, DISCOUNT, VALUE_CODE or OTHER. The type of the order item.
✔︎︎︎︎︎ └─➔ class string The classification of the order item. Can be used for assigning the order item to a specific product category, such as MobilePhone. Note that class cannot contain spaces. Swedbank Pay may use this field for statistics.
  └─➔ itemUrl string The URL to a page that can display the purchased item, product or similar.
︎︎︎ └─➔ imageUrl string The URL to an image of the order item.
  └─➔ description string The human readable description of the order item.
  └─➔ discountDescription string The human readable description of the possible discount.
✔︎︎︎︎︎ └─➔ quantity integer The 4 decimal precision quantity of order items being purchased.
✔︎︎︎︎︎ └─➔ quantityUnit string The unit of the quantity, such as pcs, grams, or similar. This is a free-text field and is used for your own book keeping.
✔︎︎︎︎︎ └─➔ unitPrice integer The price per unit of order item, including VAT.
  └─➔ discountPrice integer If the order item is purchased at a discounted price. This property should contain that price, including VAT.
✔︎︎︎︎︎ └─➔ vatPercent integer The percent value of the VAT multiplied by 100, so 25% becomes 2500.
✔︎︎︎︎︎ └─➔ amount integer The total amount including VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.
✔︎︎︎︎︎ └─➔ vatAmount integer The total amount of VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.
✔︎︎︎︎︎ └─➔ reference string A reference that identifies the order item.
✔︎︎︎︎︎ └─➔ name string The name of the order item.
✔︎︎︎︎︎ └─➔ type string PRODUCT, SERVICE, SHIPPING_FEE, PAYMENT_FEE, DISCOUNT, VALUE_CODE or OTHER. The type of the order item.
✔︎︎︎︎︎ └─➔ class string The classification of the order item. Can be used for assigning the order item to a specific product category, such as MobilePhone. Note that class cannot contain spaces. Swedbank Pay may use this field for statistics.
︎︎︎ └─➔ itemUrl string The URL to a page that can display the purchased item, such as a product page
︎︎︎ └─➔ imageUrl string The URL to an image of the order item.
︎︎︎ └─➔ description string The human readable description of the order item.
︎︎︎ └─➔ discountDescription string The human readable description of the possible discount.
✔︎︎︎︎︎ └─➔ quantity decimal The 4 decimal precision quantity of order items being purchased.
✔︎︎︎︎︎ └─➔ quantityUnit string The unit of the quantity, such as pcs, grams, or similar.
✔︎︎︎︎︎ └─➔ unitPrice integer The price per unit of order item, including VAT.
︎︎︎ └─➔ discountPrice integer If the order item is purchased at a discounted price. This property should contain that price, including VAT.
✔︎︎︎︎︎ └─➔ vatPercent integer The percent value of the VAT multiplied by 100, so 25% becomes 2500.
✔︎︎︎︎︎ └─➔ amount integer The total amount including VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK and 5000 equals 50.00 NOK.
✔︎︎︎︎︎ └─➔ vatAmount integer The total amount of VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK and 5000 equals 50.00 NOK.

If the capture succeeds, it should respond with something like the following:

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "capture": {
        "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/captures/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
        "transaction": {
            "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
            "type": "Capture",
            "state": "Completed",
            "amount": 15610,
            "vatAmount": 3122,
            "description": "Capturing the authorized payment",
            "payeeReference": "AB832"
        }
    }
}
Property Type Description
payment string The relative URI of the payment this capture transaction belongs to.
capture object The capture object, containing the information about the capture transaction.
└➔ id string The relative URI of the created capture transaction.
└➔ transaction object The transaction object, containing information about the current transaction.
└─➔ id string The relative URI 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 created.
└─➔ 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 Amount is entered in the lowest momentary units of the selected currency. E.g. 10000 = 100.00 NOK, 5000 = 50.00 SEK.
└─➔ vatAmount integer If the amount given includes VAT, this may be displayed for the user in the payment page (redirect only). Set to 0 (zero) if this is not relevant.
└─➔ description string A human readable description of maximum 40 characters of the transaction.
└─➔ payeeReference string A unique reference for the transaction. See payeeReference for details.

Abort

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

Request

PATCH /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
  "paymentorder": {
    "operation": "Abort",
    "abortReason": "CancelledByConsumer"
  }
}

Response

Response
HTTP/1.1 200 OK
Content-Type: application/json

{
    "paymentorder": {
        "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
        "created": "2018-09-14T13:21:29.3182115Z",
        "updated": "2018-09-14T13:21:57.6627579Z",
        "operation": "Purchase",
        "state": "Ready",
        "currency": "SEK",
        "amount": 1500,
        "vatAmount": 0,
        "remainingCaptureAmount": 1500,
        "remainingCancellationAmount": 1500,
        "remainingReversalAmount": 0,
        "description": "Test Purchase",
        "initiatingSystemUserAgent": "PostmanRuntime/3.0.1",
        "userAgent": "Mozilla/5.0...",
        "language": "nb-NO",
        "urls" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/urls" },
        "payeeInfo" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payeeinfo" },
        "settings": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/settings" },
        "payers": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payers" },
        "orderItems" : { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/orderItems" },
        "metadata": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/metadata" },
        "payments": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payments" },
        "currentPayment": { "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/currentpayment" }
    },
    "operations": [
        {
            "method": "PATCH",
            "href": "https://api.externalintegration.payex.com/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
            "rel": "update-paymentorder-abort",
            "contentType": "application/json"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065",
            "rel": "redirect-paymentorder",
            "contentType": "text/html"
        },
        {
            "method": "GET",
            "href": "https://ecom.externalintegration.payex.com/paymentmenu/core/scripts/client/px.paymentmenu.client.js?token=afccf3d0016340620756d5ff3e08f69b555fbe2e45ca71f4bd159ebdb0f00065&culture=nb-NO",
            "rel": "view-paymentorder",
            "contentType": "application/javascript"
        }
    ]
}

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

Cancel

If we want to cancel up to the total authorized (not captured) amount, we need to perform create-paymentorder-cancel against the accompanying href returned in the operations list. See the abbreviated request and response below:

Request

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": {
        "payeeReference": "ABC123",
        "description": "Cancelling parts of the total amount"
    }
}
Required Property Type Description
✔︎︎︎︎︎ transaction object The transaction object.
✔︎︎︎︎︎ └➔ 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.
✔︎︎︎︎︎ └➔ description string A textual description of why the transaction is cancelled.

If the cancellation request succeeds, the response should be similar to the example below:

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "cancellation": {
        "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/cancellations/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
        "transaction": {
            "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
            "type": "Cancel",
            "state": "Completed",
            "amount": 5610,
            "vatAmount": 1122,
            "description": "Cancelling parts of the authorized payment",
            "payeeReference": "AB832"
        }
    }
}
Property Type Description
payment string The relative URI of the payment this cancellation transaction belongs to.
cancellation object The cancellation object, containing information about the cancellation transaction.
└➔ id string The relative URI of the cancellation transaction.
└➔ transaction object The transaction object, containing information about the current transaction.
└─➔ id string The relative URI 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 created.
└─➔ 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 Amount is entered in the lowest momentary units of the selected currency. E.g. 10000 = 100.00 NOK, 5000 = 50.00 SEK.
└─➔ vatAmount integer If the amount given includes VAT, this may be displayed for the user in the payment page (redirect only). Set to 0 (zero) if this is not relevant.
└─➔ description string A human readable description of maximum 40 characters of the transaction.
└─➔ payeeReference string A unique reference for the transaction. See payeeReference for details.

Reversal

If we want to reverse a previously captured amount, we need to perform create-paymentorder-reversal against the accompanying href returned in the operations list. See the abbreviated request and response below:

Request

POST /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/reversals HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
    "transaction": {
        "description": "Reversal of captured transaction",
        "amount": 1500,
        "vatAmount": 375,
        "payeeReference": "ABC123",
        "orderItems": [
            {
                "reference": "P1",
                "name": "Product1",
                "type": "PRODUCT",
                "class": "ProductGroup1",
                "itemUrl": "https://example.com/products/123",
                "imageUrl": "https://example.com/product123.jpg",
                "description": "Product 1 description",
                "discountDescription": "Volume discount",
                "quantity": 4,
                "quantityUnit": "pcs",
                "unitPrice": 300,
                "discountPrice": 200,
                "vatPercent": 2500,
                "amount": 1000,
                "vatAmount": 250
            },
            {
                "reference": "P2",
                "name": "Product2",
                "type": "PRODUCT",
                "class": "ProductGroup1",
                "description": "Product 2 description",
                "quantity": 1,
                "quantityUnit": "pcs",
                "unitPrice": 500,
                "vatPercent": 2500,
                "amount": 500,
                "vatAmount": 125
            }
        ]
    }
}
Required Property Type Description
✔︎︎︎︎︎ transaction object The transaction object.
✔︎︎︎︎︎ └➔ amount integer The amount including VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK and 5000 equals 50.00 NOK.
✔︎︎︎︎︎ └➔ vatAmount integer The amount of VAT in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 NOK and 5000 equals 50.00 NOK.
✔︎︎︎︎︎ └➔ 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.
✔︎︎︎︎︎ └➔ description string Textual description of why the transaction is reversed.
✔︎︎︎︎︎ └➔ orderItems array The array of items being purchased with the order. Used to print on invoices if the payer chooses to pay with invoice, among other things. Required in capture requests if already sent with the initial creation of the Payment Order. Note that this should only contain the items to be captured from the order.
✔︎︎︎︎︎ └─➔ reference string A reference that identifies the order item.
✔︎︎︎︎︎ └─➔ name string The name of the order item.
✔︎︎︎︎︎ └─➔ type string PRODUCT, SERVICE, SHIPPING_FEE, PAYMENT_FEE, DISCOUNT, VALUE_CODE or OTHER. The type of the order item.
✔︎︎︎︎︎ └─➔ class string The classification of the order item. Can be used for assigning the order item to a specific product category, such as MobilePhone. Note that class cannot contain spaces. Swedbank Pay may use this field for statistics.
  └─➔ itemUrl string The URL to a page that can display the purchased item, product or similar.
  └─➔ imageUrl string The URL to an image of the order item.
  └─➔ description string The human readable description of the order item.
  └─➔ discountDescription string The human readable description of the possible discount.
✔︎︎︎︎︎ └─➔ quantity integer The 4 decimal precision quantity of order items being purchased.
✔︎︎︎︎︎ └─➔ quantityUnit string The unit of the quantity, such as pcs, grams, or similar. This is a free-text field and is used for your own book keeping.
✔︎︎︎︎︎ └─➔ unitPrice integer The price per unit of order item, including VAT.
  └─➔ discountPrice integer If the order item is purchased at a discounted price. This property should contain that price, including VAT.
✔︎︎︎︎︎ └─➔ vatPercent integer The percent value of the VAT multiplied by 100, so 25% becomes 2500.
✔︎︎︎︎︎ └─➔ amount integer The total amount including VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.
✔︎︎︎︎︎ └─➔ vatAmount integer The total amount of VAT to be paid for the specified quantity of this order item, in the lowest monetary unit of the currency. E.g. 10000 equals 100.00 SEK and 5000 equals 50.00 SEK.

If the reversal request succeeds, the response should be similar to the example below:

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce",
    "reversals": {
        "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/cancellations/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
        "transaction": {
            "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/transactions/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
            "type": "Reversal",
            "state": "Completed",
            "amount": 15610,
            "vatAmount": 3122,
            "description": "Reversing the capture amount",
            "payeeReference": "ABC987"
        }
    }
}
Property Type Description
payment string The relative URI of the payment this reversal transaction belongs to.
reversals object The reversal object, containing information about the reversal transaction.
└➔ id string The relative URI of the reversal transaction.
└➔ transaction object The transaction object, containing information about the current transaction.
└─➔ id string The relative URI 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 created.
└─➔ 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 Amount is entered in the lowest momentary units of the selected currency. E.g. 10000 = 100.00 NOK, 5000 = 50.00 SEK.
└─➔ vatAmount integer If the amount given includes VAT, this may be displayed for the user in the payment page (redirect only). Set to 0 (zero) if this is not relevant.
└─➔ description string A human readable description of maximum 40 characters of the transaction.
└─➔ payeeReference string A unique reference for the transaction. See payeeReference for details.

Transactions

A payment contains sub-resources in the form of transactions. Most operations performed on a payment ends up as a transaction. The different types of operations that alter the state of the payment by creating a transaction is described below.

The transactions resource will list the transactions (one or more) on a specific payment.

Request

GET /psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "transactions": {
        "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions",
        "transactionList": [{
            "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
            "created": "2016-09-14T01:01:01.01Z",
            "updated": "2016-09-14T01:01:01.03Z",
            "type": "Authorization",
            "state": "Initialized",
            "number": 1234567890,
            "amount": 1000,
            "vatAmount": 250,
            "description": "Test authorization",
            "payeeReference": "PR1004",
            "failedReason": "",
            "isOperational": true,
            "operations": []
        }]
    }
}
Property Type Description
payment string The relative URI of the payment this list of transactions belong to.
transactions object The transactions object.
└➔ id string The relative URI of the current transactions resource.
└➔ transactionList array The array of transaction objects.
└➔ transactionList[] object The transaction object (described in the transaction resource below).

Transaction

The transaction resource contains the generic details of a transaction on a specific payment.

When a transaction is created it will have one of three states:

  • Initialized - if there is some error where the source is undeterminable (network failure, etc), the transaction will remain Initialized. The corresponding state of the payment order will in this case be set to pending. No further transactions can be created.
  • Completed - if everything went ok the transaction will follow through to completion.
  • Failed - if the transaction has failed (i.e. a denial from the acquiring bank) it is possible to retry (i.e the consumer tries using another credit card) up to a maximum amount of retries (in that case which the payment order gets the state failed as well).

Request

GET /psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "transaction": {
        "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
        "created": "2016-09-14T01:01:01.01Z",
        "updated": "2016-09-14T01:01:01.03Z",
        "type": "Capture",
        "state": "Initialized",
        "number": 1234567890,
        "amount": 1000,
        "vatAmount": 250,
        "description": "Test transaction",
        "payeeReference": "AH123456",
        "failedReason": "",
        "isOperational": true,
        "operations": []
    }
}
Property Type Description
payment string The relative URI of the payment this transaction belongs to.
transaction object The transaction object.
└➔ id string The relative URI 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 created.
└➔ 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 Amount is entered in the lowest momentary units of the selected currency. E.g. 10000 = 100.00 NOK, 5000 = 50.00 SEK.
└➔ vatAmount integer If the amount given includes VAT, this may be displayed for the user in the payment page (redirect only). Set to 0 (zero) if this is not relevant.
└➔ description string A human readable description of maximum 40 characters of the transaction.
└➔ payeeReference string A unique reference for the transaction.
└➔ failedReason string The human readable explanation of why the payment failed.
└➔ isOperational bool true if the transaction is operational; otherwise false.
└➔ operations array The array of operations that are possible to perform on the transaction in its current state.

Recurring Payments

If you want to enable subsequent recurring – server-to-server – payments, you need to create a recurrence token. This token will be utilized after the initial payment order. Recurring payments must be activated on the contract with Swedbank Pay in order to work.

Recurrence Token

  • When initiating a Purchase payment order, you need to make sure that the property generateRecurrenceToken is set to true. This recurrence token will stored in the authorization transaction sub-resource on the underlying payment resource.
  • When initiating a Verify payment order, a recurrence token will be generated automatically. This recurrence token is stored in the verification sub-resource on the underlying payment resource.

You can view the current payment resource, containg the recurrence token and other payment instrument properties, by expanding the sub-resource currentpayment when doing a GET request on the paymentorders resource.

Request

GET /psp/paymentorders/<paymentorderId>?$expand=currentpayment HTTP/1.1
Host: api.externalintegration.payex.com

Creating Recurring Payments

When you have a recurrenceToken token safely tucked away, you can use this token in a subsequent Recur payment order. This will be a server-to-server affair, as we have tied all necessary payment instrument details related to the recurrence token during the initial payment order.

Request

POST /psp/paymentorders HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
  "paymentorder": {
    "operation": "Recur",
    "recurrenceToken": "09ccd29a-7c4f-4752-9396-12100cbfecce",
    "currency": "SEK",
    "amount": 1000,
    "vatAmount": 250,
    "description": "Test Purchase",
    "userAgent": "Mozilla/5.0...",
    "language": "sv-SE",
    "urls": {
      "callbackUrl": "https://example.com/callback"
    },
    "payeeInfo": {
      "payeeId": "5cabf558-5283-482f-b252-4d58e06f6f3b"
      "payeeReference": "CD1234",
      "payeeName": "Merchant1",
      "productCategory": "A123",
      "orderReference": "or-12456",
      "subsite": "Subsite1"
    },
    "orderItems": [
      {
        "reference": "P1",
        "name": "Product1",
        "type": "PRODUCT",
        "class": "ProductGroup1",
        "itemUrl": "https://example.com/shop/id=123",
        "imageUrl": "https://example.com/product1.jpg",
        "description": "Product 1 description",
        "discountDescription": "Volume discount",
        "quantity": 4,
        "quantityUnit": "pcs",
        "unitPrice": 300,
        "discountPrice": 200,
        "vatPercent": 2500,
        "amount": 1000,
        "vatAmount": 250
      }
    ],
    "metadata": {
      "key1": "value1",
      "key2": 2,
      "key3": 3.1,
      "key4": false
    }
  }
}

Purchase Payments

The Purchase operation is used in all common purchase scenarios.

Purchase

{
    "paymentorder": {
        "operation": "Purchase"
    {
}

Verify Payments

The Verify operation lets you post verifications to confirm the validity of credit card information, without reserving or charging any amount. This option is mainly used to initiate a recurring payment scenario where the card will be charged at a later date. The request body is equivalent to a Purchase order with credit card as the selected item. A recurrence token will be generated automatically, rendering the parameter generateRecurrenceToken unnecessary for this operation.

Verify

{
    "paymentorder": {
        "operation": "Verify"
    {
}

Payments Resource

A payment order is able to hold more than one payment object, even though a successful payment order only harbour one successful payment. This is necessary as the consumer might select and initiate a payment option that is not followed through successfully. I.e. if the consumer cancels an invoice payment, a cancel transaction will still be tied to that particular invoice payment resource. This payment resource will continue to exist, even if the consumer successfully should finish the purchase with a credit card payment instead.

Request

GET /psp/paymentorders<paymentorderId>/payments HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

{
    "paymentorder": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
    "payments": {
        "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payments",
        "paymentList" : [
            {
                "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce",
                "instrument" : "CreditCard",
                "created": "2016-09-14T13:21:29.3182115Z"
            },
            {
                "id": "/psp/invoice/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
                "instrument" : "Invoice",
                "created": "2016-09-14T13:21:29.3182115Z"
            }
        ]
    }
}
Property Type Description
paymentorder object The payment order object.
payments object The payments object.
└➔ id string The relative URI of the current payments resource.
└➔ paymentList array The array of payment objects.
└─➔ id string The URI of the payment.
└─➔ instrument string The name of the payment instrument.
└─➔ created string The ISO-8601 date and time of when the payment was created.

Current Payment Resource

The currentpayment resource displays the payment that are active within the payment order container.

Request

GET /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/currentpayment HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "paymentorder": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
    "menuElementName": "creditcard",
    "payment": {
        "recurrenceToken": "09ccd29a-7c4f-4752-9396-12100cbfecce",
        "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce",
        "number": 1234567890,
        "instrument": "CreditCard",
        "created": "2016-09-14T13:21:29.3182115Z",
        "updated": "2016-09-14T13:21:57.6627579Z",
        "operation": "Purchase",
        "intent": "Authorization",
        "state": "Ready",
        "currency": "NOK",
        "amount": 1500,
        "remainingCaptureAmount": 1500,
        "remainingCancellationAmount": 1500,
        "remainingReversalAmount": 0,
        "description": "Test Purchase",
        "payerReference": "AB1234",
        "userAgent": "Mozilla/5.0...",
        "language": "nb-NO",
        "prices": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/prices" },
        "transactions": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/transactions" },
        "authorizations": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/authorizations" },
        "captures": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/captures" },
        "cancellations": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/cancellations" },
        "reversals": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/reversals" },
        "verifications": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/verifications" },
        "urls" : { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/urls" },
        "payeeInfo" : { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/payeeInfo" },
        "metadata" : { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/metadata" },
        "settings": { "id": "/psp/creditcard/payments/09ccd29a-7c4f-4752-9396-12100cbfecce/settings" }
    },
    "operations": []
}
Property Type Description
paymentorder string The URI of the payment order the payment belongs to.
menuElementName string creditcard, invoice, etc. The name of the selected menu element.
payment object The payment object.
└➔ recurrenceToken string The created recurrenceToken, if operation: Verify or generateRecurrenceToken: true was used.
└➔ id string The relative URI to the payment.
└➔ 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, for that id should be used instead.
└➔ instrument string The payment instrument used.
└➔ created string The ISO-8601 date of when the payment was created.
└➔ updated string The ISO-8601 date of when the payment was updated.
└➔ operation string Purchase, payout, Verify or recur.The type of the initiated payment.
└➔ intent string The intent of the payment.
└➔ state string Ready, Pending, Failed or Aborted. Indicates the state of the payment. This field is only for status display purposes.
└➔ currency string The currency of the payment.
└➔ prices object The prices object.
└─➔ amount integer Amount is entered in the lowest momentary units of the selected currency. E.g. 10000 = 100.00 NOK, 5000 = 50.00 SEK.
└─➔ remainingCaptureAmount integer The available amount to capture.
└─➔ remainingCancelAmount integer The available amount to cancel.
└─➔ remainingReversalAmount integer The available amount to reverse.
└➔ description string(40) A textual description of maximum 40 characters of the purchase.
└➔ payerReference string The reference to the consumer from the merchant system, like mobile number, customer number etc.
└➔ userAgent string The user agent string of the consumer’s browser.
└➔ language string nb-NO, sv-SE or en-US

Prices Resource

The prices resource lists the prices related to a specific payment.

Request

GET /psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/prices/ HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "prices": {
        "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/prices",
        "priceList": [
            {
                "type": "VISA",
                "amount": 2350,
                "vatAmount": 0
            },
            {
                "type": "MasterCard",
                "amount": 2350,
                "vatAmount": 0
            }
        ]
    }
}
Property Type Description
payment string The relative URI of the payment the prices resource belongs to.
prices object The prices resource.
└➔ id string The relative URI of the current prices resource.
└➔ priceList array The array of price objects. Note: Even if you specifiy CreditCard in the input message the system will return all your configured card brands instead when you expan the priceList.
└─➔ type string The type of the price object.
└─➔ amount integer Amount is entered in the lowest momentary units of the selected currency. E.g. 10000 = 100.00 NOK, 5000 = 50.00 SEK.
└─➔ vatAmount integer If the amount given includes VAT, this may be displayed for the user in the payment page (redirect only). Set to 0 (zero) if this is not relevant.

Prices Object Types

Each payment instrument have one or more prices object types. This is most relevant when using card based and direct debit payments as each type correspond to a card brand or bank respectively.

Card Payments

The generic type CreditCard enables all card brands, supported by merchant contract.

Type Description
Visa Visa
MasterCard MasterCard
Amex American Express
Dankort Dankort can only be used with DKK currency
Diners Diners Club
Finax Finax
Jcb JCB
IkanoFinansDK Ikano Finans Denmark
Maestro MasterCard Maestro

Payer Resource

The payer resource contains payer information related to the payment order. The information is retrieved via a consumer profile token (consumerProfileRef), from the Consumers resource during login/checkin.

Request

GET /psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payers/ HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "paymentorder": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
    "payer" : {
        "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce/payer",
        "reference": "reference to payer",
        "email": "email",
        "msisdn": "msisdn",
        "shippingAddress": {
            "addressee": "firstName + lastName",
            "coAddress": "coAddress",
            "streetAddress": "streetAddress",
            "zipCode": "zipCode",
            "city": "city",
            "countryCode": "countryCode"
        }
    }
}
Property Type Description
paymentorder string The URI of the payment order the payer belongs to.
payer object The payer object.
└➔ id string The relative URI to the current payer resource.
└➔ email string Payer’s registered email address.
└➔ msisdn string Payer’s registered mobile phone number.
└➔ shippingAddress object The shipping address object related to the payer.
└─➔ addresse object The shipping address object related to the payer.
└─➔ coAddress string Payer’ s c/o address, if applicable.
└─➔ streetAddress string Payer’s street address
└─➔ zipCode string Payer’s zip code
└─➔ city string Payer’s city of residence
└─➔ countryCode string Country Code for country of residence.

Checkin Events

The Checkin Seamless View can inform about events that occur during Checkin through JavaScript event callbacks which can be implemented in the configuration object passed to the payex.hostedView.consumer(configuration) object.

sequenceDiagram
  participant Consumer
  participant Merchant
  participant SwedbankPay as Swedbank Pay

  Consumer ->> Merchant: visit
  Merchant ->> Merchant: Prepare, Embed ClientScript
  Merchant ->> SwedbankPay: payex.hostedView.consumer().open()

  alt Configuration validation failure
    SwedbankPay -->> Merchant: onError
  end

  alt Identified consumer
      SwedbankPay->>Merchant: onConsumerIdentified

      alt Depending on backend response
        SwedbankPay->>Merchant: onShippingDetailsAvailable
        SwedbankPay->>Merchant: onBillingDetailsAvailable
      end
  end

  alt Change shipping address
    Consumer->>SwedbankPay: Click change shipping adress button
    SwedbankPay->>Merchant: OnShippingDetailsAvailable
  end

onConsumerIdentified

This event triggers when a consumer has performed Checkin and is identified, if the Payment Menu is not loaded and in the DOM.

The onConsumerIdentified event is raised with the following event argument object:

onConsumerIdentified event object

{
  "actionType": "OnConsumerIdentified",
  "consumerProfileRef": "<consumerProfileRef>"
}

onShippingDetailsAvailable

Triggered when a consumer has been identified or shipping address has been updated.

onShippingDetailsAvailable event object

{
  "actionType": "OnBillingDetailsAvailable",
  "url": "/psp/consumers/<ConsumerProfileRef>/shipping-details"
}

onBillingDetailsAvailable

Triggered when a consumer has been identified

onBillingDetailsAvailable event object

{
  "actionType": "OnBillingDetailsAvailable",
  "url":"/psp/consumers/<ConsumerProfileRef>/billing-details"
}

onError

Triggered on terminal errors, and when the configuration fails validation.

Enable or Disable Payment Menu

It is possible to disable the payment menu when only one instrument exist by setting the disablePaymentMenu property to true. The default value is false, exemplified below.

Request

{
    "paymentorder": {
        "disablePaymentMenu": false
    {
}

example disablePaymentMenu = false

Setting disablePaymentMenu property to true removes all other payment instruments but the one that is available. This feature is only valuable to set to true if you have only one payment instrument available. By setting it to true will remove the frame around the menu and show only the instrument.

Request

{
    "paymentorder": {
        "disablePaymentMenu": true
    {
}

example disablePaymentMenu = true

Payment Menu Events

During operation in the Payment Menu, several events can occur. They are described below.

onPaymentMenuInstrumentSelected

This event triggers when a user actively changes payment instrument in the Payment Menu. The onPaymentMenuInstrumentSelected event is raised with the following event argument object:

onPaymentMenuInstrumentSelected event object

{
    "name": "menu identifier",
    "instrument": "creditcard | vipps | swish | invoice",
}
Property Type Description
name string The name and identifier of specific instrument instances - i.e. if you deploy more than one type of credit card payments, they would be distinguished by name.
instrument string Creditcard, vipps, swish, invoice. The instrument selected by the user.

onPaymentCreated

This event triggers when a user has selected a payment instrument and actively attempts to perform a payment. The onPaymentCreate event is raised with the following event argument object:

onPaymentCreated event object

{
    "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "instrument": "creditcard | vipps | swish | invoice",
}
Property Type Description
id string The relative URI to the payment.
instrument string Creditcard, vipps, swish, invoice. The instrument selected when initiating the payment.

onPaymentCompleted

This event triggers when a payment has completed successfully. The onPaymentCompleted event is raised with the following event argument object:

onPaymentCompleted event object

{
    "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "redirectUrl": "https://en.wikipedia.org/wiki/Success"
}
Property Type Description
id string The relative URI to the payment.
redirectUrl string The URI the user will be redirect to after a completed payment.

onPaymentCanceled

This event triggers when the user cancels the payment. The onPaymentCanceled event is raised with the following event argument object:

onPaymentCanceled event object

{
    "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "redirectUrl": "https://en.wikipedia.org/wiki/Canceled"
}
Property Type Description
id string The relative URI to the payment.
redirectUrl string The URI the user will be redirect to after a canceled payment.

onPaymentFailed

This event triggers when a payment has failed, disabling further attempts to perform a payment. The onPaymentFailed event is raised with the following event argument object:

onPaymentFailed event object

{
    "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "redirectUrl": "https://en.wikipedia.org/wiki/Failed"
}
Property Type Description
id string The relative URI to the payment.
redirectUrl string The URI the user will be redirect to after a failed payment.

onPaymentTermsOfService

This event triggers when the user clicks on the “Display terms and conditions” link. The onPaymentTermsOfService event is raised with the following event argument object:

onPaymentTermsOfService event object

{
    "origin": "owner | merchant",
    "openUrl": "https://example.org/terms.html"
}
Property Type Description
origin string owner, merchant. The value is always merchant unless Swedbank Pay hosts the view.
openUrl string The URI containing Terms of Service and conditions.

onError

This event triggers during terminal errors or if the configuration fails validation. The onError event will be raised with the following event argument object:

onError event object

{
    "origin": "consumer | paymentmenu | creditcard | invoice | ...",
    "messageId": "<unique message ID>",
    "details": "Descriptive text of the error"
}
Property Type Description
origin string consumer, paymentmenu, creditcard, identifies the system that originated the error.
messageId string A unique identifier for the message.
details string A human readable and descriptive text of the error.

Callback

  • Setting a callbackUrl in the HTTP POST API is optional, but highly recommended. If a payer closes the browser window, a network error or something else happens that prevents the payer from being redirect from Swedbank Pay back to the merchant website, the callback is what ensures that you receive information about what happened with the payment.
  • When a change or update from the back-end system are made on a payment or transaction, Swedbank Pay will perform an asynchronous server-to-server callback to inform the payee (merchant) about this update.
  • Swedbank Pay will make an HTTP POST to the callbackUrl that was specified when the payee (merchant) created the payment.
  • When the callbackUrl receives such a callback, an HTTP GET request must be made on the payment or on the transaction. The retrieved payment or transaction resource will give you the necessary information about the recent change/update.
  • The callback will be retried if it fails. Below are the retry timings, in seconds from the initial transaction time:
    • 30 seconds
    • 60 seconds
    • 360 seconds
    • 432 seconds
    • 864 seconds
    • 1265 seconds
  • The callback is sent from the following IP address 82.115.146.1.

Payment Order Callback

{
    "paymentOrder":{
        "id": "/psp/paymentorders/09ccd29a-7c4f-4752-9396-12100cbfecce",
        "instrument": "<payment instrument>"
    },
    "payment":{
        "id": "/psp/<payment instrument>/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
        "number": 222222222
    },
    "transaction":{
        "id": "/psp/<payment instrument>/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/<transaction type>/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
        "number": 333333333
    }
}
Parameter Description
Payment Instrument CreditCard, Invoice, Swish, Vipps, DirectDebit, MobilePay
Transaction Type Authorization, Capture, Cancellation, Reversal

The sequence diagram below shows the HTTP POST you will receive from Swedbank Pay, and the two GET requests that you make to get the updated status.

sequenceDiagram
    participant Merchant
    participant SwedbankPay as Swedbank Pay
    activate Merchant
        activate SwedbankPay
            SwedbankPay->Merchant: POST <callbackUrl>
            note left of Merchant: Callback by Swedbank Pay
            Merchant-->SwedbankPay: HTTP response
        deactivate SwedbankPay
    deactivate Merchant

    activate Merchant
        Merchant->SwedbankPay: GET <payment instrument> payment
        activate SwedbankPay
            note left of Merchant: First API request
            SwedbankPay-->Merchant: payment resource
        deactivate SwedbankPay
    deactivate Merchant

Problems

When performing operations against the API, 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] specification.

The structure of a problem message will look like this:

{
    "type": "https://api.payex.com/psp/errordetail/creditcard/inputerror",
    "title": "There was an input error",
    "detail": "Please correct the errors and retry the request",
    "instance": "ec2a9b09-601a-42ae-8e33-a5737e1cf177",
    "status": 400,
    "action": "RetryNewData",
    "problems": [{
        "name": "CreditCardParameters.Issuer",
        "description": "minimum one issuer must be enabled "
    }]
}
Property Type Description
type string The URI that identifies the error type. This is the only property 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.
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 property, header, object, entity or likewise that was erroneous.
└➔ [].description string The description of what was wrong with the property, header, object, entity or likewise identified by name.

Common Problems

All common problem types will have a URI in the format https://api.payex.com/psp/errordetail/<payment-instrument>/<error-type>. The URI is an identifier and is currently not possible to dereference, 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 500 A error relating to configuration issues.

Expansion

The payment resource contain the ID of related sub-resources in its response properties. These sub-resources can be expanded inline by using the request parameter expand. This is an effective way to limit the number of necessary calls to the API, as you return several properties related to a Payment resource in a single request.

info

Note that the expand parameter is available to all API requests but only applies to the request response. This means that you can use the expand parameter on a POST or PATCHrequest to get a response containing the target resource including expanded properties.

This example below add the urls and authorizations property inlines to the response, enabling you to access information from these sub-resources.

Expansion

GET /psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1?$expand=urls,authorizations HTTP/1.1
Host: api.externalintegration.payex.com

To avoid unnecessary overhead, you should only expand the nodes you need info about.

Payee Info

The payeeinfo resource contains information about the payee (i.e. a merchant, a corporation etc) related to a specific payment.

Request

GET /psp/paymentorder/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/payeeInfo HTTP/1.1
Host: api.externalintegration.payex.com
Authorization: Bearer <AccessToken>
Content-Type: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "payment": "/psp/paymentorder/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "payeeInfo": {
        "id": "/psp/paymentorder/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/payeeInfo",
        "payeeId": "5cabf558-5283-482f-b252-4d58e06f6f3b"
        "payeeReference": "EN1234",
        "payeeName": "TestMerchant1",
        "productCategory": "EF1234",
        "orderReference": "or-123456"
    }
}
Property Type Description
payment string The URI of the payment which the payeeinfo belongs to.
└➔ id string The URI of the current payeeinfo resource.
└➔ payeeId string This is the unique id that identifies this payee (like merchant) set by Swedbank Pay
└➔ payeeReference string(50) A unique reference set by the merchant system. See below for details
└➔ payeeName string The payee name (like merchant name) that will be displayed to consumer when redirected to Swedbank Pay.
└➔ productCategory string A product category or number sent in from the payee/merchant. This is not validated by Swedbank Pay, but will be passed through the payment process and may be used in the settlement process. You therefore need to ensure that the value given here is valid in the settlement.
└➔ orderReference string(50) The order reference should reflect the order reference found in the merchant’s systems.

PayeeReference

The payeeReference given when creating transactions and payments has some specific processing rules depending on specifications in the contract.

  • It must be unique for every operation, used to ensure exactly-once delivery of a transactional operation from the merchant system.
  • Its length and content validation is dependent on whether the transaction.number or the payeeReference is sent to the acquirer.
    • If you select Option A in the settlement process (Swedbank Pay will handle the settlement), Swedbank Pay will send the transaction.number to the acquirer and the payeeReference may have the format of string(30).
    • If you select Option B in the settlement process (you will handle the settlement yourself), Swedbank Pay will send the payeeReference to the acquirer and it will be limited to the format of string(12) and all characters must be digits.

Settlement and Reconciliation

Reconciliation is an important step in an economic transaction. When a payment is reconciled, captured amounts for the payment are matched against the corresponding settlement.

The information needed to reconcile captured funds - the balance report and transactions list - are available for all merchants using Swedbank Pay. By default you receive these files by e-mail, but it is also possible to get them via FTP access. Contact omni.client@swedbankpay.se for further inquiries regarding this. The settlement frequency is defined in the agreement and you will receive a report for each payout and/or invoice.

Settlement

There are two main alternatives for settlement - either we handle the settlement process for you, or you handle the process yourself :

Swedbank Pay handles the settlement process

Swedbank Pay handles the settlement process on your behalf, (called “Redovisningsservice”). Swedbank Pay transfers the net amount to you directly.

Swedbank Pay Checkout

When choosing Swedbank Pay Checkout we always handle the settlement process for you, gathering all your eCommerce payments in one place. Straighforward and time efficient.

You handle the settlement process yourself

If you will handle the settlement yourself, then Swedbank Pay will send you an invoice with the relevant fees, in addition to the report and transactions lists. Your acquirer will transfer settled funds to you.

Balance Report

The Balance Report (a .pdf file) specifies the total sales for a specific period, including fees and VAT. The report contains three parts: a payment summary and specifications for sales and for fees.

Payment Summary

Provides a summary of the Amount sold, Fees and VAT. If Swedbank Pay handles the settlement process, the Transferedamount - shown in the balance report summary is equivalent to the disbursement on the bank statement (the remaining total amount after fees).

Sales specification

Provides a specification over sales for the given period. The sales total is specified per payment area (CreditCard, Direct Debit, Factoring) and underlying payment instruments. Each sales row specify Quantity, Sum sales and Amount to pay out, the last one is only eligble if Swedbank Pay handles the Settlement process.

Fees specification

Provides a specification over fees for the given period. The fees total is specified per payment area (CreditCard, Direct Debit, Factoring) and underlying payment instruments. Each fees row specify Quantity (sales), Amount (sales), Unit price, Provision and fee Amount. If you handle the settlement process yourselves you will receive a separat invoice for fees.

Transactions List

The Transaction List (provided in .xlsx and .xml formats) specifies all transactions for a specific period, including a summary of transactions grouped by payment instrument. Both formats contain the same information, but the xml file is meant for computer processing while the excel workbook is meant for human interaction.

The first row contains the name of the Swedbank Pay company (e.g. Swedbank Pay Solutions AB) that the merchant has the contract with, and the balance report number. The header fields contain a summary of the transactions displayed in the body.

Header fields

Field Type Description
Prefix String The Prefix used for transactions, only eligible if merchant uses prefix.
Currency ISO 4217 Settlement currency (e.g. SEK, NOK, EUR).
ServiceType String The service type of the service used (e.g. Creditcard, Direct debit).
Service String The service used (e.g. Creditcard, Direct debit).
NoOfDebet Decimal Total number of debit transactions for the given service.
NoOfCredit Decimal Total number of credit transactions for the given service.
Amount Decimal Total amount for the given service (e.g 100.00).
FromDate ISO 8601 The earlistest transaction date, YYYY-MM-DD.
ToDate ISO 8601 The latest transaction date, YYYY-MM-DD.

Body fields

Field Type Description
Swedbank Pay Batch Number Decimal A batch number common to all types of transactions processed by PayEx.
Transaction Number Decimal A unique identifier of the transaction, can be traced in Swedbank Pay Admin user interface.
Order id String A unique identifier of the order, as sent from the merchant to PayEx. Transactions that are related to the same order are associated with this ID.
Date Created ISO 8601 Transaction capture date/time. YYYY-MM-DD hh:mm:ss.
Date Modified ISO 8601 Transaction settle date/time. YYYY-MM-DD hh:mm:ss.
Provider String The service provider (e.g. Babs, Swedbank).
Type String The service type of the related transaction (e.g. Creditcard, Direct debit).
Amount Decimal Total amount of the related transaction (e.g 100.00).
Currency ISO 4217 Settlement currency (e.g. SEK, NOK, EUR).
Product Number String A product number, as sent by merchant to PayEx.
Description String A textual description of the transaction, as sent by merchant to PayEx.
VAT Amount Decimal VAT Amount for the given transaction (e.g 100.00).
VAT Percentage Decimal VAT Percentage for the given transaction.
Credit Card Batch Number Decimal The reference number from the credit card processor.
Direct Debit Bank Reference Decimal The reference number from the processing bank.
Reference Decimal The transaction reference from processor.
Swedbank Pay Account Number Decimal The Account number given, shown in Swedbank Pay admin.
Referenced Transaction Number Decimal Transaction number for the Authoriation transaction for a two-stage transaction or the number of the debit transaction if it is a credit transaction.
Sales Channel String The channel through which the transaction was sent to Swedbank Pay (e.g Transaction via eCommerce APIs).
Brand String If eligible, Branding information as sent by merchant to PayEx.
Point Of Sale String If eligible, POS information as sent by merchant to PayEx.

Reconciliation

To do the reconciliation, you need to match the information in your system against the information provided by Swedbank Pay in the balance report and transaction list. Below is a sequence diagram detailing the interaction.

sequenceDiagram
    participant SwedbankPay as Swedbank Pay

    activate Merchant
    activate SwedbankPay
    Merchant-->>SwedbankPay: Online payment transactions
    deactivate Merchant

    deactivate SwedbankPay

    activate Merchant

    SwedbankPay->>Merchant: Balance Report (PDF-file)
    note left of Merchant: files are sent by e-mail or file transfer
    SwedbankPay->>Merchant: Transaction list (XLSX-file)
    SwedbankPay->>Merchant: Transaction list (XML-file)
    deactivate Merchant

There are two ways for you to match the information from your system with the information given in the reconciliation files from Swedbank Pay:

  1. You can use information generated by your system (you will have to set a unique payeeReference when you make the transaction), or
  2. You can use the transaction number generated by Swedbank Pay (this is called transaction number and is returned from Swedbank Pay after you have created the transaction).

A credit card transaction is made when you either make a capture or a reversal. In the input data for making a capture, you will set the payeeReference. The unique value of this field is the same as the field called OrderID in the reconciliation file.

{
    "transaction": {
        "amount": 1500,
        "vatAmount": 0,
        "description": "Test Reversal",
        "payeeReference": "ABC123"
    }
}

When you receive the response from Swedbank Pay, the response will include transaction.number. This is the same as the field called TransactionNo in the reconciliation file.

{
    "payment": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1",
    "capture": {
        "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/captures/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
        "transaction": {
            "id": "/psp/creditcard/payments/7e6cdfc3-1276-44e9-9992-7cf4419750e1/transactions/ec2a9b09-601a-42ae-8e33-a5737e1cf177",
            "created": "2016-09-14T01:01:01.01Z",
            "updated": "2016-09-14T01:01:01.03Z",
            "type": "Capture",
            "state": "Initialized",
            "number": 1234567890,
            "amount": 1500,
            "vatAmount": 250,
            "description": "Test Capture",
            "payeeReference": "ABC123",
            "failedReason": "",
            "isOperational": false,
            "operations": []
        }
    }
}
  • payeeReference sent to Swedbank Pay is equal to OrderId in the reconciliation file.
  • capture.transaction.number returned from Swedbank Pay is equal to TransactionNo in reconciliation file.

Samples

The content of the files depends on the type of agreement you have made with Swedbank Pay. For some payment instruments, only option A is available, while for other payment instruments, only option B is available. The sample files can be downloaded below.

Option A: Swedbank Pay handles the settlement process

Option B: You will handle the settlement process yourself

Split Settlement

The prefix split is the easy way of doing settlements for companies with multiple sub merchants. With only a few easy steps, you can make the settlement process more efficient with regards to invoicing, payouts and setup for both your sub merchants and yourself.

In short, it is a settlement feature where a company with a website or an app can attach specific prefix numbers to sub merchants selling their goods or services through the company. The prefix number is used to match the transactions and the merchant, so the settlement is automatically split between the sub merchants. If you run a site selling tickets to concerts, theatres, sporting events etc., each venue gets its own prefix number. If you run a funeral home, the sub merchants can be everything from flower delivery to charities.

What we need from you as a company

  • Send us a KYC form for each sub merchant you want to include. We will also do a KYC check on your sub merchants, providing extra security for you.
  • Give every sub merchant who sells goods/services at your website or in your app a unique prefix number. This needs to be included in the KYC form you send to us. We recommend using the same customer number they have in your system.
  • Attach the prefix number to all the goods/services the sub merchant sells through your website or app, so the goods/services can be matched to the correct merchant in our back office system.
  • A partner agreement is needed for the automatic deduction of revenue cuts and fees.

How it works

  1. We set up the sub merchant prefix in our systems.
  2. The prefix number is added in the subsite field in the API call when you create the payment for the goods or service.
  3. The customer selects payment instrument and completes the payment.
  4. The payment goes into the client funds account.
  5. Swedbank Pay matches the transaction and the merchant using the prefix number.
  6. The settlement is split and connected to the correct merchant.
  7. Revenue cuts for the super merchant and fees from Swedbank Pay are deducted automatically.
  8. Payout to the sub merchant is done.

The upsides

  • Since the sub merchants are connected to Swedbank Pay through the super merchant instead of having separate setups, this means that you:
  • Only need one agreement for credit card, direct debit, Vipps, Swish, MobilePay, invoice, credit account and payment gateway.
  • Only need one acquiring agreement.
  • Only need one Vipps/Swish certificate.
  • Can add more payment instruments easily, as it only has to be done once.
  • Can set up new sub merchants quickly, as the only thing needed is a KYC form and a prefix number. This shortens the setup time for both you and us to a matter of hours.
  • The automatic settlement split and deduction of fees and revenue cuts minimizes the work for your accounting department, as you do not have to invoice your sub merchants.
  • The prefix split is available with all the payment instruments we offer on our eCom platform.

Good to know

With regards to admin functions, we offer a full integration towards our admin system. This way, you do not have to log in to Swedbank Pay Admin to perform these operations.

Captures and cancels

Captures and cancels are done by the super merchant the same way as any other normal flow.

Reversals

In cases where you need to do reversals, this will be performed by the super merchant. The reversal amount will be charged from the sub merchants prefix. If the sub merchants balance is 0 (zero), the super merchant will be invoiced. The super merchant will in turn have to invoice this amount to the sub merchant.