The X-Hash header is used to provide an additional layer of security for your API requests. It is a digital signature generated using your private key and is verified by BobPlus Africa using your public key. This ensures authenticity and integrity of your requests.
Purpose: Secure API requests and prevent tampering or impersonation.
Target Audience: All developers and businesses integrating with BobPlus Africa APIs.
Sign the data: Use your private key to sign your businessId or the agreed payload.
Base64 encode the signature: Add the result as the X-Hash header in your API request.
Step 1: Generate Your RSA Keys
First, create your RSA public and private keys. See the key generation guide for instructions.
Step 2: Sign the Request with Your Private Key
// Load your business ID and private key
$businessId = "XXXXXXXXXXXXX"; // Found on your merchant portal
$privateKeyString = str_replace("\\n", "\n", env('PRIVATE_KEY'));
$privateKey = openssl_pkey_get_private($privateKeyString);
// Data to sign (e.g., businessId or payload)
$dataToSign = $businessId;
// Generate the signature
openssl_sign($dataToSign, $signature, $privateKey, OPENSSL_ALGO_SHA256);
// Encode the signature to base64 for use in headers
$xHash = base64_encode($signature);
The signed value ($xHash) should now be added to your request headers.