The payloads checksum ensures data integrity and consistency during API requests.On incoming requests it ensures that the payment or payout request is from a valid merchant and that no one has tampered with it.Webhooks payload are also signed using the same method as defined below. This allows merchants to ensure that the webhook request came from ClickPesa and that no one has tampered with it.
Important When you change your checksum settings (turning on/off), you must regenerate your API tokens to ensure continued access to the API. Existing tokens will become invalid when checksum settings are modified.
Important When generating or validating a checksum, ensure the payload does not include the checksumMethod or checksum fields. These fields should be excluded from checksum computations.
Canonicalize Payload - Recursively sort all object keys alphabetically at every nesting level to ensure consistent ordering regardless of how the payload is structured.
Serialize to JSON - Convert the canonicalized payload to a compact JSON string (no extra whitespace).
Generate HMAC-SHA256 Hash - The JSON string is hashed using HMAC-SHA256 with the provided secret key.
Return the Hex Digest - The resulting hash is returned as a 64-character hexadecimal string.
Recursive sorting ensures that nested objects maintain consistent key ordering at all levels.
The same checksum is generated regardless of key order in the original payload.
All data types (strings, numbers, objects, arrays) are properly handled through JSON serialization.
The checksum is order-independent - the same payload with keys in different orders will produce the same checksum.