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/).
- I calculate the hash value of (aid, api_version, mid, mode, portalid, responsetype, request, storecarddata) (Python) and pass it to client side.
# 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()
- and then do JSONP (why here is no CORS and RESTful API?) request to with additional params (cardcvc2, cardexpiredate, cardpan, cardtype) and hash that I got from serverside:
- get result:
{ "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?
PS:
- you can find example php code here, but no python code
PPS:
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:PS
In the same time
api_version
is noted as required parameter at section3.1.2 Standard parameter
and as parameter that should be hashed at section3.1.4 Calculation of the HASH value
. So it looks like type in documentation.