An example of generating a signature for XML interfaces


<?php
$SignAlg = 'sha256';

$SignKey = 'VerySecretKey';

$UnsignedXML = '<?xml version="1.0" encoding="UTF-8"?>
<Command>
    <LMI_PAYMENT_NO>39702</LMI_PAYMENT_NO>
    <LMI_MERCHANT_ID>100</LMI_MERCHANT_ID>
    <LMI_HASH></LMI_HASH>
</Command>';

$Sign = hash($SignAlg, $UnsignedXML.$SignKey);

$RequestXML = str_replace('<LMI_HASH></LMI_HASH>', '<LMI_HASH>'.$Sign.'</LMI_HASH>', $UnsignedXML);

The result XML:

<?xml version="1.0" encoding="UTF-8"?>
<Command>
    <LMI_PAYMENT_NO>39702</LMI_PAYMENT_NO>
    <LMI_MERCHANT_ID>100</LMI_MERCHANT_ID>
    <LMI_HASH>8aef7557df723c985ba0b5394024fef106216043293bda5b42d467dc3359030d</LMI_HASH>
</Command>

results matching ""

    No results matching ""