Account Opening

To open account, verify CNIC and Mobile Number using encrypted OTP.

AccountOpening

POST

Account Opening

 

 

Description

 

Account Opening API will be used to open new wallet account after account info and OTP validation. The account information will be sent to JS bank Wallet System for account opening.

 

 

Version


V1


Resource URL

https://sandbox.jsbl.com/mb/account/v0 /create


Header


Name Type Values Description Length

Authorization

String Bearer
Example: Bearer xxxxxxxxxxxxx
Access Token will be generated through OAuth API NA

Content-Type

String Example:
application/json
Only “application/json” Content-Type is supported. NA


Request Parameters

 

Name O/M Type Values Description Length

OTP

M String Z5fwY5dqFLOOh7LpYiIdgQ== Encrypted OTP  NA

CNIC

M String 3520214402765 CNIC of Customer 13

MobileNumber

M String 03464991719 Mobile Number of Customer 11

ConsumerName

M String Abdullah Consumer Name NA

AccountTitle

M String Abdullah Account Title NA

BirthPlace

M String LHR Birth Place NA

PresentAddress

M String LHR Present Address NA

CnicStatus

M String 1 Cnic Status will have 1: Active, 0:Expired NA

CnicExpiry

M String 2019-10-10 CnicExpiry NA

DOB

M String 1990-10-10 Date of Birth NA

FatherHusbandName

M String Ahmed Father Husband Name NA

MotherMaiden

M String Mom Mother Maiden Name NA

Gender

M String Male Gender NA

AccountType

M String 2 AccountType information NA

 

 

 

Sample  Request

 

{

           

"OTP":"Z5fwY5dqFLOOh7LpYiIdgQ=="

            ,"Cnic":"3520214402765"

            ,"MobileNumber":"03464991719"

            ,"ConsumerName":"Abdullah"

            ,"AccountTitle":"Abdullah"

            ,"BirthPlace":"LHR"

            ,"PresentAddress":"LHR"

            ,"CnicStatus":"1"

            ,"CnicExpiry":"2019-10-10"

            ,"DOB":"1990-10-10"

            ,"FatherHusbandName":"Ahmed"

            ,"MotherMaiden":"Mom"

            ,"Gender":"Male"

            ,"AccountType":"2"

}

 
Response Parameters

 

Name Type Values Description Length

ResponseCode

String 00 ResponseCode NA

ResponseDescription

String Successful  ResponseDescription NA

Rrn

String 848721291614  Rrn NA

MobileNumber

String 03333333333 MobileNumber 11

Cnic

String 3578414402454  Cnic 13

HashData

String Hash Data HashData NA

 

 

 

Sample  Response

 

SUCCESS

 

 

{

             "ResponseCode":"00"

            ,"ResponseDescription":"Successful"

           ,"Rrn":"3091629749962"

          ,"MobileNumber":"03333333333"

          ,"Cnic":"3520214402765"

}

 

 

FAILURE

 

 

{

             "requestId":"1234567890123"

            ,"errorCode":"05"

           ,"errorMessage":"Invalid Access Token"

          

 

}

 

 

Response Code Details


{
"requestId": "3091741309081",
"errorCode": "01",
"errorMessage": "Bad Request - Invalid Authorization Header"
}



{
"requestId": "3091741309081",
"errorCode": "03",
"errorMessage": "Bad Request - Invalid Request Payload"
}



{
"requestId": "3091741309081",
"errorCode": "04",
"errorMessage": "Bad Request - Resource not found"
}



{
"requestId": "3091741309081",
"errorCode": "05",
"errorMessage": "Bad Request - Invalid Access Token"
}
{
     "ResponseCode": "00",
    "ResponseDescription": "Successful",
    "Rrn": "",
    "MobileNumber": "03464991719",
    "Cnic": "3520214402765",
     
}


Try-out yourself

Header Parameters


Name Values Description
Authorization
(required)

Auth2.0 verification. "Bearer" keyword followed by a space and generated Access Token from OAuth API.Like "Bearer xxxxxxx"

Content-Type
(required)

Content Type applciation/json is supported

Body Parameters


Name Values Description
Request Body
(required)

Add values in JSON Body

Request Body

HTTP Basic

OAuth 2.0

API Key

Clear Request

Make a request and see the response.

Make a request and see the response.

Make a request and see the response.

