Hash Validation


#1

Hello,

We kindly need to understand what parameters you send exactly to the result url and in which order in order to validate the hash correctly.

Let’s take particulary the payment with reference (85d113c0-db39-4626-8c7c-fc355e8e5c46).

We tried to validate the hash at our side using the below method.

string dataString = paynowCallback.reference + paynowCallback.amount + paynowCallback.paynowreference + paynowCallback.pollurl + paynowCallback.status;

string hash SHA512(dataString + IntegrationKey);
hash = hash.ToUpper();

However, the hash we generated was:
86F332B24C73A752A42992CFCD284D9B83C8AE4A59AC4779D7F895F2833F3D3BB33D4D04277416CE46946D62E8C7AB242B5C97484B8D31EBF2875F8A3051BAA0

While the hash sent by you was:
B6F56FEF54908638BE72093A52F98EE5F57EB7C726C2914D461BE28072C317E2B86BEBEC47259C0252F70F19289ED3BB67FB1D73652DFD4F9B0DCD0251704D70

We are sure we are generating the hash correctly because we have tried the same sample you have on your documentation and we got the same hash.

Our concern is maybe you are sending extra paremeters or sending them in another order.
Sharing the log of this case from your side will help us to find the issue.

Thanks,


#2

@sarkis hi. there is a good c# code example here:

Its important to consider all posted form data key/value pairs (except for the hash key/value pair) in the order they are received i.e. instead of looking for particular keys and their values, simply process whichever ones are there, in the order they are received.

Coding in that way will ensure that as Paynow adds new payment gateways, your hashing/hash validation code will continue to work as expected without requiring changes.