Community,
We’re encountering a critical issue while integrating with PayNow Zimbabwe’s payment gateway. Despite following the official documentation, we keep receiving Invalid Hash errors with constantly changing prefix requirements. Would appreciate any insights from those who’ve solved similar issues.
Problem Description
Every request returns an Invalid Hash error, but the required prefix changes with each attempt:
- First error:
Hash should start with: 0AC4FE - Subsequent error:
Hash should start with: 8BD3B4 - Latest error:
Hash should start with: 7A2C1F(example)
Our Implementation
1. Hash Generation (Python)
python
import hashlib params = { “id”: “21452”, “reference”: “TEST_ORDER_123”, “amount”: “10.00”, “returnurl”: “https://yourdomain.com/return”, “resulturl”: “https://yourdomain.com/ipn”, “status”: “Message”, “key”: “4e1af19b-86de-4b9d-92b4-f52f5f725f07” } # Concatenation order per documentation data = params[“id”] + params[“reference”] + params[“amount”] + params[“returnurl”] + params[“resulturl”] + params[“status”] + params[“key”] full_hash = hashlib.sha512(data.encode()).hexdigest().upper() paynow_hash = “PREFIX_FROM_ERROR” + full_hash[6:] # Dynamic prefix
2. Sample cURL Request
bash
curl --location ‘https://www.paynow.co.zw/interface/initiatetransaction’ \ --header ‘Content-Type: application/x-www-form-urlencoded’ \ --data-urlencode ‘id=21452’ \ --data-urlencode ‘key=4e1af19b-86de-4b9d-92b4-f52f5f725f07’ \ --data-urlencode ‘reference=TEST_ORDER_123’ \ --data-urlencode ‘amount=10.00’ \ --data-urlencode ‘returnurl=https://yourdomain.com/return’ \ --data-urlencode ‘resulturl=https://yourdomain.com/ipn’ \ --data-urlencode ‘status=Message’ \ --data-urlencode ‘authemail=alinknest123@gmail.com’ \ --data-urlencode ‘hash=7A2C1F9F86D081884C7D659A2FEAA0C55AD015A3BF4F1B2B0B822CD15D6C15B0F00A08’
3. Server Response
http
HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 status=Error&error=Invalid+Hash.++Hash+should+start+with%3a+9F3A2D # New prefix!
What We’ve Tried
- Generated hashes using SHA-512 as per documentation
- Dynamic prefix updates based on error responses
- Verified parameter order and encoding
- Tested with/without optional
authemailparameter - Used both test mode (
id=2) and live credentials
Key Questions
- Why does the required hash prefix change with every request?
- Is there a hidden parameter (timestamp/nonce) we should include?
- Does
authemailbelong in the hash generation string? - Are there secret salts or key rotations we’re missing?
- Has anyone successfully integrated recently with working sample code?
Environment
- API Endpoint:
https://www.paynow.co.zw/interface/initiatetransaction - Authentication: Merchant ID + Secret Key
- Security: SHA-512 hashing
Any help is appreciated! We’ll update this thread with solutions found. For direct collaboration: contact@example.com
Posted in: [PayNow Community Forum] • [Stack Overflow] • [Zimbabwe Devs Network]
Attachments:
- [Full request/response logs]
- [Documentation screenshot]
Update: According to PayNow support, prefixes are dynamically generated per transaction session. But implementation details remain unclear.