Hi there,
I am having trouble printing out matches in the Visa Supplier Matching Service API.
I am authenticated, but I am getting the following results:
{
"matchStatus": "",
"status": {
"statusDescription": "Request successfully received",
"statusCode": "SMSAPI000"
}
}
This is my code:
url = 'https://sandbox.api.visa.com/visasuppliermatchingservice/v1/search'
headers = {"Accept": "application/json"}
body = {}
params = {"supplierName": "Prodigy", "supplierCountryCode": "10014"}
payload = json.loads('''{
}
''')
try:
response = requests.post(url,
#verify = ('cert.pem'),
cert=(cert, key),
headers = headers,
auth=(user_id, password),
#data = body,
#json = payload,
timeout=timeout,
params=params
# if DEBUG: print (response.text)
)
print (response.text)
except Exception as e:
print(e)
I would expect the output to be similar to the results that appear on this site: https://www.visa.com/supplierlocator-app/app/#/home/supplier-locator
Any help would be appreciated.
Solved! Go to Solution
Hi @Jniven-tech,
The data in the sandbox environment is canned, hence you will not get the same results as from the live site. When you are ready to promote your project to production environment, you will be able to access live data.
Even if I use
params = {"supplierName": "supplier33", "supplierCountryCode": "60602"}
which is sandbox data, I still get the empty match status.
"matchStatus": "",
Is this expected? Not sure how I can test the api if I cant access anything.
Hi @Jniven-tech,
Please try supplierPostalCode=60602 and supplierCountryCode=840 in the query parameters.
For example:
End Point https://sandbox.api.visa.com/visasuppliermatchingservice/v1/search?supplierName=supplier33&supplierP...
Method POST
Request
{}
Response
{
"matchConfidence": "Low",
"matchStatus": "Yes",
"matchDetails": {
"l3li": "",
"l2": "",
"fleetInd": "",
"mcc": "",
"l3s": ""
},
"status": {
"statusDescription": "Request successfully received",
"statusCode": "SMSAPI000"
}
}
Thanks for the help!
I'm now getting the following response, it still doesnt seem to give me what you pasted above ie mcc etc.
{
"merchantLocatorServiceResponse": {
"header": {
"messageDateTime": "{dateTime}",
"numRecordsMatched": 0,
"numRecordsReturned": 0,
"requestMessageId": "{requestMessageIdValue}",
"responseMessageId": "68VDP667120160411185047748"
},
"status": {
"statusCode": "{msgCode}",
"statusDescription": "{msgDesc}"
}
}
}
This is my code:
url = 'https://sandbox.api.visa.com/visasuppliermatchingservice/v1/search?'
headers = {"Accept": "application/json"}
body = {}
params = {"supplierName": "supplier33", "supplierPostalCode": "60602", "supplierCountryCode":"840"}
payload = json.loads('''{
}
''')
try:
response = requests.post(url,
#verify = ('cert.pem'),
cert=(cert, key),
headers = headers,
auth=(user_id, password),
data = body,
#json = payload,
timeout=timeout,
params=params
# if DEBUG: print (response.text)
)
#print(response.headers)
print (response.text)
except Exception as e:
print(e)
Not sure what I am doing wrong so any help appreciated!!
Hi @Jniven-tech,
It looks like there's some issues with "supplier33" in sandbox. I'll ask our tech team to take a look. In the meantime, please try "supplier1" or "supplier17" (you can find test data from your Project Dashboard => Test Data tab).
Using "supplier1" I got the below response:
End Point https://sandbox.api.visa.com/visasuppliermatchingservice/v1/search?supplierName=supplier1&supplierCo...
Method POST
Request
{}
Response
{
"matchConfidence": "High",
"matchStatus": "Yes",
"matchDetails": {
"l3li": "",
"l2": "",
"fleetInd": "",
"mcc": "3501",
"l3s": ""
},
"status": {
"statusDescription": "Request successfully received",
"statusCode": "SMSAPI000"
}
}