We will hold on to the personal data you’re sharing with us in order to facilitate your payment. We will never sell your info or share it with third parties unless required to do so by law. See our Privacy Policy for more information.
// Replace these with the values you receive from Realex Payments// Production
$merchantid = "powerinsurances";
$secret = "t9rsC3Eu3J";
$account = "internet";$realex_submit_url = ""; // NC: URL to send the form to// The code below is used to create the timestamp format required by Realex Payments
$timestamp = strftime("%Y%m%d%H%M%S");
mt_srand((double)microtime()*1000000);// orderid:Replace this with the order id you want to use.The order id must be unique.
// In the example below a combination of the timestamp and a random number is used.
$orderid = $timestamp."-".mt_rand(1, 999);// In this example these values are hardcoded. In reality you may pass
// these values from another script or take it from a database.
$curr = "EUR";$invalid_premium = false; // Is the premium amount invalid
$amount = $_POST['premium'];
$amount = preg_replace("/[^0-9\.]/", "", $amount); // Strip out anything other than numbers and '.'
if ( !preg_match('/^[0-9]+(?:\.[0-9]{2})?$/', $amount) ) { // Accepts e.g. 1200 or 1200.24
$invalid_premium = true;
}
$amount = $amount * 100;
//$amount = $_POST['premium'] * 100;// Below is the code for creating the digital signature using the SHA1 algorithm provided by PHP
$tmp = "$timestamp.$merchantid.$orderid.$amount.$curr";
$sha1hash = sha1($tmp);
$tmp = "$sha1hash.$secret";
$sha1hash = sha1($tmp);?>