<?php

$plaintext = '{"tid": "1840515U",
"amount": "10",
"organization_code": "Retail",
"additional_attribute1": "attribute1",
"additional_attribute2": "attribute2",
"additional_attribute3": "attribute3",
"invoiceNumber": "",
"rrn": "",
"type": "SALE",
"cb_amt": "",
"app_code": "", 
"tokenisedValue": "",
"actionId": "1",
"request_urn": ""
}';
echo $encrypt = encrypt($plaintext);



function encrypt($data){
$cipher_algo = 'AES-256-CBC';
$key = 'X5mUl3J1jneCd0adISoHWDTj7U8Rnhvd';  //place key
$iv='1111111245683783';      // place iv

$encrypted_data = openssl_encrypt($data, $cipher_algo, $key,0, $iv);

 

return $encrypted_data;

}

 

function decrypt($data){

 

$cipher_algo = 'AES-256-CBC';

$key = 'X5mUl3J1jneCd0adISoHWDTj7U8Rnhvd';  //place key
$iv='1111111245683783';      // place iv

 

$decrypted_data = openssl_decrypt($data, $cipher_algo, $key,0, $iv);

 

return $decrypted_data;

}

 



 

//echo $encrypt;

 

//echo decrypt($encrypt);

 


?>