18.02.2015 Views

Swedbank Gateway Service Description

Swedbank Gateway Service Description

Swedbank Gateway Service Description

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Swedbank</strong> <strong>Gateway</strong> service description<br />

Version 4.2


Contents<br />

Revision history ................................................................................................................................................ 6<br />

Definitions and abbreviations .......................................................................................................................... 8<br />

Introduction ..................................................................................................................................................... 8<br />

<strong>Swedbank</strong> <strong>Gateway</strong> specification ..................................................................................................................... 8<br />

Sending request data to the bank ...................................................................................................................... 9<br />

PUT ................................................................................................................................................................ 9<br />

Receiving responses from the bank ................................................................................................................... 9<br />

GET ................................................................................................................................................................ 9<br />

DELETE ........................................................................................................................................................... 9<br />

Cryptography .................................................................................................................................................... 10<br />

Client side certificates .................................................................................................................................. 10<br />

Bank side certificates ................................................................................................................................... 11<br />

CA and OCSP certificates ............................................................................................................................. 11<br />

DigiDoc File Format overview ...................................................................................................................... 11<br />

OCSP validity confirmation overview ........................................................................................................... 12<br />

DigiDoc usage in SGW ................................................................................................................................. 12<br />

Error handling ................................................................................................................................................ 16<br />

Example error message .................................................................................................................................... 16<br />

Error codes used ............................................................................................................................................... 17<br />

General error codes ..................................................................................................................................... 17<br />

Payment error codes .................................................................................................................................... 17<br />

Direct Debit error codes ............................................................................................................................... 18<br />

Currency exchange error codes ................................................................................................................... 19<br />

Troubleshooting ............................................................................................................................................... 20<br />

<strong>Service</strong> – Communication test ........................................................................................................................ 21<br />

<strong>Service</strong> description ........................................................................................................................................... 21<br />

Example request XML ....................................................................................................................................... 21<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 21<br />

Example response XML .................................................................................................................................... 21<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 21<br />

<strong>Service</strong> – Account Balance .............................................................................................................................. 22<br />

<strong>Service</strong> description ........................................................................................................................................... 22<br />

Example request XML ....................................................................................................................................... 22<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 22<br />

Example response XML .................................................................................................................................... 22<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 23<br />

<strong>Service</strong> – Payment .......................................................................................................................................... 24<br />

<strong>Service</strong> description ........................................................................................................................................... 24<br />

Example request XML ....................................................................................................................................... 24<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 25<br />

Estonian domestic payment ............................................................................................................................. 26<br />

Latvian domestic payment ............................................................................................................................... 26<br />

Lithuanian domestic payment .......................................................................................................................... 27<br />

Foreign payment .............................................................................................................................................. 27<br />

Example response XML .................................................................................................................................... 28<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 29<br />

<strong>Service</strong> – Account statement .......................................................................................................................... 30<br />

<strong>Service</strong> description ........................................................................................................................................... 30<br />

2


Example request XML ....................................................................................................................................... 30<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 30<br />

Example response XML .................................................................................................................................... 30<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 32<br />

Latvian codes for Transaction/TypeCode .................................................................................................... 33<br />

Estonian codes for Transaction/TypeCode .................................................................................................. 34<br />

Lithuanian codes for Transaction/TypeCode ............................................................................................... 34<br />

<strong>Service</strong> – Exchange rates ................................................................................................................................ 36<br />

<strong>Service</strong> description ........................................................................................................................................... 36<br />

Example request XML ....................................................................................................................................... 36<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 36<br />

Example response XML .................................................................................................................................... 36<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 37<br />

<strong>Service</strong> – Currency exchange .......................................................................................................................... 38<br />

<strong>Service</strong> description ........................................................................................................................................... 38<br />

Example request XML ....................................................................................................................................... 38<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 38<br />

Example response XML .................................................................................................................................... 39<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 39<br />

<strong>Service</strong> – Alert on transactions ....................................................................................................................... 40<br />

<strong>Service</strong> description ........................................................................................................................................... 40<br />

Example request XML ....................................................................................................................................... 40<br />

Example response XML .................................................................................................................................... 40<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 41<br />

<strong>Service</strong> – Periodic statement .......................................................................................................................... 43<br />

<strong>Service</strong> description ........................................................................................................................................... 43<br />

Example request XML ....................................................................................................................................... 43<br />

Example response XML .................................................................................................................................... 43<br />

<strong>Service</strong> – Sending e-invoices ........................................................................................................................... 44<br />

<strong>Service</strong> description ........................................................................................................................................... 44<br />

Example request XML ....................................................................................................................................... 44<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 44<br />

Example response XML .................................................................................................................................... 44<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 45<br />

<strong>Service</strong> – E-Invoices for customer ................................................................................................................... 46<br />

<strong>Service</strong> description ........................................................................................................................................... 46<br />

Example request XML ....................................................................................................................................... 46<br />

Example response XML .................................................................................................................................... 46<br />

<strong>Service</strong> – Direct debit payer agreement management .................................................................................... 47<br />

<strong>Service</strong> description ........................................................................................................................................... 47<br />

Example request XML ....................................................................................................................................... 47<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 48<br />

Example response XML .................................................................................................................................... 48<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 49<br />

<strong>Service</strong> – Direct debit payer agreement changes ............................................................................................ 50<br />

<strong>Service</strong> description ........................................................................................................................................... 50<br />

Example request XML ....................................................................................................................................... 50<br />

Example response XML .................................................................................................................................... 50<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 52<br />

3


<strong>Service</strong> – Direct debit payment requests ........................................................................................................ 53<br />

<strong>Service</strong> description ........................................................................................................................................... 53<br />

Example request XML ....................................................................................................................................... 53<br />

<strong>Description</strong> of fields in request XML ................................................................................................................ 53<br />

Example response XML .................................................................................................................................... 54<br />

<strong>Description</strong> of fields in response XML .............................................................................................................. 55<br />

<strong>Service</strong> – POS report delivery ......................................................................................................................... 56<br />

<strong>Service</strong> description ........................................................................................................................................... 56<br />

Example request XML ....................................................................................................................................... 56<br />

Example response XML .................................................................................................................................... 56<br />

Example 1: Transaction based report ............................................................................................................... 56<br />

Example 2: Batch based report ........................................................................................................................ 58<br />

4


Figures<br />

Figure 1: DigiDoc container ............................................................................................................................ 11<br />

Figure 2: Overview of sending requests and receiving responses from the bank ............................................ 13<br />

Figure 3: Signing, encrypting and sending messages to the bank.................................................................... 14<br />

Figure 4: Receiving, decrypting and verifying messages from the bank .......................................................... 15<br />

5


Revision history<br />

Version Changes Date<br />

2.9 Changed EE domestic payment fields:<br />

05.12.2008<br />

BeneficiaryName (length 70)<br />

Changed Foreign payment fields:<br />

BeneficiaryName (length 70)<br />

BeneficiaryAddress (length 70+optional)<br />

Details (length 140)<br />

Cost (comment)<br />

BalanceOfPaymentsCountry (comment)<br />

2.10 Changed LV domestic payment fields:<br />

11.12.2008<br />

BeneficiaryName (length 70)<br />

BeneficiaryBankCode (mandatory)<br />

Added new error codes<br />

2.11 Added more information to service specification<br />

07.01.2009<br />

EE payment document number (length)<br />

Foregin payment tag: BeneficiaryIBAN – removed<br />

2.12 Added additional information about Active MQ in paragraph <strong>Service</strong><br />

27.01.2009<br />

specification > More about message exchange and ACK:<br />

XML validation demand in paragraph HGW Exceptions and errors<br />

2.13 Lithuanian fields (OrderingParty/IBAN, OrderingParty/Name, Assignee/IBAN, 04.03.2009<br />

Assignee/Name) are set to optional<br />

Re-Branding - Product name change<br />

Hansa<strong>Gateway</strong> <strong>Swedbank</strong> <strong>Gateway</strong><br />

HGW SGW<br />

Incoming file name and request id must be unique<br />

2.14 Removed sample client information 13.05.2009<br />

2.15 LT payment tag change: Assignee/IBAN =>Assignee/Account<br />

07.07.2009<br />

LT payment tag change: OrderingParty/IBAN =>Ordering/Account<br />

Foreign payment rule fix<br />

3.0 Major changes in communication protocol. Dropping Active MQ and starting 14.09.2009<br />

to use HTTP protocol. All communication parameters are changed.<br />

3.1 Added info about HTTP protocol at the pg 6.<br />

09.11.2009<br />

Added additional tag for LV in statements and alert - tag BIC<br />

3.2 Added info about troubleshooting 18.01.2010<br />

3.3 Schema fixing 30.03.2010<br />

3.4 Added beneficiary ID to Lithuanian local payments 30.08.2010<br />

3.5 Removed EE domestic payment priority “U” not valid after 01.01.2011; foreign<br />

03.01.2011<br />

payment “BalanceOfPaymentsCode” is mandatory as from 50,000 EUR<br />

equivalent for EE<br />

3.6 Changed xsd validation addresses inside examples to<br />

01.03.2012<br />

http://swedbankgateway.net/...<br />

Added Process Flow diagrams for message exchange and certificate usage.<br />

Corrected terminology referring to certificates.<br />

4.0 Revised and expanded <strong>Swedbank</strong> <strong>Gateway</strong> specification description.<br />

24.04.2012<br />

Revised error handling and error codes.<br />

Changed document style.<br />

Added a table of figures.<br />

4.1 Added bank response message header X-<strong>Gateway</strong>-Message functionality. 10.10.2012<br />

6


Added information about CA and OCSP certificates.<br />

Added overview about OCSP service.<br />

Updated troubleshooting information with X-<strong>Gateway</strong>-Message header.<br />

Added reference to ISO20022 support and implementation guideline in<br />

Payment service.<br />

Added information regarding double-acceptance condition in Payment<br />

service.<br />

Added information regarding Alert filters.<br />

Added information regarding Account Balance service response XML field<br />

Transaction/TypeCode possible values and their meaning.<br />

Corrected values for XML fields: Agreement/Utility, Agreement/Discount,<br />

Payment/<strong>Description</strong><br />

4.2 Corrected <strong>Service</strong> – Direct debit payer agreement changes root-tag: from<br />

to <br />

Added sample XML for POS reports – transaction based report and batch<br />

based report.<br />

11.12.2012<br />

7


Definitions and abbreviations<br />

IS – Information System<br />

ERP – Enterprise Resource Planning<br />

DigiDoc file format – DigiDoc file format is a profile of XAdES (XML Advanced Electronic Signatures),<br />

technical standard published by ETSI (European Telecommunication Standards Institute)<br />

DD – DigiDoc<br />

