validateAccount
 
SOAP API > Validating Payments > Bank Account Numbers >
 validateAccount

 

Validates a Domestic Bank Account Number

 

 

Syntax:

validateAccount(string keycode, string field1,string field2,string field3,string field4,string countryId,string countrySpec)

 

 

A list of support country codes to use in [countryId] can be found here.

 


 

 

Returned data

An object paccnum containing the following fields:

 

 Name

Type

 Description

 field1

String

 field 1 from the original request (or transposed version if applicable)

 field2

String

 field 2 from the original request (or transposed version if applicable)

 field3

String

 field 3 from the original request

 field4

String

 field 4 from the original request

 validity

String

 String ‘Valid’ if the account number is valid.

 String ‘Invalid’ if the account numbers not valid. 

 bic

String

 The full Bank Identification Code (BIC) of the account holding branch - if available

 branchTitle

String

 The account holding branch title as defined by the bank

 institutionName

String

 The parent financial institution of the account holding branch

 city

String

 The city that the account holding branch is located

 address1

String

 Address line 1 of the account holding branch

 address2

String

 Address line 2 of the account holding branch

 address3

String

 Address line 3 of the account holding branch

 address4

String

 Address line 4 of the account holding branch

 postcode

String

 The postcode/zipcode of the account holding branch

 country

String

 The country that the account holding branch is located

 tel1

String

 Telephone number 1 of the account holding branch

 tel2

String

 Telephone number 2 of the account holding branch - often but not always the fax number

transposed

Bool

 Flag to show if the account number was transposed as part of the validation. If True the account number was transposed.  Field1 and Field2 will hold the transposed account details.

accountCode

String

For UK 10 Digit account number that have been transposed, this field holds the account code.

 errorCode

String

 If an error occurs during processing the error number will be here. See the error section for more details.

 errorText

String

 If an error occurs during processing the error textually description will be here. See the error section for more details.

 

 

 


Supported Versions

Validate Web Service Version 1.x


Errors

1501 Details could not be checked
1502 Failed Modulus Check
1503 Foreign currency account
1504 An undetermined error prevented validation
1505 Incorrect number of digits, should be n for cc account number
1506 The account details cannot be checked. [because ….]
1507 Input error. The supplied details are not in the correct format
1508 The supplied sort code could not be found

 


Example Code

c#
The following sample show how to use the validateAccount function using c#.
As with all examples, please see the section Adding a reference to the Validate Web Service .

 c# Example 1

validate.validate wsObject = new validate.validate();
validate.paccnum acObject = wsObject.validateAccount("qwerty", "074456", "12345112", "", "", "GB");

 

c# Example 2

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1

{
  
class Program
   {
      static void Main(string[] args)
      {
        
string keycode = "qwerty";
         string sortCode = "074456"
;
         string accountNumber = "12345112"
;
         string countryCode = "GB";
         string countrySpec = "";

         validate.validate wsObject = new validate.validate();
         validate.paccnum acObject = wsObject.validateAccount
                  (keycode,sortCode,accountNumber,"",""
,countryCode,countrySpec);

         Console.WriteLine(acObject.validity);
         Console.WriteLine(acObject.institutionName);
         Console.WriteLine(acObject.errorCode);
         Console.WriteLine(acObject.errorText);
         Console.ReadLine();
      }
   }
}


Visual Basic .net
The following sample show how to use the validateAccount function using Visual Basic.net.
As wilth all examples, please see the section Adding a reference to the Validate Web Service .

 Visual Basic.net Example `

Dim wsobject As New validate.validate()
Dim anObject As validate.paccnum
anObject = wsobject.validateAccount("qwerty", "074456", "12345112", "", "", "GB","")


  Visual Basic.net Example 2

Module Module1

   Sub
Main()

      ' define the keycode, sortcode, account number and country Id to validate, both as strings.

      Dim keycode As String =
"qwerty"
      Dim sortCode As String =
"074456"
      Dim accountNumber As String =
"12345112"
      Dim countryCode As String = "GB"
      Dim countrySpec As String = ""

      ' Create a web service object
      Dim wsobject As New
validate.validate()

      ' create a account number object for the returning data
      Dim anObject As
validate.paccnum

      ' Call the web service function - validateBic
      anObject = wsobject.validateAccount(keycode, sortCode, accountNumber, "", ""
, countryCode,countrySpec)

      ' display the validity and institution name - or error message
      Console.WriteLine(anObject.validity)
      Console.WriteLine(anObject.institutionName)
      Console.WriteLine(anObject.errorCode)
      Console.WriteLine(anObject.errorText)
      Console.ReadLine()

   End Sub

End Module

 

Java
The following sample show how to use the validateAccount function using Java.

Java Example 1

public class Main {

    public static void main(String[] args) {

        validate.Validate service = new validate.Validate();
        validate.ValidateSoap port = service.getValidateSoap12();

        java.lang.String keyCode = "qwerty" ;
        java.lang.String accver1 = "074456" ;
        java.lang.String accver2 = "12345112" ;
        java.lang.String country = "GB" ;
        java.lang.String countrySpec = "" ;

        validate.paccnum result = port.validateAccount(keyCode, accver1, accver2, "", "", country, "",countrySpec);
        System.out.println( "Result = " +result.getValidity());
        System.out.println( "Institution = " +result.getInstitutionName());
        System.out.println( "Error Code = " +result.getErrorCode());
        System.out.println( "Error Message = " +result.getErrorText());

    }
}

 


XML Messages

Below is a typical XML message request

<?xml version="1.0" encoding="utf-8"?>
<
soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://vtest.bemac.com/">
 
<soap:Body>
    <tns:validateAccount>
      <tns:keyCode>qwerty</tns:keyCode>
      <tns:accver1>074456</tns:accver1>
      <tns:accver2>12345112</tns:accver2>
      <tns:accver3/>
      <tns:accver4/>
      <tns:country>GB</tns:country>
      <tns:countryspec/>
    </tns:validateAccount>
  </soap:Body>
</soap:Envelope>

 

Below is a typical XML message response

<?xml version="1.0" encoding="utf-8"?>
<
soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <validateAccountResponse xmlns="http://vtest.bemac.com/">
      <validateAccountResult>
        <validity>Valid</validity>
        <bic />
        <branchTitle>FlexAccount (NGC) </branchTitle>
        <institutionName>NATIONWIDE BLDG SCTY</institutionName>
        <address1>P.O. Box 8888 </address1>
        <address2>Nationwide Hse </address2>
        <address3>Pipers Way </address3>
        <address4>Swindon L </address4>
        <postcode>SN38 1NW</postcode>
        <country>Wilts. </country>
        <tel1>08457 302010 </tel1>
        <tel2>
        </tel2>
        <printIndicator>0 </printIndicator>
        <numSubBranch>1</numSubBranch>
        <errorCode />
        <errorText />
      </validateAccountResult>
    </validateAccountResponse>
  </soap:Body>
</
soap:Envelope>


 URL Encoding

Below is an example of using validateAccount via a URL encoded GET request:

serviceUrl.asmx/accountnum2.aspx?keycode=qwerty&field1=074456&field2=1234511212&countryId=GB


 


 

 ©Copyright 2023 Paygate Solutions Limited