Not able to use MLE while calling Payment Account Reference Inquiry API in Python

sahil_aggarwal
New Contributor

Not able to use MLE while calling Payment Account Reference Inquiry API in Python

Hi

 

While calling Payment Account Reference Inquiry API, it is mandatory to use MLE but not sure how  to encrypt payloads while calling the required API in java.

 

Please find the code as:

 

url = 'https://sandbox.api.visa.com/par/v1/inquiry'

cert = "<filepath>"

key = "<filepath>"

headers = {"Accept": "application/json"}

user_id = 'XXXX'

password = 'YYYY'

body = {}

timeout = 10

payload = json.loads('''{

"clientId": "XXX",

"correlatnId": "YYY",

"primaryAccount": "1234567898XXXXXX"

}''')

r = requests.get(url,

# verify = ( "<file_path>"),

cert = (cert,key),

headers = headers,

auth = (user_id, password),

#data = body,

json = payload,

timeout= timeout

)

print(r.text)

 

Getting output as 

{"responseStatus":{"status":405,"code":"9004","severity":"ERROR","message":"Method Not Allowed","info":""}}

 

How do we include MLE encrypt call to avoid this error

 

Thanks