SK – Sertifitseerimiskeskus AS (CA in Estonia, http://www.sk.ee)<br />

RC – Registru Centras (CA in Lithuania, http://www.registrucentras.lt/rcsc/index_en.php)<br />

B4B – software certificate profile defined by SK (http://www.sk.ee/en/repository/CP/)<br />

SGW – <strong>Swedbank</strong> <strong>Gateway</strong> channel<br />

PKI – Public Key Infrastructure<br />

Introduction<br />

<strong>Swedbank</strong> <strong>Gateway</strong> is an automated data communications channel between client’s Information<br />

System (sometimes referred to as ERP) and <strong>Swedbank</strong>. Client and the bank exchange data asynchronously<br />

in real-time, 24 hours a day, making information available regardless of working hours.<br />

Data exchange is based on HTTPS protocol, XML format messages, DigiDoc and PKI infrastructure.<br />

SGW channel can be taken into use if client’s IS has a universal built-in support for it, or if the required<br />

interface will be developed separately for the client’s IS.<br />

<strong>Swedbank</strong> <strong>Gateway</strong> specification<br />

As mentioned above SGW is the data communications channel, where the bank and client are exchanging<br />

Request and Response data. Standard HTTPS (HTTP with SLL) protocol is used for communication.<br />

Client sends data requests to the bank with HTTP PUT request and receives responses from the bank<br />

with HTTP GET request. After receiving a response, client must send confirmation message with HTTP<br />

DELETE request.<br />

Each communication session is authenticated by client’s Transport certificate.<br />

SGW address in production environment is https://swedbankgateway.net<br />

To be able to start using this service client has to fulfill the following prerequisites:<br />

<strong>Swedbank</strong> <strong>Gateway</strong> service agreement, preceded by SGW application.<br />

Develop required software for exchanging data between Client IS and SGW or use Bank’s<br />

sample command line Java Client for communication.<br />

Successful testing results from <strong>Swedbank</strong> <strong>Gateway</strong> Sandbox environment.<br />

8


Sending request data to the bank<br />

PUT<br />

Request parameters:<br />

Request body – cdoc file<br />

Header CorrelationID – Message correlation ID set by the customer, which helps to connect<br />

request and response data. ID must be unique.<br />

The response contains:<br />

Header X-<strong>Gateway</strong>-Message – header with value „1“ confirming that message reached to the<br />

service<br />

HTTP Response codes:<br />

200 – OK<br />

500 – Internal error<br />

Receiving responses from the bank<br />

Receiving response data from the bank consists of two steps:<br />

Message is received in a response of a GET request.<br />

After receiving a message a confirmation must be sent out with a DELETE request. If SGW<br />

does not receive a confirmation during one hour after the initial GET request, then the response<br />

message will be redelivered to the customer on the next GET request.<br />

GET<br />

The GET request has no parameters. The response message is delivered as the response body.<br />

The response contains:<br />

Body – cdoc file<br />

Header CorrelationID – CorrelationID set by Client with PUT request.<br />

Header TrackingID – Bank side message ID.<br />

Header X-<strong>Gateway</strong>-Message – header with value „1“ confirming that message reached to the<br />

service<br />

HTTP response codes:<br />

200 – OK<br />

400 – Bad request<br />

404 – No messages<br />

500 – Internal error<br />

DELETE<br />

Request parameters:<br />

Header TrackingID – Bank side message ID received with the GET response.<br />

The response contains:<br />

Header X-<strong>Gateway</strong>-Message – header with value „1“ confirming that message reached to the<br />

service<br />

9


HTTP Response codes:<br />

200 – OK<br />

400 – Bad request. Most probably no message found with the given Tracking ID<br />

500 – Internal error<br />

Cryptography<br />

The whole cryptographic solution within SGW channel is built according to PKI crypto standard. Client<br />

must keep this in mind when developing their connection to SGW. For overview of PKI please read<br />

https://www.swedbank.ee/download/gateway/PKI-in-nutshell.pdf.<br />

<strong>Swedbank</strong> <strong>Gateway</strong> is accepting only encrypted and digitally signed DigiDoc files containing XML<br />

document with service-specific contents. Client certificates used for authentication, signing and encryption<br />

must be trusted by the bank’s IS.<br />

Client side certificates<br />

1. ERP certificate – certificate that identifies that messages were sent by client’s ERP (e.g. information<br />

system) to the bank. The bank uses this certificate to address all encrypted information that<br />

is being sent to client (only client can see the content). This certificate is issued by SK under<br />

“B4B” profile; therefore it is sometimes also called as “B4B certificate”.<br />

This certificate is issued from KLASS3 root. Read more about SK’s certificate policies -<br />

http://www.sk.ee/en/repository/CP/<br />

In Lithuania, we also support ERP certificates that are issued by Lithuanian Registru Centras -<br />

http://www.registrucentras.lt/rcsc/index_en.php<br />

2. Transport certificate – transport certificate is being used in order to authenticate communication<br />

session from client’s information system to SGW channel. In most cases when customer is connected<br />

directly to SGW channel (without other “middle-man” service providers), there is no need<br />

for separate certificates and only one certificate is being used – i.e. ERP certificate also has the<br />

role of a transport certificate.<br />

3. Signing certificate (sometimes referred to as “Transaction Certificate”) – signing certificates are<br />

used for signing payments in SGW channel. Signing certificates should always be on a physical<br />

device (i.e. they are non-reproducible) and issued by a CA that the bank trusts. Signing certificates<br />

should always be issued to a person and not to organization. Signing certificates should always<br />

have “non-repudiation” key-usage.<br />

Currently accepted Signing certificates in SGW channel:<br />

Estonian ID cards<br />

Estonian Digi-ID<br />

Estonian Mobile-ID (M-ID)<br />

Lithuanian ID cards<br />

Lithuanian Mobile-ID<br />

Finnish E-ID<br />

Estonian cryptostick<br />

Lithuanian cryptostick<br />

Since certificates are valid only for a certain period, client has to monitor the validity of certificate<br />

and get a new certificate when it expires. For mission critical systems where interruptions are not<br />

10


allowed, support of two certificates can be planned during the switching period. In case the certificate’s<br />

private key has been compromised, client should immediately inform the bank and the certificate<br />

will be closed.<br />

Bank side certificates<br />

1. Channel website certificate – since SGW uses HTTPS connection with clients, we identify this by<br />

our website certificate, which in case of SGW is issued by SK.<br />

2. Bank’s public certificate is used to sign all outgoing messages, so that clients can verify that all<br />

information is sent by the bank. All messages that clients are sending to the bank, will be encrypted<br />

with the bank certificate’s public key – so that only the bank will be able to open them.<br />

Information regarding Bank’s currently valid certificate is provided to you with SGW development<br />

toolbox. Since Bank’s certificate is valid only for certain period, clients should be aware and<br />

plan tasks required on their side to update Bank’s certificate. Since certificates can be issued<br />

from new roots, that may also mean trusting new root level certificates of CA.<br />

CA and OCSP certificates<br />

CA’s of certificates that are used in channel must be trusted; same applies to the OCSP responders.<br />

Information and validity can be found here: http://www.sk.ee/en/repository/certs/<br />

The OCSP validity confirmation service is available at: http://ocsp.sk.ee/<br />

DigiDoc File Format overview<br />

Digitally signed file format is based on the ETSI TS 101 903 standard called "XML Advanced Electronic<br />

Signatures (XAdES)". This standard describes the structure of digitally signed documents on various<br />

information validity confirmation containment levels. Based on the model of trust above, the DigiDoc<br />

XAdES corresponds to profile “XAdES-XL”. This profile allows to incorporate with a signature the following<br />

signing attributes:<br />

Certificate used for signing<br />

Signing time<br />

Location of the signing<br />

The role of the signer, or resolution<br />

Signature contains the signer’s certificate validity information<br />

OCSP response<br />

OCSP server certificate<br />

Figure 1: DigiDoc container<br />

11


The model enables XAdES-CL profile signature verification without additional information the verifier<br />

should trust the certificate issuer and the certificate of the OCSP validity confirmation server.<br />

DigiDoc container contains original files (the files that were signed) and signatures which are related<br />

to the signed file(s). Each signature contains signer’s certificate, validity confirmation and validity<br />

confirmation service certificate.<br />

DigiDoc system uses .ddoc extension for the files complying with the model above.<br />

OCSP validity confirmation overview<br />

The service is based on OCSP (Online Certificate Status Protocol), which has been described in<br />

Internet standard RFC 2560. OCSP is a simple client-server system where an OCSP client sends to the<br />

OCSP responder (server) a query about a certificate and the responder gives a confirmation regarding<br />

the certificate, which contains the validity of the certificate, invalidity and the time of giving the<br />

confirmation. The reply given by the responder is digitally signed.<br />

OCSP responder has three replies regarding a certificate:<br />

Certificate is valid.<br />

Certificate is not valid.<br />

No information about the requested certificate.<br />

OCSP's positive response means that the certificate has been issued and it was valid at the time of<br />

giving the confirmation.<br />

DigiDoc usage in SGW<br />

In SGW we are using version 1.3 of the DigiDoc file format. The XSD can be found at this address<br />

http://www.id.ee/public/DigiDoc_1.3.xsd and description in PDF format here<br />

http://www.id.ee/public/DigiDoc_format_1.3.pdf.<br />

Request DigiDoc itself has to be encrypted using the bank certificate’s public key (“Recipient” property<br />

of that EncryptedKey in DigiDoc has to be “HGW” – it is possible to encrypt DigiDoc for several<br />

recipients and this rule lets us choose correct encrypted transport key block for decryption). It also<br />

has to be signed with Client ERP Certificate’s Private Key and in case of transactions, additionally with<br />

Signing certificate with OCSP confirmation. ERP signature must have role “ERP” set.<br />

Response is an encrypted and signed DigiDoc file or a plaintext XML file with error details if request<br />

could not be processed.<br />

12


Sending request files to Bank<br />

Sign with Client ERP Certificate Private Key<br />

In case of transactions - Sign additionally with<br />

Authorized Person Signing Certificate Private<br />

Key + OCSP<br />

Request XML<br />

file<br />

DDOC: Signed<br />

container<br />

Request XML<br />

file<br />

Encrypt with Bank<br />

Certificate Public Key<br />

CDOC: Encrypted with Bank<br />

Certificate Public Key<br />

DDOC: Signed<br />

container<br />

Request XML<br />

file<br />

Send to Bank<br />

Receiving response files from Bank (except Alert service response)<br />

Receive from<br />

bank<br />

CDOC: Encrypted with Client ERP<br />

Certificate Public Key<br />

DDOC: Signed<br />

with Bank<br />

Certificate<br />

Response<br />

XML file<br />

Decrypt with Client<br />

ERP Certificate<br />

Private Key<br />

DDOC: Signed with<br />

Bank Certificate<br />

Response<br />

XML file<br />

Verify Bank<br />

Signature<br />

Response<br />

XML file<br />

Receiving Alert service response from Bank<br />

Decrypt with Client ERP<br />

Certificate Private Key<br />

CDOC: Encrypted with Client ERP Certificate<br />

Public Key<br />

Alert response<br />

XML file<br />

Alert response<br />

XML file<br />

Receive Alert from bank<br />

Figure 2: Overview of sending requests and receiving responses from the bank<br />

13


IS sending request to Bank via SGW channel<br />

This process can be initiated either<br />

by user’s request (for example, user<br />

makes an operation that requires<br />

data exchange with Bank) or by IS<br />

(periodic job)<br />

It is recommended to renew Bank’s public<br />

certificate from LDAP directory within<br />

reasonable time-frame (i.e. to check if Bank’s<br />

certificate hasn’t been compromised)<br />

No<br />

IS checks<br />

Bank’s public<br />

key<br />

CDOC: Encrypted with<br />

Bank’s Public Key<br />

- Connection via SSL protocol.<br />

- Session is being<br />

authenticated by client’s<br />

Transport certificate (B4B)<br />

IS prepares<br />

request<br />

to Bank<br />

Request<br />

XML file<br />

- Technical signature<br />

(digital signature) given with software<br />

based ERP certificate.<br />

- OCSP confirmation is not required<br />

File is signed<br />

digitally by IS<br />

1<br />

IS signs with<br />

ERP certificate,<br />

using DD library<br />

Sign by<br />

person?<br />

Yes<br />

2<br />

User signs with<br />

Signing<br />

certificate from<br />

hardware token<br />

Encrypt with<br />

Bank’s public<br />

key<br />

3<br />

DDOC: Signed<br />

container<br />

Request<br />

XML file<br />

- Legal signature given with Signing certificate from hardware<br />

token (key usage= non-repudiation digital signature).<br />

- User enters PIN code manually<br />

- OCSP validity confirmation is mandatory to include<br />

- support of relevant OCSP responder certificates is important<br />

IS sends file to<br />

Bank<br />

4<br />

Bank receives<br />

request<br />

Qualifying certificates:<br />

• SK issued certificate (B4B)<br />

• SK issued Digital Stamp<br />

• RC issued software certificate<br />

DDOC: Signed<br />

container<br />

Request<br />

XML file<br />

DDOC: Signed<br />

container<br />

Request<br />

XML file<br />

Qualifying certificates:<br />

• EST ID card<br />

• Digi ID<br />

• M-ID<br />

• Digital Stamping<br />

• Lithuanian ID card<br />

• Finnish ID card<br />

• EST cryptostick<br />

• LT cryptostick<br />

Operations legend:<br />

Can be made<br />

(called out) with<br />

DigiDoc library<br />

IS development<br />

responsibility<br />

Certificate usage:<br />

1 Technical signing – software based ERP<br />

certificate (B4B) is used to sign document by<br />

IS<br />

2 Legal Signing – hardware token based<br />

Signing certificate is used to sign document<br />

by person. Mandatory for payments<br />

3 Encryption – Bank’s public key is used for<br />

encryption. Bank has certificate with Digital<br />

Stamp profile<br />

4 Authentication – software based Transport<br />

certificate (B4B) is used to authenticate<br />

client’s session<br />

Figure 3: Signing, encrypting and sending messages to the bank<br />

DigiDoc usage (library / utility):<br />

1 Technical signing – sign document<br />

with software certificate (issued under<br />

B4B profile). OCSP validity<br />

confirmation not required<br />

2 Legal Signing – sign document with<br />

hardware certificate (ID Card or other<br />

supported token). OCSP validiy<br />

confirmation required<br />

3 Encryption – Bank’s public key is used<br />

for encryption – Bank has certificate<br />

with Digital Stamp profile<br />

Abbreviations:<br />

IS – Information System<br />

ERP – Enterprise Resource<br />

Planning<br />

DD – DigiDoc<br />

SK – Sertifitseerimiskeskus (CA<br />

in Estonia)<br />

RC - Registru Centras (CA in<br />

Lithuania)<br />

B4B – software certificate<br />

profile defined by SK<br />

14


Bank sending answer to IS via SGW channel<br />

Bank generates response<br />

once client’s request<br />

processing is completed –<br />

this time may vary<br />

depending on the service<br />

used in channel<br />

Bank generates<br />

response<br />

Operations legend:<br />

Response<br />

XML file<br />

- Bank’s legal signature is given with<br />

hardware token certificate – Digital<br />

Stamp (key usage=non-repudiation,<br />

digital signature)<br />

- OCSP validity confirmation is<br />

mandatory to include<br />

- support of relevant OCSP<br />

responder certificates is important<br />

Can be made<br />

(called out) with<br />

DigiDoc library<br />

Client’s<br />

development<br />

responsibility<br />

Qualifying certificate:<br />

• Digital Stamping<br />

Certificate usage:<br />

1 Legal Signing – hardware certificate (Digital<br />

Stamp) is used to sign payments by Bank<br />

2<br />

Bank checks Client’s public<br />

certificate from LDAP<br />

directory before sending any<br />

message (i.e. checks if<br />

Client’s certificate hasn’t<br />

been compromised)<br />

Sign by Bank<br />

Yes<br />

1<br />

Signing with<br />

Digital Stamp,<br />

using DD library<br />

DDOC: Signed<br />

container<br />

Response<br />

XML file<br />

Encryption – Client’s ERP certificate (B4B)<br />

public key is used for encryption.<br />

3 Authentication – Client’s software based<br />

Transport certificate (B4B) is used to<br />

authenticate client’s session<br />

Bank checks<br />

Client’s ERP<br />

certificate public<br />

key<br />

Encrypt with<br />

Client’s public<br />

key<br />

2<br />

Qualifying certificates:<br />

• SK issued certificate (B4B)<br />

• Digital Stamping’s<br />

authentication certificate<br />

• RC issued software<br />

certificate<br />

Only client who has appropriate ERP<br />

certificate’s private key, can decrypt the<br />

file to see it’s content<br />

CDOC: Encrypted with<br />

Client’s Public Key<br />

DDOC: Signed<br />

container<br />

Response<br />

XML file<br />

DigiDoc usage (library / utility):<br />

1 Legal Signing – Bank signs document<br />

with hardware certificate (Digital<br />

Stamp)<br />

2 Encryption – Client’s ERP certificate<br />

(B4B) public key is used for encryption.<br />

4 Decryption – Client’s ERP certificate<br />

(B4B) private key is used for<br />

decryption<br />

Bank puts file to<br />

client’s „Inbox”<br />

at SGW channel<br />

Client’s<br />

files<br />

CDOC: Encrypted with<br />

Client’s Public Key<br />

DDOC: Signed<br />

container<br />

Response<br />

XML file<br />

IS verifies if Bank’s<br />

signature is both<br />

correct and valid. After<br />

that file can be used.<br />

- Connection via SSL protocol<br />

- Session is being authenticated by<br />

client’s Transport certificate (B4B)<br />

- Since SSL is being used, Bank’s<br />

SSL certificate (Website certificate)<br />

may also be checked by client<br />

Bank<br />

authenticates<br />

client by<br />

Transport<br />

certificate<br />

IS downloads<br />

response files<br />

from Bank<br />

3<br />

4<br />

IS decrypts<br />

message with<br />

ERP certificate<br />

using DD library<br />

DDOC: Signed<br />

container<br />

Response<br />

XML file<br />

IS validates<br />

Bank’s signature<br />

Response<br />

XML file<br />

Figure 4: Receiving, decrypting and verifying messages from the bank<br />

IS can use file<br />

15


Error handling<br />

Error responses are sent as an XML file than can be in unencrypted form or inside an encrypted Digi-<br />

Doc container. Error responses are sent unencrypted in case the request DigiDoc file is invalid and it<br />

is not possible to extract the ERP certificate from it.<br />

To avoid cases when the XML files sent to the bank are not valid, bank strongly recommends validating<br />

XML files on the client side before sending them to the bank.<br />

Validation XSD locations can be found at the following addresses:<br />

https://www.swedbank.ee/hgw/valid/hgw.xsd<br />

https://www.swedbank.ee/hgw/valid/hgw-response.xsd<br />

Example error message<br />

<br />

<br />

<br />

AccountNotAllowed<br />

You have no rights to these accounts through HGW agreement.<br />

<br />

<br />

16


Error codes used<br />

Not all error codes and error descriptions might be listed here. We try our best to keep the following<br />

list updated!<br />

General error codes<br />

Code<br />

<strong>Description</strong><br />

NoRights<br />

ERP signature is not tied to any HGW agreements!<br />

AccountNotAllowed<br />

None of the signers can access this account!<br />

MoreSignaturesNeeded<br />

More signatures needed!<br />

BankCodeNotFound<br />

Bank code could not be found!<br />

dailyLimitExceeded<br />

Daily limit exceeded!<br />

monthlyLimitExceeded<br />

Monthly limit exceeded!<br />

84 Currency does not exist!<br />

91 Operations are currently not permitted!<br />

6009 Insufficient funds for transaction on the account!<br />

6100 Locking of current account failed!<br />

Payment error codes<br />

Code<br />

balanceOfPaymentsCode<br />

RemitterIBAN<br />

BeneficiaryIBAN<br />

BeneficiaryBankAccount<br />

BeneficiaryAddress<br />

ValueDate<br />

Currency<br />

BeneficiaryBankCode<br />

BeneficiaryResidence<br />

DocumentNumber<br />

Amount<br />

BeneficiaryName<br />

RemitterPaymentID<br />

ValueDateFormat<br />

Costs<br />

BeneficiaryBankName<br />

ReferenceNumber<br />

Details<br />

ReferenceLV<br />

ReferenceNumberTooLong<br />

InvalidIdentificationType<br />

nameMatchIsTooSmall<br />

<strong>Description</strong><br />

Balance of Payments code is missing!<br />

Remitter IBAN is invalid!<br />

Beneficiary IBAN is invalid!<br />

Beneficiary bank account is invalid!<br />

Beneficiary address is missing!<br />

Invalid date!<br />

Invalid currency!<br />

Beneficiary bank code is invalid!<br />

Beneficiary residence is invalid!<br />

Document number is missing!<br />

Amount is missing or invalid!<br />

Beneficiary name is missing!<br />

Payment ID is missing!<br />

Value date format is invalid!<br />

Costs is incorrect!<br />

Beneficiary bank name is invalid!<br />

Reference number is invalid!<br />

Payment details or reference number must be set!<br />

Reference number is not supported in Latvia!<br />

The Creditor Reference number is too long!<br />

Invalid Identification type!<br />

The account number and the name do not coin-<br />

17


missingDetails<br />

missingDetailsOrReferenceNumber<br />

beneficiaryNameTooLong<br />

intrabankPaymentCannotBeUrgent<br />

incorrectFormatOrderingPartyId<br />

missingOrderingPartyName<br />

incorrectFormatAssigneeId<br />

missingAssigneeName<br />

domesticPaymentCouldBeOnlyInLocalCurrency<br />

paymentToTheSameAccountIsNotAllowed<br />

operationWithCurrencyNotAllowed<br />

invalidValueDate<br />

missingBopCode<br />

ERR00006<br />

ERR00057<br />

H0011<br />

Direct Debit error codes<br />

Code<br />

InvalidIBAN<br />

UtilityNumberIsMandatory<br />

InvalidOperation<br />

InvalidAccountNumber<br />

InvalidRemitterRegistrationNumber<br />

RemitterAccountInWrongCountry<br />

LimitLessThanZero<br />

NoActiveRemitterAgreement<br />

DiscountNumberIsMandatory<br />

LimitNotAllowed<br />

LimitRequired<br />

ReferenceRequired<br />

ReferenceTooShort<br />

ReferenceTooLong<br />

ReferencePrefixInvalid<br />

DebitingPeriodStartTooEarly<br />

DebitingPeriodEndTooLate<br />

DebitingPeriodUsingNotAllowed<br />

cide!<br />

Payment details are missing!<br />

Payment details or reference number must be set!<br />

Beneficiary name is too long!<br />

Intrabank payment cannot be urgent!<br />

Incorrect Ordering Party ID!<br />

Ordering party name is missing!<br />

Incorrect Assignee ID!<br />

Assignee name is missing!<br />

Only local currency is allowed for domestic payments!<br />

Remitter and beneficiary accounts must be different!<br />

Operation with this currency is not allowed!<br />

Payment date is not valid for this agreement!<br />

Balance of Payments code is missing!<br />

Invalid currency!<br />

Balance of Payments code is missing!<br />

Duplicate payment! You have already made a payment<br />

with the same data within 24 hours. Payment<br />

cancelled!<br />

<strong>Description</strong><br />

Invalid IBAN!<br />

Utility number is required!<br />

Invalid operation!<br />

Invalid account number!<br />

Invalid remitter registration number!<br />

Remitter account is in the wrong country.<br />

Limit is less than zero!<br />

No active remitter agreements found!<br />

Discount number is required!<br />

Limit is not allowed!<br />

Limit is required!<br />

Reference is required!<br />

Reference is too short!<br />

Reference is too long!<br />

Reference prefix is invalid!<br />

Debiting period starts too early!<br />

Debiting period ends too late!<br />

Debiting period is not allowed!<br />

18


AgreementNotFound<br />

AgreementEndDateInPast<br />

AgreementStartDateInPast<br />

AgreementStartDateLaterThanEnd<br />

RemitterAgreementConcludingIsNotAllowed<br />

RemitterAgreementClosingIsNotAllowed<br />

PaymentDateIsEarlierThanOperationDate<br />

PaymentDateIsEarlierThanAgreementStartDate<br />

invalidCurrency<br />

InvalidPayerAgreement<br />

AmountOverLimit<br />

Agreement not found!<br />

Agreement end date is in the past!<br />

Agreement start date is in the past!<br />

Agreement start date is later than the end date!<br />

Remitter agreement concluding is not allowed!<br />

Remitter agreement closing is not allowed!<br />

Payment request date is earlier than the operation<br />

date!<br />

Payment request date is earlier than the remitter<br />

agreement start date!<br />

Invalid currency!<br />

Remitter agreement ID is invalid!<br />

Specified amount is over the limit!<br />

2135 Wrong agreement start date for the changed remitter<br />

agreement!<br />

2136 New remitter agreement start date is later than the<br />

previous or new end date!<br />

6202 Beneficiary account does not have a valid beneficiary<br />

agreement!<br />

6212 Remitter agreement payment date is earlier than<br />

the debiting start date!<br />

6213 Remitter agreement payment date is later than the<br />

debiting end date!<br />

6214 Remitter agreement payment date cannot be used<br />

with the given beneficiary agreement!<br />

register_dd_remit_agreement_2104<br />

Invalid contract start date!<br />

register_dd_remit_agreement_6218<br />

register_dd_remit_agreement_6124<br />

Currency exchange error codes<br />

Code<br />

ExchangeRateNotFound<br />

Remitter agreement with the given reference<br />

number already exists!<br />

Beneficiary's utility number or discount number is<br />

not unique!<br />

<strong>Description</strong><br />

Currency not found!<br />

6093 Currency exchange is not permitted!<br />

6094 Currency exchange is not permitted!<br />

19


Troubleshooting<br />

First be sure that messages were sent to right place, in order to confirm that the response must contain<br />

X-<strong>Gateway</strong>-Message header with value “1”.<br />

In case of problems, for example if IS has not received responses from the bank or there is suspicion<br />

that some messages are lost, please send the following data to your agreed contact person in the<br />

bank:<br />

Transport certificate name<br />

Filename<br />

Time when the message was sent<br />

Account number<br />

The response received<br />

The more information the bank receives for troubleshooting the faster the bank will be able to answer<br />

and solve the issue!<br />

20


<strong>Service</strong> – Communication test<br />

<strong>Service</strong> description<br />

Client initiated query to receive a ‘pong’ response to a ‘ping’ request. Client can receive multiple<br />

responses to a ping request: one with from=”HGW” indicating that the communication is working in<br />

general and additionally one reply from each country where the customer has an active agreement<br />

(from=”EE/LV/LT”). Value property from Ping request is returned with Pong response.<br />

Example request XML<br />

<br />

<br />

Test<br />

<br />

<strong>Description</strong> of fields in request XML<br />

Ping 1..1<br />

Ping/Value AN (0 – 210) Something that customer wants to be sent back. 0..1<br />

Example response XML<br />

<br />

<br />

<br />

Test<br />

<br />

<br />

<strong>Description</strong> of fields in response XML<br />

Pong 1..*<br />

Pong @ from A (3) EE/LT/LV/SGW – to show which processor responded. 1..1<br />

Pong/Value AN (0 – 210) Value from Ping request. 1..1<br />

21


<strong>Service</strong> – Account Balance<br />

<strong>Service</strong> description<br />

Client initiated query to receive the balance of one specific account or all accounts listed in SGW<br />

agreement on a given time. “Given time” is the most up to date balance bank can send to customer.<br />

The Account number given in the balance request has to correspond to the IBAN standard. It is also<br />

possible to specify a date in the past, in which case SGW returns the end-of-day balance for that day.<br />

Message with AccountNotAllowed exception is returned if account requested is not listed in any of<br />

SGW agreements available for given Client ERP Certificate.<br />

If account number is omitted, there will be one response for each country where an SGW agreement<br />

is visible for given transport/ERP certificate combination.<br />

Example request XML<br />

<br />

<br />

LT117300010000131196<br />

2007-08-20<br />

<br />

<strong>Description</strong> of fields in request XML<br />

GetBalance 1..1<br />

GetBalance/IBAN AN (4 – 35) Account number in IBAN format. 0..1<br />

GetBalance/Date D Balance data. Defaulting to current day. 0..1<br />

Example response XML<br />

<br />

<br />

<br />

2007-08-20<br />

<br />

LT117300010000131196<br />

HABALT2X<br />

<br />

<br />

<br />

<br />

-301.07<br />

0.00<br />

0.00<br />

-301.07<br />

<br />

<br />

-100.00<br />

0.00<br />

0.00<br />

-100.00<br />

<br />

<br />

22


<br />

<strong>Description</strong> of fields in response XML<br />

Balance<br />

One Balance element for each account 1..*<br />

in response.<br />

Balance/Date D Balance date. If none was given in request,<br />

1..1<br />

bank’s operation date.<br />

Balance/AccountInfo<br />

One AccountInfo element in each Balance<br />

1..1<br />

element.<br />

Balance/AccountInfo/IBAN AN (4 - 35) Account number 1..1<br />

Balance/AccountInfo/BIC AN (8) Responding bank BIC code 1..1<br />

Balance/AccountInfo/BankName CDATA Responding bank name 1..1<br />

Balance/Currencies<br />

One Currencies element in each Balance<br />

1..1<br />

element.<br />

Balance/Currencies/Currency<br />

One Currency element for each currency<br />

0..*<br />

on given account.<br />

Balance/Currencies/Currency/@id A (3) Currency code is returned as id<br />

1..1<br />

attribute of Currency element.<br />

Balance/Currencies/Currency/Deposit N Account balance 1..1<br />

Balance/Currencies/Currency/Reserved N Total of reservations 1..1<br />

Balance/Currencies/Currency/Credit N Overdraft limit 1..1<br />

Balance/Currencies/Currency/Available N Deposit – Reserved + Credit 1..1<br />

23


<strong>Service</strong> – Payment<br />

<strong>Service</strong> description<br />

Payment is a customer-initiated query. Customer can send one or more payments with one request.<br />

There are different payment formats supported in SGW - native formats for domestic and foreign<br />

payments (with country-specific differences between Estonian, Latvian and Lithuanian domestic<br />

payments) are described in detail here in this document. Additionally ISO20022 format<br />

pain.001.001.02 and pain.002.001.02 messages are supported – detailed implementation guidelines<br />

can be found in http://dev.hansagateway.net/download/SGW_ISO20022_IMPL.pdf. Access to this<br />

SGW development toolbox download site http://dev.hansagateway.net/download is IP-address<br />

based.<br />

Like all other SGW services, payments are in one XML file contained in encrypted and signed Digi-<br />

Doc. <strong>Swedbank</strong> responds with one or more status reports as payments are being processed.<br />

Every SGW agreement has agreement specific limits for payments (daily limit usage is reset every<br />

midnight, monthly limit usage is reset at midnight on the first of every month) and call-back limit that<br />

every payment is checked against. SGW agreement may have a list of users who are permitted to<br />

make transactions (operations like payment and currency exchange) with daily and monthly limits of<br />

their own. Limits are defined in local currency and payment amount is checked against them after<br />

being converted into local currency using central bank rate. SGW agreement enables setting doubleacceptance<br />

condition to transactions per account, when this condition is activated SGW requires at<br />

least two authorized users’ signatures in the request.<br />

Payment service requires that DigiDoc file containing payments is signed by Client’s ERP certificate<br />

and by at least one user with Signing certificate. The SGW agreement is located using the ERP certificate<br />

(as it is done with other services) while user Signing certificates define users and their access<br />

rights to the accounts that payments are made from. If more than one user has signed payments<br />

then SGW will try to use limits of users in the order the users have signed the DigiDoc file. If first user<br />

does not have enough available limits, next user’s limit is checked and so on. If no user has enough<br />

available limit left for given payment, that payment will fail with error code showing whether it was<br />

daily limit or monthly limit that was not enough (daily limit is checked first). If payment amount exceeds<br />

the checking limit in the agreement, payment will be made only after back-office employee has<br />

called and verified payment, but limits (both daily and monthly limits for both user and agreement)<br />

are used during initial processing by SGW.<br />

Example request XML<br />

<br />

<br />

<br />

<br />

C1_D_EE_01<br />

C1_D_EE_01<br />

2007-08-14<br />

N<br />

EE352200221000127267<br />

6.78<br />

EUR<br />

EE922200221010214144<br />

ÕU'NEILL<br />

B4B Estonian Domestic payment, Happy1 - 1<br />

7605262<br />

24


<br />

C1_D_LT_01<br />

C1_D_LT_01<br />

2007-08-14<br />

N<br />

LT257300010161511493<br />

2.45<br />

LTL<br />

LT617300010071014501<br />

ŠÄÄKAL PÜVI<br />

B4B Lithuanin Domestic payment, Happy1 - 1<br />

<br />

<br />

C1_D_LV_01<br />

C1_D_LV_01<br />

2007-08-14<br />

N<br />

LV35HABA0551000141298<br />

1.24<br />

USD<br />

LV13UNLA0001001609573<br />

Maris<br />

B4B Latvian Domestic payment, Happy1 - 1<br />

LV<br />

UNLALV2X<br />

<br />

<br />

C1FLT01<br />

1<br />

2007-08-14<br />

N<br />

LT257300010161511493<br />

6.31<br />

LTL<br />

USD<br />

Peatänav 4 - 14, Tallinn, Eesti Vabariik<br />

Toomas Nipi<br />

LB<br />

B4B Lithuanian Foreign payment, Happy1 - 1<br />

O<br />

200<br />

EE<br />

<br />

Hansabank<br />

HABAEE2X<br />

EE922200221010214144<br />

<br />

<br />

<br />

<br />

<strong>Description</strong> of fields in request XML<br />

At the moment there are four different payment types supported by SGW.<br />

Payments 1..1<br />

25


Estonian domestic payment<br />

Payments/DomesticPaymentEE 0..*<br />

ID AN (1 - 50) Id of a payment. We suggest it to be unique in 1..1<br />

payment file. This value is not shown to beneficiary.<br />

DocumentNumber AN (1 – 8) Document number of payment shown to 1..1<br />

beneficiary.<br />

ValueDate D YYYY-MM-DD 1..1<br />

Priority A (1) ‘N’ = Normal 1..1<br />

RemitterIBAN AN (4 - 35) Payer account number. Needs to be in IBAN 1..1<br />

format.<br />

Amount N Needs to be positive. ‘.’ is used as decimal 1..1<br />

separator.<br />

Currency A (3) 1..1<br />

BeneficiaryIBAN AN (4 – 35) Beneficiary account in IBAN format. 1..1<br />

BeneficiaryName AN (1 – 70) 1..1<br />

Details AN (0 – 300) Either details or reference number may be<br />

missing.<br />

ReferenceNumber AN (0 – 20) Either details or reference number may be<br />

missing.<br />

Latvian domestic payment<br />

Payments/DomesticPaymentLV 0..*<br />

ID AN (1 - 50) Id of a payment. We suggest it to be unique in 1..1<br />

payment file. This value is not shown to beneficiary.<br />

DocumentNumber AN (1 – 10) Document number of payment shown to beneficiary.<br />

1..1<br />

ValueDate D YYYY-MM-DD 1..1<br />

Priority A (1) ‘N’ = Normal, ‘U’ = Urgent 1..1<br />

RemitterIBAN AN (4 - 35) Payer account number. Needs to be in IBAN 1..1<br />

format.<br />

Amount N Needs to be positive. ‘.’ is used as decimal 1..1<br />

separator.<br />

Currency A (3) 1..1<br />

BeneficiaryIBAN AN (4 – 35) Beneficiary account in IBAN format. 1..1<br />

BeneficiaryID AN (1 – 15) 0..1<br />

BeneficiaryName AN (1 – 70) 1..1<br />

Details AN (0 – 300) 1..1<br />

BudgetCode N (0 – 10) 0..1<br />

BeneficiaryResidence A (2) Country code 1..1<br />

BalanceOfPaymentsCode N (3) Mandatory from 1000 LVL (or equivalent) 0..1<br />

when latvian resident is paying to a nonresident.<br />

BeneficiaryBankCode AN (8 – 11) SWIFT 1..1<br />

0..1<br />

0..1<br />

26


Lithuanian domestic payment<br />

Payments/DomesticPaymentLT 0..*<br />

ID AN (1 - 50) Id of a payment. We suggest it to be unique in 1..1<br />

payment file. This value is not shown to beneficiary.<br />

DocumentNumber AN (1 – 10) Document number of payment shown to beneficiary.<br />

1..1<br />

ValueDate D YYYY-MM-DD 1..1<br />

Priority A (1) ‘N’ = Normal, ‘U’ = Urgent. 1..1<br />

RemitterIBAN AN (4 - 35) Payer account number. Needs to be in IBAN 1..1<br />

format.<br />

Amount N Needs to be positive. ‘.’ is used as decimal 1..1<br />

separator.<br />

Currency A (3) 1..1<br />

BeneficiaryIBAN AN (4 – 35) Beneficiary account in IBAN format. 1..1<br />

BeneficiaryName AN (1 – 200) 1..1<br />

Details AN (0 – 300) 1..1<br />

ReferenceNumber AN (0 – 28) 0..1<br />

ReferenceToPayer AN (1 – 16) 0..1<br />

BeneficiaryRegistrationCode AN (1 – 15) 0..1<br />

ReferenceToBeneficiary AN (1 – 16) 0..1<br />

OrderingParty 0..1<br />

OrderingParty/Account AN (4 – 35) 0..1<br />

OrderingParty/Id AN (1 – 11) 0..1<br />

OrderingParty/Name AN (1 – 140) 0..1<br />

Assignee 0..1<br />

Assignee/Account AN (4 – 35) 0..1<br />

Assignee/Id AN (1 – 11) 0..1<br />

Assignee/Name AN (1 – 140) 0..1<br />

Foreign payment<br />

Payments/ForeignPayment 0..*<br />

ID AN (1 - 50) Id of a payment. We suggest it to be 1..1<br />

unique in payment file. This value is not<br />

shown to beneficiary.<br />

DocumentNumber AN (1 – 8) Document number of payment shown to 1..1<br />

beneficiary.<br />

ValueDate D YYYY-MM-DD 1..1<br />

Priority A (1) ‘N’ = Normal, ‘U’ = Urgent, ‘E’ = Express. 1..1<br />

Costs A (1) EE and LT (‘O’ = commission is paid by<br />

remitter, ‘S’ = commission is shared between<br />

both parties)<br />

LV (‘O’ = commission is paid by remitter,<br />

‘B’ =commission is shared between parties<br />

1..1<br />

27


RemitterIBAN AN (4-35) Payer account number. Needs to be in 1..1<br />

IBAN format.<br />

Amount N Needs to be positive. ‘.’ is used as decimal 1..1<br />

separator.<br />

Currency A (3) 1..1<br />

DebitCurrency A (3) 1..1<br />

BeneficiaryName AN (1 – 70) 1..1<br />

Details AN (1 – 140) 1..1<br />

BeneficiaryAddress AN (1 - 70) 0..1<br />

BeneficiaryResidence A (2) Country code 1..1<br />

BalanceOfPaymentsCode N (3) EE, LV:Conditional->; LT - not used 0..1<br />

Mandatory as from 50,000 EUR equivalent<br />

for EE* and from 1000 LVL equivalent for<br />

LV**<br />

BalanceOfPaymentsCountry A (2) Country code<br />

1..1<br />

EE, LV:Conditional->; LT - not used<br />

BeneficiaryBank 1..1<br />

BeneficiaryBank/Name AN (1 - 140) 1..1<br />

BeneficiaryBank/BIC AN (8 – 11) Large chars. only 0..1<br />

BeneficiaryBank/Account AN (4 – 35) 1..1<br />

CorrespondentBank 0..1<br />

CorrespondentBank/Name AN (1 - 140) 1..1<br />

CorrespondentBank/BIC AN (8 – 11) 0..1<br />

CorrespondentBank/Account AN (4 – 35) 0..1<br />

IntermediaryBank 0..1<br />

IntermediaryBank/Name AN (1 - 140) 1..1<br />

IntermediaryBank/BIC AN (8 – 11) 0..1<br />

IntermediaryBank/Account AN (4 – 35) 0..1<br />

* Estonian codes: http://www.eestipank.ee/en/transaction-codes-used-case-payments-originatedclients-credit-institutions<br />

** Latvian codes: http://www.bank.lv/en/legal/list-of-external-payment-codes-lepc-21<br />

Example response XML<br />

As above example has payments from three different countries (domestic payment in Estonia, domestic<br />

payment in Latvia, domestic payment and foreign payment in Lithuania), there will be at least<br />

three responses to it (each country processes payments separately).<br />

If for some reason it is not possible to debit domestic payments during first processing (customer<br />

might not have had enough money on account or payment’s value date is later than banking day are<br />

most common reasons for it), domestic payment will be first put into processing state. There will be a<br />

separate status report about payment when it has been processed further.<br />

<br />

<br />

<br />

<br />

28


<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<strong>Description</strong> of fields in response XML<br />

B4B/PaymentStatus Root element of status report 1..1<br />

PaymentStatus/Payment Payment details 1..*<br />

Payment @ id AN (1 - 50) Payment id assigned by remitter 1..1<br />

Payment @ status A success/failed/processing – state of payment 1..1<br />

Payment @ bankReference<br />

N (16) For payment in success state <strong>Swedbank</strong> <strong>Gateway</strong><br />

also reports reference to debiting operation.<br />

Payment @ error A For payment in failed state <strong>Swedbank</strong> <strong>Gateway</strong> reports<br />

the reason of failure.<br />

0..1<br />

0..1<br />

29


<strong>Service</strong> – Account statement<br />

<strong>Service</strong> description<br />

Customer can use this service to request a list of transactions on account in a given period. The period<br />

range can be up to 365 days. If the period also includes current day, the request is charged – also<br />

the service Current Day Statement has to be activated in SGW agreement. Account statement is returned<br />

in one or more responses with one response containing up to 10 000 transaction records (this<br />

is a current limit which might change). Statement/Partial element’s value in response XML is used to<br />

show if this response is last part of statement or not (“Complete” means last part, “Partial” being the<br />

opposite).<br />

Example request XML<br />

<br />

<br />

2007-06-09<br />

2007-06-17<br />

EE392200221011508011<br />

<br />

<strong>Description</strong> of fields in request XML<br />

AccountStatement 1..1<br />

StartDate D Request validation will return error if StartDate is later 1..1<br />

than EndDate or missing.<br />

EndDate D Request validation will return error is EndDate is later than 1..1<br />

previous day or missing.<br />

IBAN AN (4 – 35) Account number 1..1<br />

Example response XML<br />

<br />

<br />

<br />

<br />

EE392200221011508011<br />

HABAEE2X<br />

<br />

<br />

complete<br />

<br />

2007-06-09<br />

2007-06-17<br />

<br />

<br />

<br />

<br />

<br />

<br />

45010.12<br />

35027.12<br />

<br />

<br />

MK<br />

30


2007-06-14<br />

2007-05-11<br />

2007061400000190<br />

4<br />

<br />

-1.00<br />

<br />

<br />

<br />

EE482200221011515415<br />

<br />

<br />

<br />

TT<br />

2007-06-14<br />

2007061400000190<br />

<br />

-2.00<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

X<br />

2007-06-14<br />

2007061400000238<br />

EUR 636.74 kurss 15.6735]]><br />

-9980.00<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

1023.23<br />

1659.97<br />

<br />

<br />

X<br />

2007-06-14<br />

2007061400000238<br />

EUR kurss 15.6735]]><br />