Code examples

  • var request = require('request'),
    oauth_token = "YOUR_ACCESS_TOKEN",
    url = "https://sandbox.jsbl.com/mb/account/v0/create"
    auth = "Bearer " + oauth_token;
    request(
    {
    method: 'POST'
    url : url,
    headers : {
    "Authorization" : auth
    }, json : {
    "OTP" :"",
    "Cnic" :"",
    "MobileNumber" :"",
    "ConsumerName" :"",
    "AccountTitle" :"",
    "BirthPlace" :"",
    "PresentAddress" :"",
    "CnicStatus":"",
    "CnicExpiry":"",
    "DOB" :"",
    "FatherHusbandName" :"",
    "MotherMaiden" :"",
    "Gender":"",
    "AccountType" :""
    } },
    function (error, response, body) {
    // TODO: Use the body object to extract the response
    console.log(body)
    } )
    
  • <?PHP $url = 'https://sandbox.jsbl.com/mb/account/v0/create';
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, 
    array('Content-Type:application/json','Authorization:Bearer 
    ACCESS_TOKEN')); //setting custom header
    $curl_post_data = array(
    //Fill in the request parameters with valid values
    'OTP' => ' ',
    'Cnic' => ' ',
    'MobileNumber' => ' ',
    'ConsumerName' => ' ',
    'AccountTitle' => ' ',
    'BirthPlace' => ' ',
    'PresentAddress' => ' ',
    'CnicStatus' => '',
    'CnicExpiry' => '',
    'DOB' => '',
    'FatherHusbandName' => '',
    'MotherMaiden' => '',
    'Gender' => '',
    'AccountType' => ''
    );
    $data_string = json_encode($curl_post_data);
    
  • require 'net/http'
    require 'net/https'
    require 'uri'
    uri = URI('https://sandbox.jsbl.com/mb/account/v0/create')
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    request = Net::HTTP::Get.new(uri)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer '
    request.body = "{
    \"OTP\":\" \",
    \"Cnic\":\" \",
    \"MobileNumber\":\" \",
    \"ConsumerName\":\" \",
    \"AccountTitle\":\" \",
    \"BirthPlace\":\" \",
    \"PresentAddress\":\" \",
    \"CnicStatus\":\",
    \"CnicExpiry\":\",
    \"DOB\":\",
    \"FatherHusbandName\":\",
    \"MotherMaiden\":\",
    \"Gender\":\",
    \"AccountType\":\"
    }"
    response = http.request(request)
    puts response.read_body
    
  • curl -X POST --header "Authorization:
    Bearer " --header "Content-Type: 
    application/json" -d "{ \"OTP\":\" \",
    \"Cnic\":\" \",
    \"MobileNumber\":\" \",
    \"ConsumerName\":\" \",
    \"AccountTitle\":\" \",
    \"BirthPlace\":\" \",
    \"PresentAddress\":\" \",
    \"CnicStatus\":\",
    \"CnicExpiry\":\",
    \"DOB\":\",
    \"FatherHusbandName\":\",
    \"MotherMaiden\":\",
    \"Gender\":\",
    \"AccountType\":\"
    }" "https://sandbox.jsbl.com/mb/account/v0/create"
    

  • OkHttpClient client = new OkHttpClient();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{
    \"OTP\":\" \",
    \"Cnic\":\" \",
    \"MobileNumber\":\" \",
    \"ConsumerName\":\" \",
    \"AccountTitle\":\" \",
    \"BirthPlace\":\" \",
    \"PresentAddress\":\" \",
    \"CnicStatus\":\",
    \"CnicExpiry\":\",
    \"DOB\":\",
    \"FatherHusbandName\":\",
    \"MotherMaiden\":\",
    \"Gender\":\",
    \"AccountType\":\"
    }");
    Request request = new Request.Builder()
    .url("https://sandbox.jsbl.com/mb/account/v0/create")
    .post(body)
    .addHeader("authorization", "Bearer YOUR_OAUTH_TOKEN")
    .addHeader("content-type", "application/json")
    .build();
    Response response = client.newCall(request).execute(); 
    

OTP Encryption

NOTE: To provide Unlimited Strength of encryption to your environment, Kindly download library, extract the zip file and replace these policy
file(local_policy &US_export_policy) on following location e-g: "java\jdk1.8.0_102\jre\lib\security"

Download Library
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.*;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.Arrays;

public class OTPEncryptionUtil {

