PayVantage 2.0 7 APIs

PayVantage 2.0 is an advanced module to enable corporate aggregators/partners to use Axis Bank APIs securely.


 Payvantage 2.0

Payvantage 2.0 request/response are encrypted in higher environments


Encryption Sample Code:

const jose = require('jose');
const { axisPrivateKey, axisPublicCert, clientPrivateKey, clientPublicCert } = require('./keys')

async function joseJWEEnc(){

  try {
  const algorithm = 'RS256'
  const _axisPublicCert = await jose.importX509(axisPublicCert, algorithm)
  const _clientPrivateKey = await jose.importPKCS8(clientPrivateKey, algorithm)  //used only pkc8 key, pkc1 key wont work
  
  const jwe = await new jose.CompactEncrypt(
    new TextEncoder().encode(
     JSON.stringify(datatobeenc)
    )
  ).setProtectedHeader({ alg: 'RSA-OAEP-256', enc: 'A256GCM' }).encrypt(_axisPublicCert)
  
  const jws = await new jose.CompactSign(
    new TextEncoder().encode(
    jwe
    )
  ).setProtectedHeader({ alg: algorithm }).sign(_clientPrivateKey)
  return jws
}
catch(ex)
{
  console.log('error while encryption - ', ex)
}
}

(async ()=>{
 console.log(await joseJWEEnc());
})()
  


Decryption Sample Code:

const jose = require('jose');
const { axisPrivateKey, axisPublicCert, clientPrivateKey, clientPublicCert, gPrivateKey, gPublicCert } = require('./keys')


const algorithm = 'RS256'

async function joseJWEDec(encString){

try{

  const _clientPublicCert = await jose.importX509(clientPublicCert, algorithm)
  const _axisPrivateKey = await jose.importPKCS8(axisPrivateKey, algorithm)  //used only pkc8 key, pkc1 key wont work
  
  const { payload, protectedHeader } = await jose.compactVerify(encString, _pvPublicCert)
  
  const { plaintext } = await jose.compactDecrypt(new TextDecoder().decode(payload), _axisPrivateKey)
  var decryptedString=new TextDecoder().decode(plaintext);
  return decryptedString
  
  }
  catch(ex){
    console.log('error while decryption - ', ex)
  }
  }

  (async()=>{
    console.log(await joseJWEDec())
  })()
  

PV use Cases


Axis Aha!