636.74<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

475.00<br />

475.00<br />

<br />

31


<br />

<strong>Description</strong> of fields in response XML<br />

B4B/Statement 1..1<br />

AccountInfo Container element inside B4B/Statement 1..1<br />

AccountInfo/IBAN AN (4 – 35) Account number 1..1<br />

AccountInfo/BIC AN (8) Bank code of responding bank 1..1<br />

AccountInfo/BankName CDATA Name of responding bank 1..1<br />

Partial A Partial/Complete 1..1<br />

Page D 1..1<br />

Period Container element inside B4B/Statement 1..1<br />

Period/StartDate D Start date from request 1..1<br />

Period/EndDate D End date from request 1..1<br />

Customer Container element inside B4B/Statement 1..1<br />

Customer/Name CDATA Name of account owner 1..1<br />

Customer/LegalID CDATA Registration number of account owner 1..1<br />

Currency Container element inside B4B/Statement 0..*<br />

Currency @ id A (3) Currency code is given in id attribute of 1..1<br />

Currency element<br />

Currency/OpeningBalance N 1..1<br />

Currency/ClosingBalance N 1..1<br />

Currency/Transactions<br />

Container element inside Statement/Currency<br />

1..1<br />

Transactions/Transaction 0..*<br />

Transaction/TypeCode AN (5) Values are different in EE, LV, LT, see following<br />

