Re: Fail to post requests. "responseStatus":{"status":400,"code":&

passiveradio
Regular Visitor

Fail to post requests. "responseStatus":{"status":400,"code":"9125", ...}

Hello!

I'm new to VISA developer and trying to send requests to https://sandbox.api.visa.com/cofds-web/v1/datainfo to check whether the credit card is valid or not in Python.


Python code:

 

cert = 'C:\\Users\\user\\visa_cert\\cert.pem'

ca_cert = 'C:\\Users\\user\\visa_cert\\ca_cert.cer'
key = 'C:\\Users\\user\\visa_cert\\my_key.pem'

user_id = 'your user id of your project'
password = 'your password of your project'
timeout = 10

cred_info = 'credit_info.json'

payload = json.loads('''{
  "requestHeader": {
    "requestMessageId": "6da6b8b024532a2e0eacb1af58581",
    "messageDateTime": "2019-02-35 05:25:12.327"
  },
  "requestData": {
    "pANs": [
      4072208010000000
    ],
    "group": "STANDARD"
  }
}
''')

try:
    response = requests.post(url,
                            verify = (ca_cert),
                            cert=(cert, key),
                            # headers = headers,
                            auth=(user_id, password),
                            json = payload,
                            timeout=timeout
    )
except Exception as e:
    print(e)
 
Execution itself succeeded, but the response says the "Ecpectd input credential was not present"
 
Response header and contetns are as below.
 
response header:
{'Server': 'nginx', 'Date': 'Fri, 03 Jun 2022 13:52:17 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '130', 'Connection': 'keep-alive', 'X-SERVED-BY': 'c6795c5t4', 'X-CORRELATION-ID': '1654264337_872_241384137_c6795c5t4_VDP_WS', 'X-ERROR-ORIGIN': '9200', 'X-APP-STATUS': '400', 'X-Frame-Options':
'SAMEORIGIN', 'X-XSS-Protection': '0', 'X-Content-Type-Options': 'nosniff', 'Strict-Transport-Security': 'max-age=31536000;includeSubdomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '-1'}
 
response content:
b'{"responseStatus":{"status":400,"code":"9125","severity":"ERROR","message":"Expected input credential was not present","info":""}}'
 
I followed the instruction here(https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl#configuring_a_twoway_ssl_keystor...) to generate the CA certificate, double-checked my user_id and password are correct and two-way SSL certificate is active.
 
I googled this error, but I'm still not sure how to fix this problem.
 
Thank you.
passiveradio
12 REPLIES 12
jenn_kh
Community Moderator

Re: Fail to post requests. "responseStatus":{"status":400,"code":&quot

Thank you for reaching out, @passiveradio! An agent is looking for a solution for you and will get back to you shortly. In the meantime, if anyone has any ideas that you feel may help, please reply to this thread! -Jenn

API_Products
Visa Developer Support Specialist

Re: Fail to post requests. "responseStatus":{"status":400,"code":&quot

Hi @passiveradio,

 

I ran a sandbox test today and I received a successful request/response payload. Please see my sample payload below and try your test again. Please share your result with us and let us know if the error is fixed. Also, make sure that you enable the message level encryption.

 

End Point https://sandbox.api.visa.com/cofds-web/v1/datainfo
Method POST
Request
{
"requestHeader": {
"requestMessageId": "6da6b8b024532a2e0eacb1af58581",
"messageDateTime": "2019-02-35 05:25:12.327"
},
"requestData": {
"pANs": [4072208010000000],
"group": "STANDARD"
}
}
Response
{
"responseHeader": {
"numRecordsReturned": 1,
"responseMessageId": "1654533616_622_1904462834_-56467c7-9l8_VDP_WS",
"requestMessageId": "6da6b8b024532a2e0eacb1af58581",
"messageDateTime": "2022-06-06 16:40:17.112"
},
"responseData": {
"panList": [{"panData": {
"panResponseMsg": "Success",
"pAN": "4072208010000000",
"merchants": [
{
"mrchDbaName": "EDF ENERGY",
"mrchName": "EDF ENERGY",
"totalTranCount": "2",
"cardAcceptorId": "54421241",
"mrchDbaId": "20599",
"lastTranCurrency": "GBP",
"sponsoredMerchantId": "ABCD",
"lastMrchTranDt": "2019-04-26",
"vAUUpdateStatus": "N",
"lastTranAmtUSD": "517.63",
"acctNumOld4Digit": "",
"mCC": "4900",
"tokenPANReplacementStatus": "N",
"paymentFacilitatorId": "ABCD",
"lastTranAmt": "400.0",
"tokenReqstrId": "0000000",
"vAULastUpdateDate": "",
"mrchAddr": "TELEDOC 228 PARIS 12 PARIS 75012 PARIS FRANCE",
"mrchURL": "",
"confidenceInd": "C",
"tranTypeDetails": [{
"lastTranCurrency": "GBP",
"lastTranAmt": "400.0",
"lastTranAmtUSD": "517.63",
"tranCount": 2,
"lastTranDateTime": "2019-04-26 09:49:11.000",
"tranType": "MAIL_TELEPHONE"
}],
"tokenPANReplacementDate": "",
"lastTranDateTime": "2019-04-26 09:49:11.000",
"mrchPhoneNum": "0000000"
},
{
"mrchDbaName": "EDF ENERGY",
"mrchName": "EDF ENERGY",
"totalTranCount": "2",
"cardAcceptorId": "54421241",
"mrchDbaId": "20599",
"lastTranCurrency": "GBP",
"sponsoredMerchantId": "ABCD",
"lastMrchTranDt": "2019-04-26",
"vAUUpdateStatus": "N",
"lastTranAmtUSD": "517.63",
"acctNumOld4Digit": "",
"mCC": "4900",
"tokenPANReplacementStatus": "N",
"paymentFacilitatorId": "ABCD",
"lastTranAmt": "400.0",
"tokenReqstrId": "0000000",
"vAULastUpdateDate": "",
"mrchAddr": "TELEDOC 228 PARIS 12 PARIS 75012 PARIS FRANCE",
"mrchURL": "",
"confidenceInd": "C",
"tranTypeDetails": [{
"lastTranCurrency": "GBP",
"lastTranAmt": "400.0",
"lastTranAmtUSD": "517.63",
"tranCount": 2,
"lastTranDateTime": "2019-04-26 09:49:11.000",
"tranType": "MAIL_TELEPHONE"
}],
"tokenPANReplacementDate": "",
"lastTranDateTime": "2019-04-26 09:49:11.000",
"mrchPhoneNum": "0000000"
},
{
"mrchDbaName": "EDF ENERGY",
"mrchName": "EDF ENERGY",
"totalTranCount": "11",
"cardAcceptorId": "54421241",
"mrchDbaId": "20599",
"lastTranCurrency": "USD",
"sponsoredMerchantId": "ABCD",
"lastMrchTranDt": "2020-05-16",
"vAUUpdateStatus": "N",
"lastTranAmtUSD": "230.0",
"acctNumOld4Digit": "",
"mCC": "4900",
"tokenPANReplacementStatus": "N",
"paymentFacilitatorId": "ABCD",
"lastTranAmt": "198.0",
"tokenReqstrId": "0000000",
"vAULastUpdateDate": "",
"mrchAddr": "TELEDOC 228 PARIS 12 PARIS 75012 PARIS FRANCE",
"mrchURL": "",
"confidenceInd": "C",
"tranTypeDetails": [
{
"lastTranCurrency": "GBP",
"lastTranAmt": "345.08",
"lastTranAmtUSD": "345.08",
"tranCount": 3,
"lastTranDateTime": "2020-04-26 09:49:11.000",
"tranType": "SCHEDULED_RECURRING"
},
{
"lastTranCurrency": "USD",
"lastTranAmt": "180.99",
"lastTranAmtUSD": "180.99",
"tranCount": 4,
"lastTranDateTime": "2020-02-18 16:40:10.000",
"tranType": "INSTALLMENT"
},
{
"lastTranCurrency": "USD",
"lastTranAmt": "198.0",
"lastTranAmtUSD": "230.0",
"tranCount": 4,
"lastTranDateTime": "2020-05-16 15:36:28.000",
"tranType": "UNSCHEDULED_RECURRING"
}
],
"tokenPANReplacementDate": "",
"lastTranDateTime": "2020-05-16 15:36:28.000",
"mrchPhoneNum": "0000000"
},
{
"mrchDbaName": "EDF ENERGY",
"mrchName": "EDF ENERGY",
"totalTranCount": "4",
"cardAcceptorId": "54421241",
"mrchDbaId": "20599",
"lastTranCurrency": "GBP",
"sponsoredMerchantId": "ABCD",
"lastMrchTranDt": "2020-04-26",
"vAUUpdateStatus": "N",
"lastTranAmtUSD": "517.63",
"acctNumOld4Digit": "",
"mCC": "4900",
"tokenPANReplacementStatus": "N",
"paymentFacilitatorId": "ABCD",
"lastTranAmt": "400.0",
"tokenReqstrId": "0000000",
"vAULastUpdateDate": "",
"mrchAddr": "TELEDOC 228 PARIS 12 PARIS 75012 PARIS FRANCE",
"mrchURL": "",
"confidenceInd": "C",
"tranTypeDetails": [
{
"lastTranCurrency": "GBP",
"lastTranAmt": "400.0",
"lastTranAmtUSD": "517.63",
"tranCount": 2,
"lastTranDateTime": "2020-04-26 09:49:11.000",
"tranType": "MAIL_TELEPHONE"
},
{
"lastTranCurrency": "USD",
"lastTranAmt": "180.99",
"lastTranAmtUSD": "180.99",
"tranCount": 2,
"lastTranDateTime": "2020-02-18 16:40:10.000",
"tranType": "ECOM_OTHER"
},
{
"lastTranCurrency": "USD",
"lastTranAmt": "159.0",
"lastTranAmtUSD": "229.0",
"tranCount": 3,
"lastTranDateTime": "2020-05-16 15:36:28.000",
"tranType": "AUTH_VERIFICATION"
}
],
"tokenPANReplacementDate": "",
"lastTranDateTime": "2020-04-26 09:49:11.000",
"mrchPhoneNum": "0000000"
},
{
"mrchDbaName": "ITUNES MUSIC STORE",
"mrchName": "APL ITUNES COM BILL",
"totalTranCount": "1",
"cardAcceptorId": "337186000108778",
"mrchDbaId": "1624",
"lastTranCurrency": "USD",
"sponsoredMerchantId": "ABCD",
"lastMrchTranDt": "2020-02-08",
"vAUUpdateStatus": "Y",
"lastTranAmtUSD": "18.99",
"acctNumOld4Digit": "9024",
"mCC": "5734",
"tokenPANReplacementStatus": "N",
"paymentFacilitatorId": "ABCD",
"lastTranAmt": "18.99",
"tokenReqstrId": "00000000",
"vAULastUpdateDate": "2020-09-12",
"mrchAddr": "",
"mrchURL": "",
"confidenceInd": "C",
"tranTypeDetails": [{
"lastTranCurrency": "USD",
"lastTranAmt": "18.99",
"lastTranAmtUSD": "18.99",
"tranCount": 1,
"lastTranDateTime": "2020-02-08 16:40:10.000",
"tranType": "ECOM_OTHER"
}],
"tokenPANReplacementDate": "",
"lastTranDateTime": "2020-02-08 16:40:10.000",
"mrchPhoneNum": "866-712-7753"
},
{
"mrchDbaName": "OTHER RECREATION SERVICES",
"mrchName": "BT CAMPS SOUTH CAROL",
"totalTranCount": "0",
"cardAcceptorId": "000445199040996",
"mrchDbaId": "2836",
"sponsoredMerchantId": "ABCD",
"lastMrchTranDt": "",
"vAUUpdateStatus": "Y",
"acctNumOld4Digit": "9024",
"mCC": "7999",
"tokenPANReplacementStatus": "N",
"paymentFacilitatorId": "ABCD",
"lastTranAmt": "0",
"tokenReqstrId": "00000000",
"vAULastUpdateDate": "2020-09-12",
"mrchAddr": "",
"mrchURL": "www.citigroup.com",
"confidenceInd": "E",
"tranTypeDetails": [{
"lastTranCurrency": "USD",
"lastTranAmt": "159.0",
"lastTranAmtUSD": "159.0",
"tranCount": 1,
"lastTranDateTime": "2020-05-11 15:36:28.000",
"tranType": "AUTH_VERIFICATION"
}],
"tokenPANReplacementDate": "",
"mrchPhoneNum": ""
}
]
}}],
"group": "STANDARD"
},
"status": {
"statusDescription": "COF Service - Success",
"statusCode": "CDI000"
}
}
Response Header
Status Code: 200 OK
Server : nginx
Date : Mon, 06 Jun 2022 16:40:17 GMT
Content-Type : application/json;charset=UTF-8
Content-Length : 8176
Connection : keep-alive
X-SERVED-BY : -56467c7-9l8
X-CORRELATION-ID : 1654533616_622_1904462834_-56467c7-9l8_VDP_WS
X-APP-STATUS : 200
encrypted : true
Content-Language : en-US
Cache-Control : no-cache, no-store, must-revalidate
X-Frame-Options : SAMEORIGIN
X-XSS-Protection : 0
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains
Pragma : no-cache
Expires : -1
X-XSS-Protection : 1; mode=block
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains;always

 

 

 




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: Fail to post requests. "responseStatus":{"status":400,"code":&

Hi @passiveradio,

 

Is the error fixed?  




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

passiveradio
Regular Visitor

Re: Fail to post requests. "responseStatus":{"status":400,"code":&

Hi! Diana,

Thank you for spending your time to address my problem.

Actually, I suppose the cause of my problem is the credential things, because the error is "Expected input credential was not present". The credentials I use are the latest generated ones, so I couldn't address why it says the input credential is not present.

Are there any steps I missed to conduct SSL connection between Visa server and my computer ?

 

Thank you,

Yudai

API_Products
Visa Developer Support Specialist

Re: Fail to post requests. "responseStatus":{"status":400,"code":&

Hi @passiveradio

 

Please provide the information below:

1. Endpoint
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body

Using SoapUI, you can find the x-correlation-id in the Raw Tab of the response header.




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: Fail to post requests. "responseStatus":{"status":400,"code":&

Hi @passiveradio,

 

Please provide the information that I've asked of you in my prior post (above). Also, make sure to provide the x-correlation-id so that our engineering team can check the logs. If the error is fixed, let me know so that I can take you off my contact list. Thanks!




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Products
Visa Developer Support Specialist

Re: Fail to post requests. "responseStatus":{"status":400,"code":&

Hi @passiveradio,

 

I haven't received a reply from you, hence, I'll take you off my contact list. Please do not hesitate to submit a post on the community forum if you need further assistance. 




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

passiveradio
Regular Visitor

Re: Fail to post requests. "responseStatus":{"status":400,"code":&

Hi @API_Products,

Sorry for my late response.

Here are the information below you mentioned in the early reply.

 

Endpoint:  

https://sandbox.api.visa.com/cofds-web/v1/datainfo

 

Request Header:  

{
    'Accept': 'application/json'
}
I also tried the request post with no headers.
 
Request Body
no body
 
Response Header:  
{'Server': 'nginx', 'Date': 'Fri, 24 Jun 2022 08:47:37 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '130', 'Connection': 'keep-alive', 'X-SERVED-BY': '-74979967m6', 'X-CORRELATION-ID': '1656060457_795_1546301180_-74979967m6_VDP_WS', 'X-ERROR-ORIGIN': '9200', 'X-APP-STATUS': '400', 'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '0', 'X-Content-Type-Options': 'nosniff', 'Strict-Transport-Security': 'max-age=31536000;includeSubdomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'Pragma': 'no-cache', 'Expires': '-1'}
 
Response Body:  
{"responseStatus":{"status":400,"code":"9125","severity":"ERROR","message":"Expected input credential was not present","info":""}}
 
FYI, I'm working on Visa virtual intern program, "Visa Token Service Technology Virtual Experience Program" on Forage, and this is one of the task, "Task 1 Card Authentication", provided.
 
 
Thanks,
passiveradio

 

API_Products
Visa Developer Support Specialist

Re: Fail to post requests. "responseStatus":{"status":400,"code":&

Hi @passiveradio,

 

This error usually occurs when the client certificate is not sent or if the credentials you used are invalid. Please check these two scenarios and get back to me on your result. If you're still experiencing an error, I'll log an incident to our engineering team for you. 




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.