I am trying to request but getting this error:
(b'{"responseStatus":{"status":400,"code":"9123","severity":"ERROR","message":"'
b'Expected input credential was not present","info":""}}')
I am trying with python code:
url = 'https://sandbox.api.visa.com/cofds-web/v1/datainfo'
headers = {
"requestMessageId":"6da6b8b024532a2e0eacb1af58581",
"messageDateTime":"2023-02-35 05:25:12.327"
}
body = {
"pANs":[
4072208010000000
],
"group":"STANDARD"
}
payload = json.loads('''{}
''')
user_id = 'U2OYFOD***********Wd6H-p50fe8'
password = 'Osc***************************BAxoJ'
# THIS IS EXAMPLE ONLY how will cert and key look like
# cert = 'cert.pem'
# key = 'key_83d11ea6-a22d-4e52-b310-e0558816727d.pem'
cert = 'C:\\Users\\Dipak.ugale\\Desktop\\P1\\forage\\visa\\cert.pem'
key = 'C:\\Users\\Dipak.ugale\\Desktop\\P1\\forage\\visa\\key_039d954e-38c9-4b36-b782-220c0c4c7805.pem'
verf = 'C:\\Users\\Dipak.ugale\\Desktop\\P1\\forage\\visa\\DigiCertGlobalRootCA.pem' #'put the CA certificate pem file path here'
timeout = 10
try:
response = requests.post(url,
verify = (verf),
#cert=(cert, key),
headers = headers,
auth=(user_id, password),
data = body,
json = payload,
timeout=timeout
#if DEBUG: print (response.text)
)
Thank you for reaching out, @DeepakUgale! An agent will get back to you as soon as possible. In the meantime, if any community members know a solution, then please feel free to reply to this thread.
Hi @DeepakUgale,
The problem here is that the x-pay-token is not properly getting generated.
Please make sure all the configuration parameters that are used to build the x-pay-token hash like the shared secret and the api key have been populated in the configuration.ini file of the php sample code.
For example:
apiKey=QZBF9XJOYEVBAGUXNK4W21yTwvsKeGvLacdlxV6M0HkvVYsdsf
sharedSecret=3x$sIOCjPgYJi{fP/pC0Bs3cVSwlc61u+rt}Xrasd
You can debug and step into the following function to make sure the x-pay-token is getting built:
VisaAPIClient:doXPayTokenCall
$sharedSecret = $this->conf ['VDP'] ['sharedSecret'];
$apiKey = $this->conf ['VDP'] ['apiKey'];
$time = time();
$preHashString = $time.$resource_path.$query_string.$requestBodyString;
$xPayToken = "xv2:".$time.":".hash_hmac('sha256', $preHashString, $sharedSecret);
Thanks,
Illana