1..1<br />

tables. Codes are used to auto-<br />

matically filter or summarize different<br />

types of transactions, for example Bank's<br />

service fees.<br />

Transaction/TransactionDate D 1..1<br />

Transaction/ReferenceDate D Document date 0..1<br />

Transaction/BankReference N (16) 1..1<br />

Transaction/DocumentNumber AN (1 – 30) Payment document number 0..1<br />

Transaction/ReferenceNumber AN (1 – 60) Reference to beneficiary 0..1<br />

Transaction/<strong>Description</strong> CDATA 1..1<br />

Transaction/Amount N 1..1<br />

Transaction/ReferenceToPayer AN (1 - 16) Reference number (Lithuanian) 0..1<br />

Transaction/Counterparty<br />

Container element inside Transactions/Transaction<br />

1..1<br />

Counterparty/Name CDATA 1..1<br />

Counterparty/LegalID CDATA 1..1<br />

Counterparty/IBAN AN (4 – 35) 1..1<br />

32


Counterparty/BIC Latvian specific 1..1<br />

Counterparty/<br />

ReferenceToBeneficiary<br />

Transaction/OrderingParty<br />

AN (1 - 16) Lithuanian-specific 0..1<br />

Container element inside Transactions/Transaction.<br />

Used for Lithuanian<br />

