user2959060
user2959060

Reputation: 31

Python/SSL authentification

I am trying to connect to the Visa Direct API, but i am not passing the basic SSL certificate authetification, here is my code:

import requests             
headers = { 'Content-Type' : 'Application/json' }
url = 'https://sandbox.visa.com/rsrv_vpp/v1/acnl'

 payload = {"SystemsTraceAuditNumber":565690,
"RetrievalReferenceNumber":"505012455690",
"AcquiringBin":409999,
"AcquirerCountryCode":"840",
"PrimaryAccountNumber":"4895070000008881"}

r = requests.post(url, data=json.dumps(payload), 
 cert =('/etc/ssl/certs/sandbox_cert.pem'), headers=headers,
 auth=('370df57a-a8aa-4446-a23e-44a0ef06ea09',
 '6023e518-c36c-47a8-b16e-c8a5b3a941ef'))

Ass you can see i am using request and passing the cert argument along with the API user and password info but i keep getting the error:

requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Upvotes: 0

Views: 771

Answers (1)

hostingutilities.com
hostingutilities.com

Reputation: 9549

I get a SSL error when I try to open https://sandbox.visa.com/rsrv_vpp/v1/acnl in Google Chrome.

The Visa Docs say

  1. SSL Server Authentication

The SSL server certificate installed on sandbox.visa.com servers is a Visa issued self-signed certificate. Client applications need to add the sandbox.visa.com SSL certificate to their local trust store to prevent SSL Handshake errors at runtime.

Ensure that your application that connects to the Visa Direct API is configured (or built) to use the trusted certificate store as a trust store, and not a key store.

Verify that the application is configured to use the right password associated with the trust store file.

It looks like you need to do do some SSL Authentication before you can connect to Visa.

Upvotes: 1

Related Questions