Suivez ces étapes pour vous assurer que votre intégration correspond à notre protocole de sécurité. Utilisez les exemples de données de requête suivants :
Exemple de code
Exemple de réorganisation et de concaténation :
Javascript
const orderedString = Object.keys(data).sort().map(key => \`\${key}\${data[key]}\`).join('');
Php
$orderedString = '';
ksort($data);
foreach ($data as $key => $value) {
$orderedString .= $key . $value;
}
Python
orderedString = ''.join([f"{k}{v}" for k, v in sorted(data.items())])
Générer la signature :
Javascript
const signature = CryptoJS.MD5(orderedString + signatureKey).toString();
Php
$signature = md5($orderedString . $signatureKey);
Python
import hashlib
signature = hashlib.md5((orderedString + signatureKey).encode('utf-8')).hexdigest()
Chiffrer les données :
Javascript
const encryptedData = CryptoJS.AES.encrypt(JSON.stringify(finalData), cryptKey).toString();
Php
$encryptedData = openssl_encrypt(json_encode($finalData), 'aes-256-cbc', $cryptKey);
Python
from Crypto.Cipher import AES
import base64
cipher = AES.new(cryptKey.encode('utf-8'), AES.MODE_CBC, iv)
encryptedData = base64.b64encode(cipher.encrypt(pad(json.dumps(finalData).encode('utf-8')))).decode('utf-8')