7 posts / 0 new
Last post
richardschafer7643
HMAC Validation Failure with Python Direct API

I generated a sandbox key and secret, and downloaded the payeezy_direct_API project. I was able to successfully run the python example.py script using the default key, secret and merchant token. However, when I change the key, secret and merchant token to the ones from my account, the script fails to run with an HMAC Validation Failure. I even generated a different key and secret just to be sure.

Now, if I use my key, secret and merchant token in the Credit Card Payments Web form from the Docs and Sandbox, it works successfully and I get an HTTP 201 response.

Since the default key, secret and merchant token work correctly in the python example.py script, I don't believe this is a time sync issue. Is there anything else I should check in my python environment?


rohitrajagopal3538
Re: HMAC Validation Failure with Python Direct API

Hi Richard,

The HMAC validation is disabled for the default key and secret. So, it can still be a system time issue. If possible, can you try on a different computer?

Regards,

Payeezy team


richardschafer7643
Re: HMAC Validation Failure with Python Direct API

Ok. Good to know. I'll take another look at time synchronization and see if I can get my key and secret working on a different computer.


richardschafer7643
Re: HMAC Validation Failure with Python Direct API

I tried the Java example on the same computer using the default keys and all tests worked (mvn install). I then updated the pom.xml with my key, secret and token and the tests again worked just fine. This is starting to look like a bug in the python example code.


rohitrajagopal3538
Re: HMAC Validation Failure with Python Direct API

Hi Richard,

I got confirmation from our engineering team that the code on github is not accurate. In each of the requests, we need to get the nonce and timestamp as a HTTP header. This is missing in our github code.

We will be fixing this in Github soon. But in the meantime, to fix this on your machine, you will need to add the HTTP headers for timestamp and nonce in the http_authorization.py file on line numbers 84, 93 and 104.

Regards,

Payeezy team

 


richardschafer7643
Re: HMAC Validation Failure with Python Direct API

Thanks for the confirmation. I'll give that a try.


rohitrajagopal3538
Re: HMAC Validation Failure with Python Direct API

Richard - We have also fixed our sample code in Github.

Regards,

Payeezy team