Paybox integration
===

I try to integrate Paybox (http://www1.paybox.com/) credit card transaction solution.

I've tries at least 100 differents solutions (not kidding) but no one works and every time i got "Problème d'identification du commerce. Accès refusé !" message (in french).

Here is the most "stable" code I have :

    <?php
    
    function gen_hmac($site, $rang, $identifiant, $devise, $cmd, $porteur, $hash, $time, $total, $retour, $key) {
    	$msg = "PBX_SITE=". $site 
    		."&PBX_RANG=". $rang 
    		."&PBX_IDENTIFIANT=". $identifiant 
    		."&PBC_TOTAL=". $total 
    		."&PBX_DEVISE=". $devise 
    		."&PBC_CMD=". $cmd 
    		."&PBC_PORTEUR=". $porteur 
    		."&PBC_RETOUR=". $retour 
    		."&PBC_HASH=". $hash 
    		."&PBC_TIME=" . $time ;	
    		$binkey = pack("H*", $key);
    		echo "<!-- " . $msg . " -->";
    		$hmac = strtoupper(hash_hmac('sha512', $msg, $binkey));
    		echo "<!-- " . $hmac . " -->";
    	return $hmac;
    }
    
    	// static
    	$site = 1999888;
    	$rang = 32;
    	//$identifiant = 110647233;
    	$identifiant = 107904482;
    	$devise = 978;
    	$hash = "SHA512";
    	$key = "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF";
    	$cmd = "TEST Paybox";
    	$porteur = "test@paybox.com";
    	$time = date("c");
    	//$time = "2011-02-28T11:01:50+01:00";
    	
    	// variable
    	$total = 1000;
    	//$retour = "ref:R;trans:T;auto:A;tarif:M;abonnement:B;pays:Y;erreur:E";
    	$retour = "Mt:M;Ref:R;Auto:A;Erreur:E";
    	$hmac = gen_hmac($site, $rang, $identifiant, $devise, $cmd, $porteur, $hash, $time, $total, $retour, $key);
    	
    ?>
    
    <html>
    <head>
    <title>Paybox TEST</title>
    </head>
    <body>
    <?php
    //print_r(hash_algos());	
    ?>
    <form method="POST" action="https://preprod-tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi">
    <!--<form method="POST" action="https://preprod-tpeweb.paybox.com/cgi/MYframepagepaiement_ip.cgi">-->
    <!--<form method="POST" action="https://preprod-tpeweb.paybox.com/cgi/ChoixPaiementMobile.cgi">-->
    	<input type="hidden" name="PBX_SITE" value="<?php echo $site; ?>" />
    	<input type="hidden" name="PBX_RANG" value="<?php echo $rang; ?>" />
    	<input type="hidden" name="PBX_IDENTIFIANT" value="<?php echo $identifiant; ?>" />
    	<input type="hidden" name="PBX_TOTAL" value="<?php echo $total; ?>" />
    	<input type="hidden" name="PBX_DEVISE" value="<?php echo $devise; ?>" />
    	<input type="hidden" name="PBX_CMD" value="<?php echo $cmd; ?>" />
    	<input type="hidden" name="PBX_PORTEUR" value="<?php echo $porteur; ?>" />
    	<input type="hidden" name="PBX_RETOUR" value="<?php echo $retour; ?>" />
    	<input type="hidden" name="PBX_HASH" value="<?php echo $hash; ?>" />
    	<input type="hidden" name="PBX_TIME" value="<?php echo $time; ?>" />
    	<input type="hidden" name="PBX_HMAC" value="<?php echo $hmac; ?>" />
    	<!--<input type="hidden" name="PBX_REFUSE" value="http://test.fr/" />
    	<input type="hidden" name="PBX_ANNULE" value="http://test.fr/" />
    	<input type="hidden" name="PBX_EFFECTUE" value="http://test.fr/" />-->
    	<input type="submit" value="envoyer" />
    </form>
    </body>
    </html>


Most statics values are from paybox test documentation.

So do you know what's wrong with my code or do you know how to have more details about what is wrong on what is send to paybox server ?

Sincerely