payments.<br />

OrderingParty/Account AN (4 – 35) 0..1<br />

OrderingParty/Id AN (1 – 11) 0..1<br />

OrderingParty/Name AN (1 – 140) 0..1<br />

Transaction/Assignee<br />

Container element inside Transactions/Transaction.<br />

0..1<br />

Used for Lithuanian<br />

payments.<br />

Assignee/Account AN (4 – 35) 0..1<br />

Assignee/Id AN (1 – 11) 0..1<br />

Assignee/Name AN (1 – 140) 0..1<br />

0..1<br />

Latvian codes for Transaction/TypeCode<br />

Value<br />

OB<br />

CB<br />

K2<br />

T2<br />

PRV<br />

MK<br />

IEM<br />

IZM<br />

INB<br />

IZP<br />

CTX<br />

SOD<br />

EXC<br />

CQA<br />

KOM<br />

DKA<br />

DPL<br />

AUT<br />

AIA<br />

AZA<br />

SEC<br />

TBP<br />

<strong>Description</strong><br />

Opening balance<br />

Closing balance<br />

Turnover<br />

Fees amount<br />

Internal transfer<br />

Domestic currency payment<br />

Cash lodgement<br />

Cash withdrawal<br />

Incoming transfer<br />

Outgoing transfer<br />