        public static String encryptWithAES(String key, String strToEncrypt) {
            Security.addProvider(new BouncyCastleProvider());
            byte[] keyBytes = new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
                    0x14, 0x15, 0x16, 0x17};
            try {
                keyBytes = generateKey(key);
                SecretKeySpec skey = new SecretKeySpec(keyBytes, "AES");
                byte[] input = strToEncrypt.trim().getBytes("UTF8");

                synchronized (Cipher.class) {
                    Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING");
                    cipher.init(Cipher.ENCRYPT_MODE, skey);

                    byte[] cipherText = new byte[cipher.getOutputSize(input.length)];

                    int ctLength = cipher.update(input, 0, input.length, cipherText, 0);
                    ctLength += cipher.doFinal(cipherText, ctLength);

                    String encryptedString = new String(org.bouncycastle.util.encoders.Base64.encode(cipherText), "UTF8");
                    return encryptedString.trim();
                }
            } catch (UnsupportedEncodingException uee) {
                System.err.println("Crypto Exception:"+ uee);
            } catch (IllegalBlockSizeException ibse) {
                System.err.println("Crypto Exception:"+ ibse);
            } catch (BadPaddingException bpe) {
                System.err.println("Crypto Exception:"+ bpe);
            } catch (InvalidKeyException ike) {
                System.err.println("Crypto Exception:"+ ike);
            } catch (NoSuchPaddingException nspe) {
                System.err.println("Crypto Exception:"+ nspe);
            } catch (NoSuchAlgorithmException nsae) {
                System.err.println("Crypto Exception:"+ nsae);
            } catch (ShortBufferException e) {
                System.err.println("Crypto Exception:"+ e);
            }
            return null;
        }


        public static byte[] generateKey(String sKey) throws NoSuchAlgorithmException, UnsupportedEncodingException {
            final MessageDigest md = MessageDigest.getInstance("md5");
            final byte[] digestOfPassword = md.digest(sKey.getBytes("utf-8"));
            final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 32);
            for (int j = 0, k = 16; j < 16; ) {
                keyBytes[k++] = keyBytes[j++];
            }
            return keyBytes;
        }

        public static void main(String[] args) {

            String key = new String("65412399991212FF65412399991212FF65412399991212FF");

            try {
                String pin="00000";
                String enpin=encryptWithAES(key,pin);
                System.out.println(enpin);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
}

{
    "requestId": "848624438861",
    "errorCode": "01",
    "errorMessage": "Invalid Authorization Header"
}


{ "requestId": "848624438861", "errorCode": "02", "errorMessage": "Bad Request - Invalid Cnic" }
{ "requestId": "3091624162362", "errorCode": "02", "errorMessage": "Bad Request - Invalid MobileNumber" }
{ "requestId": "3091626060511", "errorCode": "02", "errorMessage": "Bad Request - Invalid ConsumerName" }
{ "requestId": "3091726063961", "errorCode": "02", "errorMessage": "Bad Request - Invalid AccountTitle" }
{ "requestId": "848726338311", "errorCode": "02", "errorMessage": "Bad Request - Invalid BirthPlace" }
{ "requestId": "848726338312", "errorCode": "02", "errorMessage": "Bad Request - Invalid PresentAddress" }
{ "requestId": "848726341341", "errorCode": "02", "errorMessage": "Bad Request - Invalid CnicStatus" }
{ "requestId": "848726341342", "errorCode": "02", "errorMessage": "Bad Request - Invalid CnicExpiry" }
{ "requestId": "848626346341", "errorCode": "02", "errorMessage": "Bad Request - Invalid DOB" }
{ "requestId": "848626346342", "errorCode": "02", "errorMessage": "Bad Request - Invalid FatherHusbandName" }
{ "requestId": "848726349851", "errorCode": "02", "errorMessage": "Bad Request - Invalid MotherMaiden" }
{ "requestId": "848726349852", "errorCode": "02", "errorMessage": "Bad Request - Invalid Gender" }
{ "requestId": "3091726083901", "errorCode": "02", "errorMessage": "Bad Request - Invalid AccountType" }
{ "requestId": "3091726083901", "errorCode": "06", "errorMessage": "Bad Request - Invalid OTP" }
{ "requestId": "3091726083901", "errorCode": "03", "errorMessage": "Invalid Request Payload" }
{ "requestId": "3091726083901", "errorCode": "04", "errorMessage": "Resource not found" }
{ "requestId": "3091726083901", "errorCode": "05", "errorMessage": "Invalid Access Token" }
{
    "ResponseCode": "00",
    "ResponseDescription": "Successful",
    "Rrn": "3091723912433",
    "MobileNumber": "03354522607",
    "Cnic": "3578414402451"
    
}

FAQs

You need to go through the section "How it Works".

Prerequisite(s)

1. Authentication Bear OAuth access token
2. Account Verification
3. NADRA Biometric Verification as per State Bank Pakistan regulation

Resource Summary

Security

Authentication

Content Type

application/json

Working...