• France
Démonstrations
Rechercher
Catégories
Tags
Français
Français
Implémentation
Formulaire embarqué (cartes)
API REST de paiement
Formulaire en redirection
Échange de fichiers
Paiement Mobile
Exemples de code
Modules de paiement
Back office
Guides
Aide
FAQ
Tutoriels vidéos
Contacter le support

Exemple d'implémentation en PHP

Exemple de calcul de signature utilisant l'algorithme HMAC-SHA-256:

function getSignature ($params,$key)
{
    /**
     *Function that computes the signature.
     * $params : table containing the fields to send in the payment form.
     * $key : TEST or PRODUCTION key
     */
    //Initialization of the variable that will contain the string to encrypt
    $signature_content = "";
    //sorting fields alphabetically
    ksort($params);
    foreach($params as $name=>$value){
        //Recovery of vads_ fields
        if(substr($name,0,5)=='vads_'){
            //Concatenation with "+"
            $signature_content .= $value."+";
         }
    }
    //Adding the key at the end
    $signature_content .= $key;
    //Encoding base64 encoded chain with SHA-256 algorithm
    $signature = base64_encode(hash_hmac('sha256',$signature_content, $key, true));
    return$signature;
 }
© 2023 | Tous droits réservés à Clic&Pay
2.16.0-doc-1.8