Payment card transactions<br />

Standing order<br />

Currency exchange<br />

Cashing of a cheque<br />

Comission for cash withdrawal/ Comission for a transfer/ Cheques commission<br />

Deposit or escrow account opening<br />

Deposit breach or deal settlement<br />

End of deposit<br />

Accrued interest payment into account<br />

Loan repayment<br />

Securities operations<br />

T-bill purchase<br />

33


TBC<br />

7DN<br />

IKS<br />

T-bill comission<br />

Amount booking<br />

Cash delivery<br />

Estonian codes for Transaction/TypeCode<br />

Value<br />

TT<br />

MK<br />

MV<br />

MP<br />

M<br />

K<br />

X<br />

I<br />

PT<br />

MD<br />

S<br />

<strong>Description</strong><br />

<strong>Service</strong> charge - indicating that the transaction was Bank's service fee<br />

Domestic payment order - i.e. regular payment inside the value country<br />

International payment order<br />

Consolidated payment<br />

Other charges<br />

Card transaction<br />

Currency transaction<br />

Interest<br />

Standing order service charges<br />

Deposits<br />

Cash operation<br />

Lithuanian codes for Transaction/TypeCode<br />

Value<br />

AS<br />

LS<br />

K1<br />

K2<br />

MK<br />

DP<br />

MV<br />

S<br />

IM<br />

IMG<br />

IMB<br />

IME<br />

MD<br />

MP<br />

<strong>Description</strong><br />

Opening balance<br />

Closing balance<br />

Daily turnover<br />

Account turnover over the specified period<br />

Payment orders within the bank and between banks<br />

incorporated in Lithuania, in LTL and currency<br />

Debit orders and collections<br />

International payment orders<br />

Cash operation<br />

Payments<br />

Payments in cash in a branch<br />

Payments in a branch (transfer)<br />

Payments via Internet bank<br />

Operation related to the deposit<br />

Mass payment<br />

34


DD<br />

X<br />

K<br />

TS<br />

M<br />

I<br />

AI<br />

PV<br />

TT, TT1-TT10<br />

TT11<br />

TT12<br />

TT13<br />

TT14<br />

T2<br />

G<br />

PT<br />

CTX<br />

SMS<br />

S1<br />

BL<br />

Direct debit operation<br />

Currency conversion<br />

Card operation<br />

Operations with Bank, Traveller's Cheques<br />

Interest, manual debiting and crediting operations<br />

Interest, loan interest, overdrafts<br />

Accrued interest<br />

Value added tax<br />

Charges<br />

Operation related to the loan<br />

Information on accounts, document processing and sending<br />

Direct debit fees<br />

Account maintenance fee, payment fee<br />

Total charges<br />

Total charges<br />

Charge for regular payment order<br />

Payments via ATM (automated teller machines)<br />

Payment via SMS (mobile bank)<br />

Balance<br />

Bank link payments<br />

35


<strong>Service</strong> – Exchange rates<br />

<strong>Service</strong> description<br />

Customer can use this service to request currency exchange rates from different countries in <strong>Swedbank</strong>.<br />

SGW is providing currency rates for cash exchange (only current rate), local central bank (current<br />

rate and history) and currency exchange on account (current rate and history). It is possible to<br />

query rates for one, several or all rated currencies.<br />

Error SGWException is sent if period requested is in future, past rates for cash exchange are requested<br />

or BIC of wrong bank is given. It is also possible that requested transaction type is not allowed<br />

for some of given currencies in which case SGWException error is also sent.<br />

Response data is ordered by currency code and rate date. In case of central bank rates (ExchangeRateType<br />

is Central in request XML), buy and sell rates for currency are same.<br />

Example request XML<br />

<br />

<br />

HABAEE2X<br />

Transfer<br />

2007-06-27<br />

2007-07-01<br />

<br />

USD<br />

NOK<br />

EUR<br />

<br />

<br />

<strong>Description</strong> of fields in request XML<br />

ExchangeRateRequest Root element of request document 1..1<br />

BIC AN (8) Code of bank that should respond (HABAEE2X for Estonian,<br />

1..1<br />

HABALV2X for Latvian and HABALT2X for Lithua-<br />

nian branch)<br />

ExchangeRateType A Transfer/Cash/Central 1..1<br />

StartDate D If not given, current banking day is used 0..1<br />

EndDate D If not given, current banking day is used 0..1<br />

Currencies<br />

Container element for currencies listing. If not given, all 0..1<br />

allowed currencies are listed in response<br />

Currencies/Currency A (3) 1..*<br />

Example response XML<br />

<br />

<br />

<br />

HABAEE2X<br />

36


Transfer<br />

<br />

<br />

EUR<br />

15.62000<br />

15.67350<br />

<br />

<br />

EUR<br />

15.62000<br />

15.67350<br />

<br />

<br />

NOK<br />

1.96000<br />

1.99200<br />

<br />

<br />

NOK<br />

1.96000<br />

1.99200<br />

<br />

<br />

USD<br />

12.25400<br />

12.48850<br />

<br />

<br />

USD<br />

12.25400<br />

12.48850<br />

<br />

<br />

<br />

<br />

<strong>Description</strong> of fields in response XML<br />

B4B/ExchangeRateResponse Container element for response 1..1<br />

BIC AN (8) Code of bank responding 1..1<br />

ExchangeRateType A Transfer/Cash/Central 1..1<br />

ExchangeRateInfo<br />

Container element for currencies listing 1..1<br />

in ExchangeRateResponse element.<br />

ExchangeRateInfo @ BaseCurrency A (3) Currency against what rates are given 1..1<br />

by bank is contained in BaseCurrency<br />

attribute.<br />

CurrencyInfo<br />

Container element for currency info in 0..*<br />

ExchangeRateInfo element<br />

CurrencyInfo @ Date D Date parameter of CurrencyInfo element.<br />

1..1<br />

CurrencyInfo/Currency A (3) 1..1<br />

CurrencyInfo/Buy N Bank buys at this rate 1..1<br />

CurrencyInfo/Sell N Bank sells at this rate 1..1<br />

37


<strong>Service</strong> – Currency exchange<br />

<strong>Service</strong> description<br />

Customer can use this service to perform currency exchange on given account. It is possible to specify<br />

worst acceptable rates for both currencies in currency exchange request and SGW will send error<br />

SGWException if any of rates offered by bank is not good enough to match them. SGW will also send<br />

error SGWException when there is not enough funds in sell currency on account or transactions are<br />

disabled in bank information system or given BIC does not belong to <strong>Swedbank</strong>.<br />

Response contains rates used and bank reference code if currency exchange is performed successfully.<br />

Example request XML<br />

<br />

<br />

HABAEE2X<br />

EE922200221010214144<br />

<br />

USD<br />

2500<br />

11.50811<br />

<br />

<br />

EUR<br />

15.638<br />

<br />

<br />

<strong>Description</strong> of fields in request XML<br />

BIC AN (8) BIC of <strong>Swedbank</strong>’s local branch (HABAEE2X for Estonian, 1..1<br />

HABALV2X for Latvian and HABALT2X for Lithuanian<br />

branch).<br />

IBAN AN (4 – 35) Account number where currency exchange is performed. 1..1<br />

Buy/Currency A (3) Currency that customer wishes to buy. 1..1<br />

Buy/Amount N Amount that customer wishes to buy. Has to be empty 0..1<br />

when sell amount is given, is calculated from sell<br />

amount then.<br />

Buy/Rate N When given, bank will perform exchange only if rate 0..1<br />

offered by bank is same or better than this.<br />

Sell/Currency A (3) Currency that customer wishes to sell. 1..1<br />

Sell/Amount N Amount that customer wishes to sell. Has to be empty<br />

when buy amount is given and is calculated from buy<br />

amount then.<br />

Sell/Rate N When given, bank will perform exchange only if rate<br />

offered by bank is same or better than this.<br />

0..1<br />

0..1<br />

38


Example response XML<br />

<br />

<br />

<br />

HABAEE2X<br />

EE562200221008103199<br />

2007070200000195<br />

<br />

USD<br />

2500.00<br />

12.48850<br />

<br />

<br />

EUR<br />

1998.80<br />

15.62000<br />

<br />

<br />

<br />

<strong>Description</strong> of fields in response XML<br />

B4B/CurrencyExchangeResponse Container element for response 1..1<br />

BIC AN (8) Code of bank responding 1..1<br />

IBAN AN (4 – 35) Account number where currency exchange<br />

1..1<br />

is performed.<br />

BankReference N (16) Bank reference for operation 1..1<br />

Buy/Currency A (3) Currency that customer bought 1..1<br />

Buy/Amount N Amount that customer bought 1..1<br />

Buy/Rate N 1..1<br />

Sell/Currency A (3) Currency that customer sold 1..1<br />

Sell/Amount N Amount that customer sold 1..1<br />

Sell/Rate N 1..1<br />

ExchangeRateType A Transfer 1..1<br />

ExchangeRateInfo<br />

Container element for currencies listing<br />

in ExchangeRateResponse element.<br />

1..1<br />

39


<strong>Service</strong> – Alert on transactions<br />

<strong>Service</strong> description<br />

It is possible for a customer to get a notification about every transaction that is done on a given account.<br />

This chargeable service has to be activated for every account through SGW agreement and<br />

