I'm trying to verify credit card on PayOne (https://www.payone.de/en/).
List of params I've got from According to 3.4.1 Verifying credit cards (creditcardcheck)
and 3.1.2 Standard parameter
section of documentation PAYONE_Platform_Client_API_EN.pdf (you can request it here https://www.payone.de/en/contact/).
# build hash on server side:
import hmac
import hashlib
params = {
'aid': '123456',
'api_version': '3.12',
'mid': '123456',
'mode': 'test',
'portalid': '1234567',
'responsetype': 'JSON',
'request': 'creditcardcheck',
'storecarddata': 'yes'
}
message = ''.join([params[k] for k in sorted(params)])
return hmac.new(b'some-secret-key!', msg=message.encode('utf-8'), digestmod=hashlib.sha384).hexdigest()
{ "customermessage": "An error occured while processing this transaction (wrong parameters).", "errorcode": "2007", "errormessage": "Hash incorrect", "status": "ERROR" }
I'm using python 3.5 and angular2.
What I'm doing wrong here?
The hash method has been chosen in the web interface: https://pmi.pay1.de/merchants/?navi=portal&rc=1 (Method hash calculation*: SHA2-384 (recommended method)
)
Solution is call endpoint without api_version
parameter:
# build hash on server side:
import hmac
import hashlib
params = {
'aid': '123456',
# 'api_version': '3.12',
'mid': '123456',
'mode': 'test',
'portalid': '1234567',
'responsetype': 'JSON',
'request': 'creditcardcheck',
'storecarddata': 'yes'
}
message = ''.join([params[k] for k in sorted(params)])
return hmac.new(b'some-secret-key!', msg=message.encode('utf-8'), digestmod=hashlib.sha384).hexdigest()
In the same time api_version
is noted as required parameter at section 3.1.2 Standard parameter
and as parameter that should be hashed at section 3.1.4 Calculation of the HASH value
. So it looks like type in documentation.