Skip to main content

JavaScript

shopify

JavaScript

Client-side web development

Integrate Hesabe Payment Gateway into your web applications using JavaScript. Complete encryption library with easy-to-use functions for secure payment processing.

📦 Library Installation

📦

NPM Installation

You can install the encryption library for JavaScript using npm:

 npm install --save hesabe-crypt

Alternatively, you can download the library files directly and use the encrypt and decrypt methods.

🔗 CDN Integration

🌐

External CDN

If you're importing the library manually, you'll need to add the AES-JS CDN:

 <script type="text/javascript"
src="https://cdn.rawgit.com/ricmoo/aes-js/e27b99df/index.js">
</script>

You can install encryption library for JavaScript using the following:

🔒 Encryption Implementation

🔒

Encryption Function

Use this function to encrypt payment data before sending to Hesabe API:

export const getEncryptedData = value => {

let secret_key = 'XXXXX' // Secret key provided by Hesabe
let iv_key = 'XXXXX' // IV key provided by Hesabe

if(value) {
let secret = secret_key // merchant secret key
let ivCode = iv_key // merchant iv code

let key = aesjs.utils.utf8.toBytes(secret);
let iv = aesjs.utils.utf8.toBytes(ivCode);

let instance = new hesabeCrypt(key, iv);

let text = value;
let encrypted = instance.encryptAes(JSON.stringify(text));
let encrypted_data = encrypted;

return encrypted_data;
}
};

🔓 Decryption Implementation

🔓

Decryption Function

Use this function to decrypt response data received from Hesabe API:

  export const getDecryptedData = value => {

let secret_key = 'XXXXX' // Secret key provided by Hesabe
let iv_key = 'XXXXX' // IV key provided by Hesabe

if(value) {
let secret = secret_key // merchant secret key
let ivCode = iv_key // merchant iv code

let key = aesjs.utils.utf8.toBytes(secret);
let iv = aesjs.utils.utf8.toBytes(ivCode);

let instance = new hesabeCrypt(key, iv);

let text = value;
let decrypted = instance.decryptAes(text);
let decrypted_data = JSON.parse(decrypted);

return decrypted_data;
}
}

📥 Example Kit & Support

📦

Example Kit

Complete JavaScript integration kit with Vue.js examples


🔧

Technical Support

For technical integration assistance with JavaScript