SGW
SGW
SGW
Sending request data to the Bank............................................................................................ 7 PUT ..................................................................................................................................... 7 Receiving responses from Bank ............................................................................................... 7 GET ..................................................................................................................................... 7 DELETE ................................................................................................................................ 7 Cryptocraphy ........................................................................................................................ 7
SGW Exceptions and errors .................................................................................................. 9
Example error message .......................................................................................................... 9 Error codes used ................................................................................................................. 10 Troubleshooting .................................................................................................................. 13
Service Communication test .............................................................................................. 14
Service decription ................................................................................................................ 14 Example request XML........................................................................................................... 14 Description of fields in request XML ....................................................................................... 14 Example response XML ........................................................................................................ 14 Description of fields in response XML ..................................................................................... 14
Service Account Balance.................................................................................................. 15
Service decription ................................................................................................................ 15 Example request XML........................................................................................................... 15 Description of fields in request XML ....................................................................................... 15 Example response XML ........................................................................................................ 15 Description of fields in response XML ..................................................................................... 16
Service Payment .............................................................................................................. 17
Service description............................................................................................................... 17 Example request XML........................................................................................................... 17 Description of fields in request XML ....................................................................................... 19 Estonian domestic payment .................................................................................................. 19 Latvian domestic payment .................................................................................................... 19 Lithuanian domestic payment ............................................................................................... 20 Foreign payment ................................................................................................................. 21 Example response XML ........................................................................................................ 22
2
Service description............................................................................................................... 23 Example request XML........................................................................................................... 23 Description of fields in request XML ....................................................................................... 23 Example response XML ........................................................................................................ 23 Description of fields in response XML ..................................................................................... 25
Service Exchange rates.................................................................................................... 26
Service description............................................................................................................... 26 Example request XML........................................................................................................... 26 Description of fields in request XML ....................................................................................... 26 Example response XML ........................................................................................................ 26 Description of fields in response XML ..................................................................................... 27
Service Currency exchange ............................................................................................. 28
Service description............................................................................................................... 28 Example request XML........................................................................................................... 28 Description of fields in request XML ....................................................................................... 28 Example response XML ........................................................................................................ 29 Description of fields in response XML ..................................................................................... 29
Service Alert on transactions........................................................................................... 30
Service description............................................................................................................... 30 Example request XML........................................................................................................... 30 Example response XML ........................................................................................................ 30 Description of fields in response XML ..................................................................................... 31
Service Regular statement .............................................................................................. 32
Service description............................................................................................................... 33 Example request XML........................................................................................................... 33 Description of fields in request XML ....................................................................................... 33 Example response XML ........................................................................................................ 33 Description of fields in response XML ..................................................................................... 34
Service e-invoices for customer ...................................................................................... 34
Service description............................................................................................................... 34
3
Service description............................................................................................................... 35 Example request XML........................................................................................................... 35 Description of fields in request XML ....................................................................................... 36 Example response XML ........................................................................................................ 36 Description of fields in response XML ..................................................................................... 37
Service direct debit payer agreement changes ............................................................... 38
Service description............................................................................................................... 38 Example request XML........................................................................................................... 38 Example response XML ........................................................................................................ 38 Description of fields in response XML ..................................................................................... 39
Service direct debit payment requests ............................................................................ 40
Service description............................................................................................................... 40 Example request XML........................................................................................................... 40 Description of fields in request XML ....................................................................................... 40 Example response XML ........................................................................................................ 41 Description of fields in response XML ..................................................................................... 42
Service POS raport delivery ............................................................................................. 42
Revision history
Version 2.9 Changes Changed EE domestic payment fields: BeneficiaryName (length 70) Changed Foreign payment fields: BeneficiaryName (length 70) BeneficiaryAddress (length 70+optional) Details (length 140) Cost (comment) BalanceOfPaymentsCountry (comment) Changed LV domestic payment fields: BeneficiaryName (length 70) BeneficiaryBankCode (mandatory) Added new error codes Added more information to service specification EE payment document number (length) Foregin payment tag: BeneficiaryIBAN removed Added additional information about Active MQ in paragraph Service specification > More about message exchange and ACK: XML validation demand in paragraph HGW Exceptions and errors Lithuanian fields (OrderingParty/IBAN, OrderingParty/Name, Assignee/IBAN, Assignee/Name) are set to optional Re-Branding - Product name change HansaGateway Swedbank Gateway HGW SGW Incoming file name and request id must be unique Removed sample client information LT payment tag change: Assignee/IBAN =>Assignee/Account LT payment tag change: OrderingParty/IBAN =>Ordering/Account Foreign payment <cost> rule fix Major changes in communication protocol. Droping Active MQ and starting to use HTTP protocol. All communication parameters are changed. Added info about HTTP protocol at the pg 6. Added additional tag for LV in statements and alert - tag BIC Added info about troubleshooting Schema fixing Added beneficiary ID to Lithuanian local payments Removed EE domestic payment priority U not valid after 01.01.2011; foreign payment BalanceOfPaymentsCode is mandatory as from 50,000 EUR equivalent for EE Made by Mrt Arm Date 05.12.2008
2.10
Mrt Arm
11.12.2008
2.11
Mrt Arm
07.01.2009
2.12
Mrt Arm
27.01.2009
2.13
Mrt Arm
04.03.2009
2.14 2.15
13.05.2009 07.07.2009
3.0
Mrt Arm
14.09.2009
Mrt Arm Mrt Arm Rain Pajur Rain Pajur Rain Pajur
Introduction
Swedbank Gateway (SGW) is the data communications channel between client IS and Swedbank where client and bank exchange data in XML format. It operates 24 hours a day, which means that information is available regardless of what time you are working or need to access it. You can use the SGW channel if your software supports it or if you develop the required interface for your information system.
Sending request data to the Bank PUT * Request body cdoc file * Header CorrelationID Client can set correlation ID, which helps connect request and response data. ID must be unique. * Response codes: 200 OK 500 Internal error Receiving responses from Bank Getting response data from bank consist from two steps: 1. with GET request will be received response data 2. with DELETE request must be send out confirmation that you received the response message. If during the 1 hour after GETting the response DELETE request server does not receive, then response message will be sent into responses queue again. GET There is`nt request parameters, only response will be received. * Body cdoc file * Header CorrelationID Client set CorrelationID with PUT request. * Header TrackingID Bank side message ID. * Response codes: 200 OK 400 Bad request 404 No messages 500 Internal error DELETE * Header TrackingID Bank side message ID * Response codes: 200 OK 400 Bad request. Most probably with current Tracking ID message not found 500 Internal error Cryptocraphy Whole cryptographic solution is build according to PKI crypto standard. Customer must remind it, when they are building their own client program. Swedbank Gateway is accepting only encrypted and signed DigDoc containing XML document with service-specific contents. Certificates must be trusted by Bank IS! Certificates what are involved in the process: * Client Communication Certificate * Transaction certificate * Bank certificate. DigiDoc We are using version 1.3 of the DigiDoc file format (.xsd can be found at this address http://www.sk.ee/file.php?id=266, description in .pdf form here http://www.sk.ee/file.php?id=267). Request DigiDoc itself has to be encrypted using Swedbanks public key (Recipient property of that EncryptedKey in DigiDoc has to be SGW it is possible to encrypt DigiDoc for several recipients and this rule lets us to choose correct encrypted transport key block for decryption). It also has to be signed by SGW agreement owner. Signed with Client Communication Certificate Private Key and incase of transactions, additionally with Transaction certificate with OCSP confirmation. Response is a crypted and signed DigiDoc or a plaintext XML with error details when request could not be processed. 7
Sign with Client Communication Certificate Private Key Incase of transactions - Sign additionally with Authorized Person Certificate Private Key + OCSP
Encrypt with Bank Public Key CDOC: Encrypted with Bank Public Key
Send to Bank
CDOC: Encrypted with Client Communication Certificate Public Key DDOC: Signed with Bank Certificate
Receive Alert from bank Alert response XML file Alert response XML file
Example error message <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <HGWError> <Code>AccountNotAllowed</Code> <Message>You have no rights to these accounts through HGW agreement. </Message> </HGWError> </B4B>
Error codes used There might not listed all error codes and error description. We try to give our best to keep following list updated!
Error LimitsExceeded AccountNotAllowed FileValidatingError FileParsingError FileSizeOverLimit UnknownCertificate InvalidCurrency InvalidDigiDoc HGWProtocolError
Decription Limits Exceeded This account is not accessible through HGW agreements with given Client Communication Certificate. Input .xml can not be validated using our .xsd. Input .xml could not be digested we are validating before so this should be rare File is too large Certificate is unknown Currency is wrong We could not read input DigiDoc. We expect one and only one payload in DigiDoc. Whenever we have encountered something we can not be sure how to map, it will come out as a TechnicalError. Account number given in request .xml is not a valid IBAN (although it passed .xsd validation) Client Communication Certificate is not tied to any SGW agreements. Some of the parameters expected in request .xml are not valid. Payment RemitterAccount Not Given Payment To The Same Account Is Not Allowed Name Match Is Too Small Defective Beneficiary Data Missing Beneficiaries Missing Reference Number Invalid Reference Number Prefix Reference Number Too Long Reference Number Too Short Reference Number Cannot Contain Characters Non Standard Reference Number Non Standard Account Number Missing Details Or Reference Number Not An IBAN Account Number Invalid Remitter Account Beneficiary Name Too Long Missing Beneficiary Name Missing Amount Missing Beneficiary Address
TechnicalError
InvalidIBAN NoRights InvalidParameter paymentRemitterAccountNotGiven paymentToTheSameAccountIsNotAllowed nameMatchIsTooSmall defectiveBeneficiaryData missingBeneficiaries missingReferenceNumber invalidReferenceNumberPrefix referenceNumberTooLong referenceNumberTooShort referenceNumberCannotContainCharacters nonStandardReferenceNumber nonStandardAccountNumber missingDetailsOrReferenceNumber notAnIBANAccountNumber invalidRemitterAccount beneficiaryNameTooLong missingBeneficiaryName missingAmount missingBeneficiaryAddress 10
missingBeneficiaryAccount invalidBeneficiaryBank missingDetails missingValueDate invalidRemitterAccountNumber paymentAlreadySentToBank invalidSwiftFormatForBeneficiaryName invalidSwiftFormatForBeneficiaryAddress invalidSwiftFormatForBeneficiaryBankName invalidBeneficiaryAccountNumber invalidCorrespondentBankBIC invalidCorrespondentBankAccountNumber invalidSwiftFormatForDetails invalidSwiftFormatForCorrespondentBankName invalidSwiftFormatForCorrespondentAccountNumber invalidSwiftFormatForIntermediateBankName invalidSwiftFormatForIntermediateAccountNumber missingCorrespondentBankNameOrSWIFT missingIntermediateBankNameOrSWIFT missingBeneficiarySWIFT bothIntermediateAndCorrespondentBankInfoRequired invalidRemitterReferenceNumber remitterReferenceNumberTooLong missingCorrespondentBankNameAndAddress missingCorrespondentBankBIC invalidSwiftFormatForCorrespondentBankAddress invalidSwiftFormatForBeneficiaryBankAddress invalidSwiftFormatForInstructionDetails amountTooBig documentNumberMissing dateOfBirthIsMissing cityIsMissing countryIsMissing documentNumberContainsIllegalCharacters provinceContainsIllegalCharacters countryContainsIllegalCharacters beneficiaryCountryIsMissing beneficiaryAddressTooLong detailsTooLong paymentDataContainsInvalidCharacters RemitterIBAN InvalidRemitterIBAN BeneficiaryIBAN ReferenceNumber Details MissingDetails MissingDetailsOrReferenceNumber ValueDateFormat 11
Missing Beneficiary Account Invalid Beneficiary Bank Missing Details Missing Value Date Invalid Remitter Account Number Payment Already Sent ToBank Invalid Swift Format For Beneficiary Name Invalid Swift Format For Beneficiary Address Invalid Swift Format For Beneficiary Bank Name Iinvalid Beneficiary Account Number Invalid Correspondent Bank BIC Invalid Correspondent Bank Account Number Invalid Swift Format For Details Invalid Swift Format For Correspondent Bank Name Invalid Swift Format For Correspondent Account Number Invalid Swift Format For Intermediate Bank Name Invalid Swift Format For Intermediate Account Number Missing Correspondent Bank Name Or SWIFT Missing Intermediate Bank Name Or SWIFT Missing Beneficiary SWIFT Both Intermediate And Correspondent Bank Info Required Invalid Remitter Reference Number Remitter Reference Number Too Long Missing Correspondent Bank Name And Address Missing Correspondent Bank BIC Invalid Swift Format For Correspondent Bank Address Invalid Swift Format For Beneficiary Bank Address Invalid Swift Format For Instruction Details Amount Too Big Document Number Missing Date Of Birth Is Missing City Is Missing Country Is Missing Document Number Contains Illegal Characters Province Contains Illegal Characters Country Contains Illegal Characters Beneficiary Country Is Missing Beneficiary Address Too Long Details Too Long Payment Data Contains Invalid Characters Remitter IBAN is invalid! Remitter IBAN is invalid! Beneficiary IBAN is invalid! Reference number is invalid! Payment details or reference number must be set! Payment details are missing! Payment details or reference number must be set! Value date format is invalid!
ReferenceLV Amount BeneficiaryName Costs ValueDate Currency unknownAccount NoRights BeneficiaryBankCode dailyLimitExceeded monthlyLimitExceeded agreementLevelDailyLimitExceeded agreementLevelMonthlyLimitExceeded RemitterPaymentID BeneficiaryBankAccount BeneficiaryBankName AccountNotAllowed nameMatchIsTooSmall domesticPaymentCouldBeOnlyInLocalCurrency beneficiaryNameTooLong paymentToTheSameAccountIsNotAllowed ExchangeRateNotFound intrabankPaymentCannotBeUrgent incorrectFormatOrderingPartyId missingOrderingPartyName incorrectFormatAssigneeId missingAssigneeName invalidCurrency H0011 BeneficiaryAddress DocumentNumber ERR00006 ERR00057 missingBopCode balanceOfPaymentsCode BankCodeNotFound notAllowedRouteForAccount 6009 91 84 6100 6093 6094 NotEnoughFunds
Reference number is not supported in Latvia! Amount is missing or invalid! Beneficiary name is missing! Costs is incorrect! Invalid date! Invalid currency! ERP signature is not tied to any HGW agreements. Beneficiary bank code is invalid! Daily limit of mandate exceeded! Monthly limit of mandate exceeded! Daily limit of agreement exceeded! Monthly limit of agreement exceeded! Payment ID is missing! Beneficiary bank account is invalid! Beneficiary bank name is invalid! None of the signers can access this account! The account number and the name do not coincide! Only local currency is allowed for domestic payments! Beneficiary name is too long! Remitter and beneficiary accounts must be different! Currency not found! Intrabank payment cannot be urgent! Incorrect Ordering Party ID! Ordering party name is missing! Incorrect Assignee ID! Assignee name is missing! Invalid currency! DUPLICATE PAYMENT! You have already made a payment with the same data within 24 hours. Payment cancelled! Beneficiary address is missing! Document number is missing! Invalid currency! Balance of Payments code is missing! Balance of Payments code is missing! Balance of Payments code is missing! Bank code could not be found! Beneficiary's bank does not correspond to the beneficiary's account! Insufficient funds for transaction on the account! Operations are currently not permitted! Currency does not exist! Blocking of current account failed! Currency exchange is not permitted! Currency exchange is not permitted! Insufficient funds for transaction on the account!
12
Troubleshooting Incase of problems, for example if Customer system havent received responses from Bank side or there are some suspicious that some messages are lost or etc - incase You would like to track some messages or transactions. Then please forward to your agreed contact person in Bank, following data: Transport certificate name Filename When they sent message(file), time Account nr What answer customer received if any?
More information Bank gets for troubleshooting, then faster bank can answer or solve the issue!
13
Example response XML <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <Pong from="HGW"> <Value>Test</Value> </Pong> </B4B> Description of fields in response XML Pong Pong @ from Pong/Value A (3) AN (0 210) EE/LT/LV/SGW to show which processor responded. Value from Ping request. 1..* 1..1 1..1
14
Example response XML <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <Balance> <Date>2007-08-20</Date> <AccountInfo> <IBAN>LT117300010000131196</IBAN> <BIC>HABALT2X</BIC> <BankName><![CDATA[AB bankas HANSABANKAS]]></BankName> </AccountInfo> <Currencies> <Currency id="LTL"> <Deposit>-301.07</Deposit> <Reserved>0.00</Reserved> <Credit>0.00</Credit> <Available>-301.07</Available> </Currency> <Currency id="USD"> <Deposit>-100.00</Deposit> <Reserved>0.00</Reserved> <Credit>0.00</Credit> <Available>-100.00</Available> </Currency> </Currencies> </Balance> </B4B> 15
Description of fields in response XML Balance Balance/Date D One Balance element for each account in response. Balance date. If none was given in request, banks operation date. One AccountInfo element in each Balance element. Account number Responding bank BIC code Responding bank name One Currencies element in each Balance element. One Currency element for each currency on given account. Currency code is returned as id attribute of Currency element. Account balance Total of reservations Overdraft limit Deposit Reserved + Credit 1..* 1..1
Balance/AccountInfo Balance/AccountInfo/IBAN Balance/AccountInfo/BIC Balance/AccountInfo/BankName Balance/Currencies Balance/Currencies/Currency Balance/Currencies/Currency/id Balance/Currencies/Currency/Deposit Balance/Currencies/Currency/Reserved Balance/Currencies/Currency/Credit Balance/Currencies/Currency/Available A (3) N N N N AN (4 - 35) AN (8) CDATA
1..1 1..1 1..1 1..1 1..1 0..* 1..1 1..1 1..1 1..1 1..1
16
Service Payment
Service description Payment is a customer-initiated query. Customer can send one or more payments with one request (there are different payment formats for domestic and foreign payments and there are also countryspecific differences between estonian, latvian and lithuanian domestic payments. Like all other SGW services, payments are in one .xml file contained in crypted and signed digidoc. Swedbank responds with one or more status report as payments are being processed. Every SGW agreement has agreement-specific limits for payments (daily limit usage resets on every midnight, monthly limit usage on midnight with arrival of 1st of next month) and call-back limit that every payment is checked against. SGW agreement may have a list of users who are permitted to make transactions (operations like payment and currency exchange) with daily and monthly limits of their own. Limits are saved in agreement in local currency and payment amount is checked against them after being converted into local currency using central bank rate. Payment service requires that DigiDoc containing payments file is signed by Client Communication certificate and at least one user with transaction certificate. Client Communication certificate signature is used to locate the SGW agreement (as it is done with other services) while user signatures define users and their access rights to the accounts that payments are made from. If more than one user has signed payments then SGW will try to use limits of users ordered by signing timestamp and then signature location in DigiDoc. If first user does not have enough available limits, next users limit is checked and so on. If no user has enough available limit left for given payment, that payment will fail with error code showing whether it was daily limit or monthly limit that was not enough (daily limit is checked first). If payment amount exceeds over checking limit in agreement, payment will be made only after back-office employee has called and verified payment but limits (both daily and monthly limits for both user and agreement) are used during initial processing by SGW. Example request XML <?xml version="1.0" encoding="UTF-8"?> <B4B> <Payments> <DomesticPaymentEE> <ID>C1_D_EE_01</ID> <DocumentNumber>C1_D_EE_01</DocumentNumber> <ValueDate>2007-08-14</ValueDate> <Priority>N</Priority> <RemitterIBAN>EE352200221000127267</RemitterIBAN> <Amount>6.78</Amount> <Currency>EEK</Currency> <BeneficiaryIBAN>EE922200221010214144</BeneficiaryIBAN> <BeneficiaryName>U'NEILL</BeneficiaryName> <Details>B4B Estonian Domestic payment, Happy1 - 1</Details> <ReferenceNumber>7605262</ReferenceNumber> </DomesticPaymentEE> <DomesticPaymentLT> <ID>C1_D_LT_01</ID> <DocumentNumber>C1_D_LT_01</DocumentNumber> <ValueDate>2007-08-14</ValueDate> <Priority>N</Priority> <RemitterIBAN>LT257300010161511493</RemitterIBAN> <Amount>2.45</Amount> <Currency>LTL</Currency> <BeneficiaryIBAN>LT617300010071014501</BeneficiaryIBAN> <BeneficiaryName>KAL PVI</BeneficiaryName> <Details>B4B Lithuanin Domestic payment, Happy1 - 1</Details> 17
</DomesticPaymentLT> <DomesticPaymentLV> <ID>C1_D_LV_01</ID> <DocumentNumber>C1_D_LV_01</DocumentNumber> <ValueDate>2007-08-14</ValueDate> <Priority>N</Priority> <RemitterIBAN>LV35HABA0551000141298</RemitterIBAN> <Amount>1.24</Amount> <Currency>USD</Currency> <BeneficiaryIBAN>LV13UNLA0001001609573</BeneficiaryIBAN> <BeneficiaryName>Maris</BeneficiaryName> <Details>B4B Latvian Domestic payment, Happy1 - 1</Details> <BeneficiaryResidence>LV</BeneficiaryResidence> <BeneficiaryBankCode>UNLALV2X</BeneficiaryBankCode> </DomesticPaymentLV> <ForeignPayment> <ID>C1FLT01</ID> <DocumentNumber>1</DocumentNumber> <ValueDate>2007-08-14</ValueDate> <Priority>N</Priority> <RemitterIBAN>LT257300010161511493</RemitterIBAN> <Amount>6.31</Amount> <Currency>LTL</Currency> <DebitCurrency>USD</DebitCurrency> <BeneficiaryAddress>Peatnav 4 - 14, Tallinn, Eesti Vabariik</BeneficiaryAddress> <BeneficiaryName>Toomas Nipi</BeneficiaryName> <BeneficiaryResidence>LB</BeneficiaryResidence> <Details>B4B Lithuanian Foreign payment, Happy1 - 1</Details> <Costs>O</Costs> <BalanceOfPaymentsCode>200</BalanceOfPaymentsCode> <BalanceOfPaymentsCountry>EE</BalanceOfPaymentsCountry> <BeneficiaryBank> <Name>Hansabank</Name> <BIC>HABAEE2X</BIC> <Account>EE922200221010214144</Account> </BeneficiaryBank> </ForeignPayment> </Payments> </B4B>
18
Description of fields in request XML At the moment there are four different payment types supported by SGW. Payments Estonian domestic payment Payments/DomesticPaymentEE ID AN (1 - 50) Id of a payment. We suggest it to be unique in payment file. This value is not shown to beneficiary. Document number of payment shown to beneficiary. YYYY-MM-DD N = Normal Payer account number. Needs to be in IBAN format. Needs to be positive. . is used as decimal separator. Beneficiary account in IBAN format. Either details or number may be Either details or number may be reference missing. reference missing. 0..* 1..1 1..1
DocumentNumber ValueDate Priority RemitterIBAN Amount Currency BeneficiaryIBAN BeneficiaryName Details ReferenceNumber Latvian domestic payment Payments/DomesticPaymentLV ID
1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 0..1 0..1
AN (1 - 50)
DocumentNumber ValueDate Priority RemitterIBAN Amount Currency BeneficiaryIBAN BeneficiaryID BeneficiaryName Details BudgetCode BeneficiaryResidence BalanceOfPaymentsCode
AN (1 10) D A (1) AN (4 - 35) N A (3) AN (4 35) AN (1 15) AN (1 70) AN (0 300) N (0 10) A (2) N (3)
Id of a payment. We suggest it to be unique in payment file. This value is not shown to beneficiary. Document number of payment shown to beneficiary. YYYY-MM-DD N = Normal, U = Urgent Payer account number. Needs to be in IBAN format. Needs to be positive. . is used as decimal separator. Beneficiary account in IBAN format.
0..* 1..1
1..1 1..1 1..1 1..1 1..1 1..1 1..1 0..1 1..1 1..1 0..1 1..1 0..1
BeneficiaryBankCode 19
AN (8 11)
Country code Mandatory from 1000 LVL (or equivalent) when latvian resident is paying to a nonresident. SWIFT
1..1
Lithuanian domestic payment Payments/DomesticPaymentLT ID AN (1 - 50) Id of a payment. We suggest it to be unique in payment file. This value is not shown to beneficiary. Document number of payment shown to beneficiary. YYYY-MM-DD N = Normal, U = Urgent. Payer account number. Needs to be in IBAN format. Needs to be positive. . is used as decimal separator. Beneficiary account in IBAN format. 0..* 1..1
DocumentNumber ValueDate Priority RemitterIBAN Amount Currency BeneficiaryIBAN BeneficiaryName Details ReferenceNumber ReferenceToPayer BeneficiaryRegistrationCode ReferenceToBeneficiary OrderingParty OrderingParty/Account OrderingParty/Id OrderingParty/Name Assignee Assignee/Account Assignee/Id Assignee/Name
AN (1 10) D A (1) AN (4 - 35) N A (3) AN (4 35) AN AN AN AN AN AN (1 (0 (0 (1 (1 (1 200) 300) 28) 16) 15) 16)
1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1 0..1
20
Foreign payment Payments/ForeignPayment ID AN (1 - 50) Id of a payment. We suggest it to be unique in payment file. This value is not shown to beneficiary. Document number of payment shown to beneficiary. YYYY-MM-DD N = Normal, U = Urgent, E = Express. EE and LT (O = commission is paid by remitter, S = commission is shared between both parties) LV (O = commission is paid by remitter, B =commission is shared between parties Payer account number. Needs to be in IBAN format. Needs to be positive. . is used as decimal separator. 0..* 1..1
AN (1 8) D A (1) A (1)
BalanceOfPaymentsCountry BeneficiaryBank BeneficiaryBank/Name BeneficiaryBank/BIC BeneficiaryBank/Account CorrespondentBank CorrespondentBank/Name CorrespondentBank/BIC CorrespondentBank/Account IntermediaryBank IntermediaryBank/Name IntermediaryBank/BIC IntermediaryBank/Account
A (2)
Country code Mandatory as from 50,000 EUR equivalent for EE and from 1000 LVL equivalent for LV EE, LV:Conditional->; LT - not used Country code EE, LV:Conditional->; LT - not used
1..1 1..1 1..1 0..1 1..1 0..1 1..1 0..1 0..1 0..1 1..1 0..1 0..1
21
Example response XML As above example has payments from three different countries (domestic payment in estonia, domestic payment in latvia, domestic payment and foreign payment in lithuania), there will be at least three responses to it (each country processes payments separately). If for some reason it is not possible to debit domestic payments during first processing (customer might not have had enough money on account, transactions were disabled in banking core or payments value date is later than banking day are most common reasons to it), domestic payment will be first put into processing state. There will be a separate status report about payment when it has been processed further. <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <PaymentStatus> <Payment id="C1_D_EE_01" status="processing"/> </PaymentStatus> </B4B> <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <PaymentStatus> <Payment id="C1_F_LT_01" status="processing"/> <Payment id="C1_D_LT_01" status="success" bankReference="2007081400034136"/> </PaymentStatus> </B4B> <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <PaymentStatus> <Payment id="C1_D_LV_01" status="failed" error="None of signers can access this account!"/> </PaymentStatus> </B4B> <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <PaymentStatus> <Payment id="C1_D_EE_01" status="success" bankReference="2007081400235531"/> </PaymentStatus> </B4B> Description of fields in response XML B4B/PaymentStatus PaymentStatus/Payment Payment @ id Payment @ status Payment @ bankReference Root element of status report Payment details Payment id assigned by remitter success/failed/processing state of payment For payment in success state Swedbank Gateway also reports reference to debiting operation. For payment in failed state Swedbank Gateway reports the reason of failure. 1..1 1..* 1..1 1..1 0..1
AN (1 - 50) A N (16)
Payment @ error 22
0..1
Example response XML <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <Statement> <AccountInfo> <IBAN>EE392200221011508011</IBAN> <BIC>HABAEE2X</BIC> <BankName><![CDATA[AS HANSAPANK]]></BankName> </AccountInfo> <Partial>complete</Partial> <Period> <StartDate>2007-06-09</StartDate> <EndDate>2007-06-17</EndDate> </Period> <Customer> <Name><![CDATA[AS LILLEKE]]></Name> <LegalID><![CDATA[10444444]]></LegalID> </Customer> <Currency id="EEK"> <OpeningBalance>45010.12</OpeningBalance> <ClosingBalance>35027.12</ClosingBalance> <Transactions> <Transaction> <TypeCode>MK</TypeCode> <TransactionDate>2007-06-14</TransactionDate> <ReferenceDate>2007-05-11</ReferenceDate> <BankReference>2007061400000190</BankReference> <DocumentNumber>4</DocumentNumber> <Description><![CDATA[test kik ok]]></Description> 23
<Amount>-1.00</Amount> <Counterparty> <Name><![CDATA[as lilleke]]></Name> <LegalID><![CDATA[]]></LegalID> <IBAN>EE482200221011515415</IBAN> </Counterparty> </Transaction> <Transaction> <TypeCode>TT</TypeCode> <TransactionDate>2007-06-14</TransactionDate> <BankReference>2007061400000190</BankReference> <Description><![CDATA[MK teenustasu]]></Description> <Amount>-2.00</Amount> <Counterparty> <Name><![CDATA[]]></Name> <LegalID><![CDATA[]]></LegalID> <IBAN></IBAN> </Counterparty> </Transaction> <Transaction> <TypeCode>X</TypeCode> <TransactionDate>2007-06-14</TransactionDate> <BankReference>2007061400000238</BankReference> <Description><![CDATA[VV: EEK -> EUR 636.74 kurss 15.6735]]></Description> <Amount>-9980.00</Amount> <Counterparty> <Name><![CDATA[]]></Name> <LegalID><![CDATA[]]></LegalID> <IBAN></IBAN> </Counterparty> </Transaction> </Transactions> </Currency> <Currency id="EUR"> <OpeningBalance>1023.23</OpeningBalance> <ClosingBalance>1659.97</ClosingBalance> <Transactions> <Transaction> <TypeCode>X</TypeCode> <TransactionDate>2007-06-14</TransactionDate> <BankReference>2007061400000238</BankReference> <Description><![CDATA[VV: EEK 9,980.00 -> EUR kurss 15.6735]]></Description> <Amount>636.74</Amount> <Counterparty> <Name><![CDATA[]]></Name> <LegalID><![CDATA[]]></LegalID> <IBAN></IBAN> </Counterparty> </Transaction> </Transactions> </Currency> <Currency id="USD"> <OpeningBalance>475.00</OpeningBalance> <ClosingBalance>475.00</ClosingBalance> <Transactions> </Transactions> </Currency> 24
Description of fields in response XML B4B/Statement AccountInfo AccountInfo/IBAN AccountInfo/BIC AccountInfo/BankName Partial Page Period Period/StartDate Period/EndDate Customer Customer/Name Customer/LegalID Currency Currency @ id Currency/OpeningBalance Currency/ClosingBalance Currency/Transactions Transactions/Transaction Transaction/TypeCode Transaction/TransactionDate Transaction/ReferenceDate Transaction/BankReference Transaction/DocumentNumber Transaction/ReferenceNumber Transaction/Description Transaction/Amount Transaction/ReferenceToPayer Transaction/Counterparty Counterparty/Name Counterparty/LegalID Counterparty/IBAN Counterparty/BIC Counterparty/ ReferenceToBeneficiary Transaction/OrderingParty A (3) N N Container element inside Statement/Currency AN (2) D D N (16) AN (1 30) AN (1 60) CDATA N AN (1 - 16) AN (4 35) AN (8) CDATA A D Container element inside B4B/Statement Account number Bank code of responding bank Name of responding bank Partial/Complete Container element inside B4B/Statement Start date from request End date from request Container element inside B4B/Statement Name of account owner Registration number of account owner Container element inside B4B/Statement Currency code is given in id attribute of Currency element 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 0..* 1..1 1..1 1..1 1..1 0..* 1..1 1..1 0..1 1..1 0..1 0..1 1..1 1..1 0..1 1..1 1..1 1..1 1..1 1..1 0..1 0..1
D D
CDATA CDATA
CDATA CDATA AN (4 35) AN (1 - 16) Latvian specific Lithuanian-specific Container element inside Transactions/Transaction. Used for Lithuanian payments. AN (4 35) AN (1 11) AN (1 140) Container element inside Transactions/Transaction. Used for Lithuanian payments. AN (4 35)
Assignee/Account 25
0..1
Assignee/Id Assignee/Name
AN (1 11) AN (1 140)
0..1 0..1
A D D
A (3)
Example response XML <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <ExchangeRateResponse> <BIC>HABAEE2X</BIC> <ExchangeRateType>Transfer</ExchangeRateType> <ExchangeRateInfo BaseCurrency="EEK"> <CurrencyInfo Date="2007-06-30"> <Currency>EUR</Currency> 26
<Buy>15.62000</Buy> <Sell>15.67350</Sell> </CurrencyInfo> <CurrencyInfo Date="2007-07-01"> <Currency>EUR</Currency> <Buy>15.62000</Buy> <Sell>15.67350</Sell> </CurrencyInfo> <CurrencyInfo Date="2007-06-30"> <Currency>NOK</Currency> <Buy>1.96000</Buy> <Sell>1.99200</Sell> </CurrencyInfo> <CurrencyInfo Date="2007-07-01"> <Currency>NOK</Currency> <Buy>1.96000</Buy> <Sell>1.99200</Sell> </CurrencyInfo> <CurrencyInfo Date="2007-06-30"> <Currency>USD</Currency> <Buy>12.25400</Buy> <Sell>12.48850</Sell> </CurrencyInfo> <CurrencyInfo Date="2007-07-01"> <Currency>USD</Currency> <Buy>12.25400</Buy> <Sell>12.48850</Sell> </CurrencyInfo> </ExchangeRateInfo> </ExchangeRateResponse> </B4B> Description of fields in response XML B4B/ExchangeRateResponse BIC ExchangeRateType ExchangeRateInfo ExchangeRateInfo @ BaseCurrency AN (8) A Container element for response Code of bank responding Transfer/Cash/Central Container element for currencies listing in ExchangeRateResponse element. Currency against what rates are given by bank is contained in BaseCurrency attribute. Container element for currency info in ExchangeRateInfo element Date parameter of CurrencyInfo element. Bank buys at this rate Bank sells at this rate 1..1 1..1 1..1 1..1 1..1
A (3)
27
AN (4 35) A (3) N
N A (3) N
Sell/Rate
0..1
28
Example response XML <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <CurrencyExchangeResponse> <BIC>HABAEE2X</BIC> <IBAN>EE562200221008103199</IBAN> <BankReference>2007070200000195</BankReference> <Buy> <Currency>USD</Currency> <Amount>2500.00</Amount> <Rate>12.48850</Rate> </Buy> <Sell> <Currency>EUR</Currency> <Amount>1998.80</Amount> <Rate>15.62000</Rate> </Sell> </CurrencyExchangeResponse> </B4B> Description of fields in response XML B4B/CurrencyExchangeResponse BIC IBAN BankReference Buy/Currency Buy/Amount Buy/Rate Sell/Currency Sell/Amount Sell/Rate ExchangeRateType ExchangeRateInfo AN (8) AN (4 35) N (16) A (3) N N A (3) N N A Container element for response Code of bank responding Account number where currency exchange is performed. Bank reference for operation Currency that customer bought Amount that customer bought Currency that customer sold Amount that customer sold Transfer Container element for currencies listing in ExchangeRateResponse element. 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1
29
30
Description of fields in response XML B4B/Alert AccountInfo AccountInfo/IBAN AccountInfo/BIC AccountInfo/BankName Customer Customer/Name Customer/LegalID Currency Currency @ id Currency/Transactions Transactions/Transaction Transaction/TypeCode Transaction/TransactionDate Transaction/ReferenceDate Transaction/BankReference Transaction/DocumentNumber Transaction/ReferenceNumber Transaction/Description Transaction/Amount Transaction/ReferenceToPayer Transaction/Counterparty Counterparty/Name Counterparty/LegalID Counterparty/IBAN Counterparty/BIC Counterparty/ReferenceToBeneficiary Transaction/OrderingParty AN (2) D D N (16) AN (1 30) AN (1 60) CDATA N AN (1 - 16) A (3) AN (4 35) AN (8) CDATA Container element inside B4B/Alert Account number Bank code of responding bank Name of responding bank Container element inside B4B/Statement Name of account owner Registration number of account owner Container element inside B4B/Alert Currency code is given in id attribute of Currency element Container element inside Alert /Currency Container element inside Currency/Transactions 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 1..1 0..* 1..1 1..1 0..1 1..1 0..1 0..1 1..1 1..1 0..1 1..1 1..1 1..1 1..1 1..1 0..1 0..1
CDATA CDATA
CDATA CDATA AN (4 35) AN (1 - 16) Latvian specific Lithuanian-specific Container element inside Transactions/Transaction. Used for lithuanian payments.
AN (4 35) AN (1 11) AN (1 140) Container element inside Transactions/Transaction. Used for lithuanian payments. AN (4 35) AN (1 11) AN (1 140)
31
32
Example response XML <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <ImportResult> <Statistics> <TotalCount>8</TotalCount> <DefectiveCount>2</DefectiveCount> </Statistics> <DefectiveInvoices> <Invoice invoiceId="2"> <Errors> <Error id="66"/> <Error id="33"/> </Errors> </Invoice> </DefectiveInvoices> </ImportResult> </B4B>
33
Description of fields in response XML B4B/ImportResult Statistics Statistics/TotalCount Statistics/DefectiveCount DefectiveInvoices Invoice Invoice @ invoiceId Invoice/Errors Errors/Error Error @ id AN N N Container element inside B4B/ImportResult Number of e-invoices found in payload .xml Number of e-invoices with errors. Container element inside B4B/ImportResult Container element for each defective e-invoice ID for defective invoice Container inside Invoice Element for error code for each error Error code used by e-invoice processor. 1..1 1..1 1..1 1..1 1..1 0..* 1..1 1..1 1..* 1..1
34
35
Description of fields in request XML Header/BeneficiaryAgreement Header/CountryCode Agreements/Agreement Agreement/SequenceNumber Agreement/Operation Agreement/Payer Payer/Name Payer/AccountNumber Payer/AgreementNumber Payer/RegistrationNumber Agreement/Limit Agreement/CurrencyCode Agreement/ReferenceNumber Agreement/Utility Agreement/Discount Agreement/DebitingPeriod DebitingPeriod/From DebitingPeriod/To Agreement/AgreementValid AgreementValid/From AgreementValid/To Example response XML <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <DirectDebitImportResult> <Header> <CountryCode>EE</CountryCode> <BeneficiaryAgreement>12345</BeneficiaryAgreement> </Header> <Statistics> <TotalCount>2</TotalCount> <DefectiveCount>0</DefectiveCount> <RemovedCount>1</RemovedCount> <InsertedCount>1</InsertedCount> </Statistics> <Agreements> <Agreement recordId="2" operation="REMOVE"/> <Agreement recordId="1" operation="ADD" agreementNumber="65421"/> </Agreements> </DirectDebitImportResult> </B4B> 36 N N N (1 16) A (2) Direct debit beneficiary agreement number. Country code EE/LV/LT. Container element for each agreement add/remove request Agreement change id Operation code Container for payer agreement owner data Payer name Payer account number Payer agreement number (used for REMOVE operation) Payer registration number Payer agreemend debiting limit (used for ADD operation) Debiting limit currency (used for ADD operation in LV) Reference number for payer Utility code (used in LV for ADD operation) Discount code (used in LV for ADD operation) Container for debiting period, used for ADD operation First day of debiting period Last day of debiting period Container for agreement period, used for ADD operation. First date of period Last date of period 1..1 1..1 0..* 1..1 1..1 1..1 1..1 1..1 1..1 0..1 0..1 1..1 0..1 0..1 0..1 1..1 1..1 0..1 1..1 1..1
N ADD/REMOVE
D D
Description of fields in response XML B4B/DirectDebitImportResult Header/CountryCode Header/BeneficiaryAgreement Statistics/TotalCount Statistics/DefectiveCount Statistics/RemovedCount Statistics/InsertedCount Agreements/Agreement Agreement @ recordId Agreement @ operation Agreement @ agreementNumber Agreement/Errors Errors/Error Error @ id A (2) N (1 16) N N N N Country code Direct debit beneficiary agreement number. Total number of agreements processed by given processor Number of agreements that failed validation Number of agreements that were removed Number of bew agreements Container for every processed agreement Sequence number from request XML Operation code from request XML Agreement number for created payer agreement Container for errors for given agreement change operation Element for every error Error code 1..1 1..1 1..1 1..1 1..1 1..1 1..1 0..* 1..1 1..1 0..1 0..1 1..* 1..1
N ADD/REMOVE N (1 16)
37
38
Description of fields in response XML Header/BeneficiaryAgreement Header/CountryCode Agreements/Agreement Agreement/SequenceNumber Agreement/Operation Agreement/Payer Payer/Name Payer/AccountNumber Payer/AgreementNumber Payer/RegistrationNumber Agreement/Limit Agreement/CurrencyCode Agreement/ReferenceNumber Agreement/Utility Agreement/Discount Agreement/DebitingPeriod DebitingPeriod/From DebitingPeriod/To Agreement/AgreementValid AgreementValid/From AgreementValid/To N N N (1 16) A (2) Direct debit beneficiary agreement number. Country code EE/LV/LT. Container element for each agreement add/remove request Agreement change id Operation code Container for payer agreement owner data Payer name Payer account number Payer agreement number Payer registration number Payer agreemend debiting limit (used for ADD operation) Debiting limit currency (used for ADD operation in LV) Reference number for payer Utility code (used in LV for ADD operation) Discount code (used in LV for ADD operation) Container for debiting period, used for ADD operation First day of debiting period Last day of debiting period Container for agreement period, used for ADD operation. First date of period Last date of period 1..1 1..1 0..* 1..1 1..1 1..1 1..1 1..1 1..1 0..1 0..1 1..1 0..1 0..1 0..1 1..1 1..1 0..1 1..1 1..1
N ADD/REMOVE
D D
39
(0 (0 (0 (0
40
Example response XML Direct debit payment requests are processed a lot like payments initial validation is done by SGW processor that is forwarding valid payments to local processor splitting them into blocks of 100 payments (this number could change in production environment depending on SGW performance). Local processor is able to check payer agreement data (if reference number matches given payer, payer name is correct and so on) and stores valid requests into database. This two-tier processing also means that SGW responds with at least two messages one from SGW processor and another from local processor. If there were more payment requests than block size, then response from SGW processor contains statistics about all of them and local processor responds for each block it has processed. It is also possible that first response is sent by local processor (because SGW processor could be still processing large incoming message while local processor has finished its first block). Structure for response file is still the same: <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <DirectDebitPaymentsImportResult from="HGW"> <Header> <CountryCode>EE</CountryCode> <BeneficiaryAgreement>12345</BeneficiaryAgreement> </Header> <Statistics> <TotalCount>1</TotalCount> <DefectiveCount>0</DefectiveCount> </Statistics> <DefectivePayments> </DefectivePayments> </DirectDebitPaymentsImportResult> </B4B> <?xml version="1.0" encoding="UTF-8"?> <B4B xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://hansagateway.net/valid/hgw-response.xsd"> <DirectDebitPaymentsImportResult from="EE"> <Header> <CountryCode>EE</CountryCode> <BeneficiaryAgreement>12345</BeneficiaryAgreement> </Header> <Statistics> <TotalCount>1</TotalCount> <DefectiveCount>1</DefectiveCount> </Statistics> <DefectivePayments> <Payment recordId="1"> <Errors> <Error id="nameMatchIsTooSmall"/> </Errors> </Payment> </DefectivePayments> </DirectDebitPaymentsImportResult> </B4B>
41
Description of fields in response XML B4B/DirectDebitPaymentsImportResult DirectDebitImportResult @ from Header/CountryCode Header/BeneficiaryAgreement Statistics/TotalCount Statistics/DefectiveCount DefectivePayments DefectivePayments/Payment Payment @ recordId Payment/Errors Errors/Error Error @ id A (2 - 3) A (2) N (1 16) N N Processor id HGW/EE/LV/LT Country code Direct debit beneficiary agreement number. Total number of payments processed by given processor Number of payments that failed validation by given processor. Container for defective payment listing Container for payment data Payment location in request file. Container for payment errors Element for error code Validation error code 1..1 1..1 1..1 1..1 1..1 1..1 1..1 0..* 1..1 1..1 1..* 1..1
42