customer can choose to be notified about incoming payments or outgoing payments. Additionally<br />

alerts can be filtered by currency and amount – only transactions in certain currency and exceeding<br />

the specified amount in that currency will send a notification.<br />

It is important to mention that alert message xml is only encrypted. We do not add bank signature<br />

there.<br />

For every transaction matching the filter set in SGW agreement a message is created for each ERP<br />

certificate assigned to the agreement. Message is waiting to be picked up for 24 hours, after which it<br />

will be deleted from the system.<br />

Example request XML<br />

There is no request – bank is generating these messages based on SGW agreement details.<br />

Example response XML<br />

It differs from statement response only by different container element (Alert instead of Statement)<br />

and missing statement-specific elements (Period, Partial and starting-ending balances for currency).<br />

<br />

<br />

<br />

<br />

EE922200221010214144<br />

HABAEE2X<br />

<br />

<br />

<br />


<br />

<br />

<br />

<br />

<br />

<strong>Description</strong> of fields in response XML<br />

B4B/Alert 1..1<br />

AccountInfo<br />

Container element inside<br />

1..1<br />

B4B/Alert<br />

AccountInfo/IBAN AN (4 – 35) Account number 1..1<br />

AccountInfo/BIC AN (8) Bank code of responding bank 1..1<br />

AccountInfo/BankName CDATA Name of responding bank 1..1<br />

Customer<br />

Container element inside<br />

1..1<br />

B4B/Statement<br />

Customer/Name CDATA Name of account owner 1..1<br />

Customer/LegalID CDATA Registration number of account 1..1<br />

owner<br />

Currency<br />

Container element inside<br />

1..1<br />

B4B/Alert<br />

Currency @ id A (3) Currency code is given in id 1..1<br />

attribute of Currency element<br />

Currency/Transactions<br />

Container element inside Alert 1..1<br />

/Currency<br />

Transactions/Transaction<br />

Container element inside Currency/Transactions<br />

0..*<br />

Transaction/TypeCode AN (2) 1..1<br />

Transaction/TransactionDate D 1..1<br />

Transaction/ReferenceDate D Document date 0..1<br />

Transaction/BankReference N (16) 1..1<br />

Transaction/DocumentNumber AN (1 – 30) Payment document number 0..1<br />

Transaction/ReferenceNumber AN (1 – 60) Reference to beneficiary 0..1<br />

Transaction/<strong>Description</strong> CDATA 1..1<br />

Transaction/Amount N 1..1<br />

Transaction/ReferenceToPayer AN (1 - 16) Lithuanian-specific 0..1<br />

Transaction/Counterparty<br />

Container element inside Transactions/Transaction<br />

1..1<br />

Counterparty/Name CDATA 1..1<br />

Counterparty/LegalID CDATA 1..1<br />

Counterparty/IBAN AN (4 – 35) 1..1<br />

Counterparty/BIC Latvian specific 1..1<br />

Counterparty/ReferenceToBeneficiary AN (1 - 16) Lithuanian-specific 0..1<br />

Transaction/OrderingParty<br />

Container element inside Transactions/Transaction.<br />

Used for<br />

lithuanian payments.<br />

0..1<br />

41


OrderingParty/Account AN (4 – 35) 0..1<br />

OrderingParty/Id AN (1 – 11) 0..1<br />

OrderingParty/Name AN (1 – 140) 0..1<br />

Transaction/Assignee<br />

Container element inside Transactions/Transaction.<br />

0..1<br />

Used for<br />

lithuanian payments.<br />

Assignee/Account AN (4 – 35) 0..1<br />

Assignee/Id AN (1 – 11) 0..1<br />

Assignee/Name AN (1 – 140) 0..1<br />

42


<strong>Service</strong> – Periodic statement<br />

<strong>Service</strong> description<br />

It is possible for a customer to get an account statement automatically according to global schedule<br />

bank is using for all regular statements (This is once per day and bank will try to send it before midday).<br />

Statement will be generated for previous day from 00:00 until 24:00. If no transactions are<br />

made on that day, empty statement will be generated.<br />

Every statement is encrypted for Client ERP certificate tied to given SGW agreement.<br />

Example request XML<br />

There is no request – bank is generating these messages based on SGW agreement details.<br />

Example response XML<br />

Start date is either current banking day (for first statement) or day of the last operation in previous<br />

statement. End date is always current banking day. Otherwise it is just like an account statement. If<br />

there were no transactions since previous statement’s last operation, an empty statement is returned.<br />

43


<strong>Service</strong> – Sending e-invoices<br />

Before using this service, it is important to know the terms and conditions of e-invoicing service!<br />

Separate E-invoice seller agreement must be signed.<br />

<strong>Service</strong> description<br />

SGW allows customers to send e-invoices to their customers. This service differs from other SGW<br />

services a little because it requires two .xml documents in a DigiDoc container – one that SGW uses<br />

to locate e-invoice agreement for customer and the other containing the actual e-invoices. SGW is<br />

sending this container file to e-invoices processor and responds to customer with processing result.<br />

SGW requires that in case of several files in one DigiDoc container, request file name has to end with<br />

“–request.xml”. That file is processed as SGW request .xml and validated against hgw.xsd.<br />

Example request XML<br />

<br />

<br />

einvoices.xml <br />

EE<br />

12345<br />

<br />

<strong>Description</strong> of fields in request XML<br />

Filename AN Name of the payload file in DigiDoc container. 1..1<br />

CountryCode A (2) Country code – can be omitted if customer has SGW 0..1<br />

agreement in only one country. EE/LV/LT otherwise.<br />

ContractId AN E-invoice seller agreement number. 1..1<br />

Example response XML<br />

<br />

<br />

<br />

<br />

8<br />

2<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

44


<strong>Description</strong> of fields in response XML<br />

B4B/ImportResult 1..1<br />

Statistics<br />

Container element inside<br />

1..1<br />

B4B/ImportResult<br />

Statistics/TotalCount N Number of e-invoices found in 1..1<br />

payload .xml<br />

Statistics/DefectiveCount N Number of e-invoices with errors. 1..1<br />

DefectiveInvoices<br />

Container element inside<br />

1..1<br />

B4B/ImportResult<br />

Invoice<br />

Container element for each defective<br />

0..*<br />

e-invoice<br />

Invoice @ invoiceId AN ID for defective invoice 1..1<br />

Invoice/Errors Container inside Invoice 1..1<br />

Errors/Error<br />

Element for error code for each<br />

error<br />

Error @ id N Error code used by e-invoice processor.<br />

1..*<br />

1..1<br />

45


<strong>Service</strong> – E-Invoices for customer<br />

<strong>Service</strong> description<br />

Customer can choose SGW as a channel to receive e-invoices meant for him/her (purchase invoices).<br />

SGW is periodically checking for unread e-invoices and sends their content .xml (without applying<br />

supplier’s style sheets) encrypted with client’s ERP public key. Forwarded e-invoices are also marked<br />

as “downloaded” so they will not show as “unread” in other electronic channels (like Internet bank).<br />

Example request XML<br />

There is none – bank is generating these messages based on SGW agreement details.<br />

Example response XML<br />

This depends on e-invoice processing.<br />

46


<strong>Service</strong> – Direct debit payer agreement management<br />

Before using this service it is important to know the terms and conditions of Direct Debit service!<br />

Separate direct debit beneficiary agreement must be signed.<br />

<strong>Service</strong> description<br />

Updates in client’s information system regarding new Direct Debit agreements and/or closed existing<br />

Direct Debit agreements can be synchronized with the Bank using this service.<br />

Example request XML<br />

<br />

<br />

<br />

EE<br />

12345<br />

<br />

<br />

<br />

1<br />

ADD<br />

<br />

3764444444<br />

EE082200001100701729<br />

Püvi<br />

<br />

1500.12<br />

EEK<br />

123000123<br />

654654<br />

456456<br />

<br />

12<br />

15<br />

<br />

<br />

2008-08-14<br />

2012-07-14<br />

<br />

<br />

<br />

2<br />

REMOVE<br />

<br />

3764444444<br />

EE082200001100701729<br />

1<br />

Püvi<br />

<br />

123000123<br />

<br />

<br />

<br />

47


<strong>Description</strong> of fields in request XML<br />

Header/BeneficiaryAgreement N (1 – 16) Direct debit beneficiary agreement 1..1<br />

number.<br />

Header/CountryCode A (2) Country code – EE/LV/LT. 1..1<br />

Agreements/Agreement<br />

Container element for each agreement 0..*<br />

add/remove request<br />

Agreement/SequenceNumber N Agreement change id 1..1<br />

Agreement/Operation ADD/REMOVE Operation code<br />

Agreement/Payer<br />

Container for payer agreement owner 1..1<br />

data<br />

Payer/Name A (1 – 200) Payer name 1..1<br />

Payer/AccountNumber AN (1 – 35) Payer account number 1..1<br />

Payer/AgreementNumber N (1 – 16) Payer agreement number (used for 1..1<br />

REMOVE operation)<br />

Payer/RegistrationNumber A Payer registration number 1..1<br />

Agreement/Limit N Payer agreement debiting limit (used 0..1<br />

for ADD operation)<br />

Agreement/CurrencyCode A (3) Debiting limit currency (used for ADD 0..1<br />

operation in LV)<br />

Agreement/ReferenceNumber AN (1 – 20) Reference number for payer 1..1<br />

Agreement/Utility AN (0 – 25) Utility code (used in LV for ADD operation)<br />

0..1<br />

Agreement/Discount AN (0 – 25) Discount code (used in LV for ADD operation)<br />

0..1<br />

Agreement/DebitingPeriod<br />

Container for debiting period, used for 0..1<br />

ADD operation<br />

DebitingPeriod/From N First day of debiting period, cannot be a 1..1<br />

date in the past or in current month<br />

DebitingPeriod/To N Last day of debiting period 1..1<br />

Agreement/AgreementValid<br />

Container for agreement period, used 0..1<br />

for ADD operation.<br />

AgreementValid/From D First date of period 1..1<br />

AgreementValid/To D Last date of period 1..1<br />

Example response XML<br />

<br />

<br />

<br />

<br />

EE<br />

12345<br />

<br />

<br />

2<br />

0<br />

1<br />

1<br />

<br />

<br />

48


<br />

<br />

<br />

<br />

<strong>Description</strong> of fields in response XML<br />

B4B/DirectDebitImportResult 1..1<br />

Header/CountryCode A (2) Country code 1..1<br />

Header/BeneficiaryAgreement N (1 – 16) Direct debit beneficiary agreement 1..1<br />

number.<br />

Statistics/TotalCount N Total number of agreements<br />

1..1<br />

processed by given processor<br />

Statistics/DefectiveCount N Number of agreements that failed 1..1<br />

validation<br />

Statistics/RemovedCount N Number of agreements that were 1..1<br />

removed<br />

Statistics/InsertedCount N Number of new agreements 1..1<br />

Agreements/Agreement<br />

Container for every processed 0..*<br />

agreement<br />

Agreement @ recordId N Sequence number from request XML 1..1<br />

Agreement @ operation ADD/REMOVE Operation code from request XML 1..1<br />

Agreement @ agreementNumber N (1 – 16) Agreement number for created payer<br />

0..1<br />

agreement<br />

Agreement/Errors<br />

Container for errors for given agreement<br />

0..1<br />

change operation<br />

Errors/Error Element for every error 1..*<br />

Error @ id A Error code 1..1<br />

49


<strong>Service</strong> – Direct debit payer agreement changes<br />

Before using this service, it is important to know the terms and conditions of Direct Debit service!<br />

Separate direct debit beneficiary agreement must be signed.<br />

<strong>Service</strong> description<br />

This service is used to notify the client about changed payer agreements for every direct debit beneficiary<br />

agreement.<br />

Example request XML<br />

There is none – bank is generating these messages based on SGW agreement details.<br />

Example response XML<br />

This is inverse of previous service. So XML sent by bank has same structure as customer’s request in<br />

that service. The bank does not expect any response to these messages and responds with XML validation<br />

error if one is sent.<br />

<br />

<br />

<br />

<br />

LV<br />

12345<br />

<br />

<br />

<br />

1<br />

REMOVE<br />

<br />

JANA SHEHU<br />

LV94HABA0551006169465<br />

111704<br />

100628-11490<br />

<br />

1000.00<br />

LVL<br />

<br />

1234567<br />

<br />

<br />

<br />

<br />

<br />

2007-05-01<br />

2010-05-01<br />

<br />

<br />

<br />

2<br />

ADD<br />

<br />

OMAR BALLA<br />

50


LV48HABA0551006169614<br />

119298<br />

111<br />

<br />

125.00<br />

LVL<br />

<br />

125869<br />

<br />

<br />

<br />

<br />

<br />

2012-04-01<br />

<br />

<br />

<br />

<br />

<br />

<br />

51


<strong>Description</strong> of fields in response XML<br />

Header/BeneficiaryAgreement N (1 – 16) Direct debit beneficiary agreement 1..1<br />

number.<br />

Header/CountryCode A (2) Country code – EE/LV/LT. 1..1<br />

Agreements/Agreement<br />

Container element for each agreement 0..*<br />

add/remove request<br />

Agreement/SequenceNumber N Agreement change id 1..1<br />

Agreement/Operation ADD/REMOVE Operation code<br />

Agreement/Payer<br />

Container for payer agreement owner 1..1<br />

data<br />

Payer/Name A (1 – 200) Payer name 1..1<br />

Payer/AccountNumber AN (1 – 35) Payer account number 1..1<br />

Payer/AgreementNumber N (1 – 16) Payer agreement number 1..1<br />

Payer/RegistrationNumber A Payer registration number 1..1<br />

Agreement/Limit N Payer agreement debiting limit (used 0..1<br />

for ADD operation)<br />

Agreement/CurrencyCode A (3) Debiting limit currency (used for ADD 0..1<br />

operation in LV)<br />

Agreement/ReferenceNumber AN (1 – 20) Reference number for payer 1..1<br />

Agreement/Utility AN (0 – 25) Utility code (used in LV for ADD operation)<br />

0..1<br />

Agreement/Discount AN (0 – 25) Discount code (used in LV for ADD operation)<br />

0..1<br />

Agreement/DebitingPeriod<br />

Container for debiting period, used for 0..1<br />

ADD operation<br />

DebitingPeriod/From N First day of debiting period 1..1<br />

DebitingPeriod/To N Last day of debiting period 1..1<br />

Agreement/AgreementValid<br />

Container for agreement period, used 0..1<br />

for ADD operation.<br />

AgreementValid/From D First date of period 1..1<br />

AgreementValid/To D Last date of period 1..1<br />

52


<strong>Service</strong> – Direct debit payment requests<br />

Before using this service it is important to know the terms and conditions of Direct Debit service!<br />

Separate direct debit beneficiary agreement must be signed.<br />

<strong>Service</strong> description<br />

This service allows client to send payment requests to one or more payers with valid direct debit<br />

payer agreement. Although direct debit operation exists in all Baltic countries, local implementations<br />

differ – so our XML has different requirements for each country.<br />

Example request XML<br />

<br />

<br />

<br />

12345<br />

EE<br />

<br />

<br />

<br />

Payment description<br />

<br />

Customer name<br />

54321<br />

<br />

2008-08-12<br />

341.12<br />

123123<br />

<br />

<br />

<br />

<strong>Description</strong> of fields in request XML<br />

Header/BeneficiaryAgreement N (1 – 16) Direct debit beneficiary agreement 1..1<br />

number.<br />

Header/CountryCode A (2) Country code – EE/LV/LT. 1..1<br />

Payments/Payment<br />

Container element for each payment 0..*<br />

request<br />

Payment/Payer Container element for payer data 1..1<br />

Payer/Name AN (1 – 200) Name of the payer. Required in EE and 0..1<br />

LV.<br />

Payer/AccountNumber AN (1 – 35) Account number of the payer. Required 0..1<br />

in LT.<br />

Payer/Agreement N (1 – 16) Direct debit payer agreement number. 0..1<br />

Required in EE and LT.<br />

Payment/PaymentDate D Date of the payment. Required in EE and 0..1<br />

LV.<br />

Payment/CurrencyCode A (3) Currency of payment. Required in LV. EE 0..1<br />

and LT always use local currency.<br />

Payment/Amount N Amount of payment. 1..1<br />

53


Payment/<strong>Description</strong> AN (0 – 75) <strong>Description</strong> of payment 0..1<br />

Payment/ReferenceNumber AN (0 – 20) Reference number of payer 1..1<br />

Payment/Utility AN (0 – 25) Utility code. Required in LV. 0..1<br />

Payment/Discount AN (0 – 25) Discount code. Required in LV. 0..1<br />

Example response XML<br />

Direct debit payment requests are processed similarly to payments – initially the request is split into<br />

blocks of 500 payments (this number could change in time). After that SGW checks payer agreement<br />

data (if reference number matches given payer, payer name is correct and so on) and stores valid<br />

requests.<br />

Due to two-tier processing logic SGW responds to request with at least two messages. If there were<br />

more payment requests than the maximum block size of 500, then one response from SGW contains<br />

statistics about all of them and second message is sent for each block that has been processed.<br />

Structure for response file is still the same:<br />

<br />

<br />

<br />

<br />

EE<br />

12345<br />

<br />

<br />

1<br />

0<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

EE<br />

12345<br />

<br />

<br />

1<br />

1<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

54


<strong>Description</strong> of fields in response XML<br />

B4B/DirectDebitPaymentsImportResult 1..1<br />

DirectDebitImportResult @ from A (2 - 3) Processor id – HGW/EE/LV/LT 1..1<br />

Header/CountryCode A (2) Country code 1..1<br />

Header/BeneficiaryAgreement N (1 – 16) Direct debit beneficiary agreement<br />

1..1<br />

number.<br />

Statistics/TotalCount N Total number of payments 1..1<br />

processed by given processor<br />

Statistics/DefectiveCount N Number of payments that failed 1..1<br />

validation by given processor.<br />

DefectivePayments<br />

Container for defective payment 1..1<br />

listing<br />

DefectivePayments/Payment Container for payment data 0..*<br />

Payment @ recordId N Payment location in request file. 1..1<br />

Payment/Errors Container for payment errors 1..1<br />

Errors/Error Element for error code 1..*<br />

Error @ id A Validation error code 1..1<br />

55


<strong>Service</strong> – POS report delivery<br />

<strong>Service</strong> description<br />

This service is used as delivery channel for POS reports from the bank to the client.<br />

Example request XML<br />

There is no request – bank is generating these messages based on POS agreement and SGW agreement<br />

details.<br />

Example response XML<br />

Response XML is not generated by SGW, thus there is only 2 report types given as samples. Please<br />

refer to POS report generator documentation about details and XSD.<br />

Example 1: Transaction based report<br />

<br />

- <br />

- <br />

93201456<br />

Luuk OÜ<br />

LIIVALAIA 10<br />

Tallinn<br />

15040<br />

EE<br />

- <br />

9297565<br />

Luuk-LibakaupmeesI<br />

LIIVALAIA 8<br />

Tallinn<br />

15040<br />

221014217590<br />

ESTONIA<br />

- <br />

11060344515<br />

- <br />

041624<br />

2012-04-16<br />

2012-04-16<br />

2012-04-16<br />

2012-04-17<br />

- <br />

MasterCard<br />

Credit<br />

EU<br />

- <br />

Term<br />

2764<br />

000060<br />

2012-04-13<br />

11:40:20<br />

210854993993<br />

56


EUR<br />

3.95<br />

EUR<br />

3.95<br />

0.05<br />

3.90<br />

<br />

- <br />

Term<br />

3404<br />

000062<br />

2012-04-13<br />

14:32:05<br />

210854993994<br />

414364<br />

EUR<br />

4.75<br />

EUR<br />

4.75<br />

0.05<br />

4.70<br />

<br />

- <br />

Term<br />

- <br />

2<br />

EUR<br />

8.70<br />

<br />

2<br />

EUR<br />

8.70<br />

0.10<br />

8.60<br />

<br />

<br />

- <br />

<br />

Debit<br />

<strong>Swedbank</strong><br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

<br />

- <br />

Term<br />

- <br />

6<br />

EUR<br />

23.43<br />

<br />

6<br />

EUR<br />

23.43<br />

0.25<br />

23.18<br />

<br />

57


- <br />

Term<br />

- <br />

6<br />

EUR<br />

23.43<br />

<br />

6<br />

EUR<br />

23.43<br />

0.25<br />

23.18<br />

<br />

<br />

- <br />

Term<br />

- <br />

6<br />

EUR<br />

23.43<br />

<br />

6<br />

EUR<br />

23.43<br />

0.25<br />

23.18<br />

<br />

<br />

- <br />

Term<br />

- <br />

6<br />

EUR<br />

23.43<br />

<br />

6<br />

EUR<br />

23.43<br />

0.25<br />

23.18<br />

<br />

<br />

<br />

Example 2: Batch based report<br />

<br />

- <br />

- <br />

93201456<br />

Luuk OÜ<br />

LIIVALAIA 10<br />

Tallinn<br />

15040<br />

EE<br />

58


- <br />

9297565<br />

Luuk-Libakaupmees<br />

LIIVALAIA 8<br />

Tallinn<br />

15040<br />

221014217590<br />

ESTONIA<br />

- <br />

11060344515<br />

- <br />

040209<br />

2012-04-02<br />

2012-04-02<br />

2012-04-02<br />

2012-04-03<br />

- <br />

VISA<br />

Debit<br />

EU<br />

- <br />

Term<br />

- <br />

1<br />

EUR<br />

1.00<br />

<br />

1<br />

EUR<br />

1.00<br />

0.01<br />

0.99<br />

<br />

<br />

- <br />

Term<br />

- <br />

1<br />

EUR<br />

1.00<br />

<br />

1<br />

EUR<br />

1.00<br />

0.01<br />

0.99<br />

<br />

<br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

+ <br />

59


+ <br />

+ <br />

- <br />

Term<br />

- <br />

83<br />

EUR<br />

328.05<br />

<br />

83<br />

EUR<br />

328.05<br />

3.46<br />

324.59<br />

<br />

<br />

- <br />

Term<br />

- <br />

83<br />

EUR<br />

328.05<br />

<br />

83<br />

EUR<br />

328.05<br />

3.46<br />

324.59<br />

<br />

<br />

- <br />

Term<br />

- <br />

83<br />

EUR<br />

328.05<br />

<br />

83<br />

EUR<br />

328.05<br />

3.46<br />

324.59<br />

<br />

<br />

<br />

60

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!