Invalid input found, please correct the input data

SOLVED
mavuma_dv
Helper

Invalid input found, please correct the input data

Which of the following certificate do i put in curl_setopt($tuCurl, CURLOPT_CAINFO, ) .

 

Here are my certificate I downloaded on visa sandbox:

1. cert.pem

2. key_7b8a6dd0-0f94-4ee7-a923-2f8e86805709

3. DigiCertGlobalRootCA.crt

4. VDPCA-SBX.pem

 

 

 

 

14 REPLIES 14
SLi
Visa Dev Moderator
Visa Dev Moderator

Re: Invalid input found, please correct the input data

Hi @mavuma_dv,

 

The error "Invalid input found" usually means that the request payload has invalid data. Can you please provide the following information so we may investigate further?

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

Please also reference below link on how to setup Two-Way SSL. It has detail information on the private key, client certificate, and certificate authority root certificate.

https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl 

 

Have a wonderful weekend!


Best,
Stacey

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

Re: Invalid input found, please correct the input data

url: https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions

 

header: curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Content-Type:application/json,application/octet-stream,'Authorization: Basic '. base64_encode('$userId:$password')"));

 

payload:

$data = array (
'surcharge' => '11.99',
'amount' => '124.02',
'localTransactionDateTime' => '2021-03-23T11:11:24',
'cpsAuthorizationCharacteristicsIndicator' => 'Y',
'riskAssessmentData' =>
array (
'traExemptionIndicator' => true,
'trustedMerchantExemptionIndicator' => true,
'scpExemptionIndicator' => true,
'delegatedAuthenticationIndicator' => true,
'lowValueExemptionIndicator' => true,
),
'colombiaNationalServiceData' =>
array (
'addValueTaxReturn' => '10.00',
'taxAmountConsumption' => '10.00',
'nationalNetReimbursementFeeBaseAmount' => '20.00',
'addValueTaxAmount' => '10.00',
'nationalNetMiscAmount' => '10.00',
'countryCodeNationalService' => '170',
'nationalChargebackReason' => '11',
'emvTransactionIndicator' => '1',
'nationalNetMiscAmountType' => 'A',
'costTransactionIndicator' => '0',
'nationalReimbursementFee' => '20.00',
),
'cardAcceptor' =>
array (
'address' =>
array (
'country' => 'USA',
'zipCode' => '94404',
'county' => '081',
'state' => 'CA',
),
'idCode' => 'ABCD1234ABCD123',
'name' => 'Visa Inc. USA-Foster City',
'terminalId' => 'ABCD1234',
),
'acquirerCountryCode' => '840',
'acquiringBin' => '408999',
'senderCurrencyCode' => 'USD',
'retrievalReferenceNumber' => '330000550000',
'addressVerificationData' =>
array (
'street' => 'XYZ St',
'postalCode' => '12345',
),
'cavv' => '0000010926000071934977253000000000000000',
'systemsTraceAuditNumber' => '451000',
'businessApplicationId' => 'AA',
'senderPrimaryAccountNumber' => '4895142232120006',
'settlementServiceIndicator' => '9',
'visaMerchantIdentifier' => '73625198',
'foreignExchangeFeeTransaction' => '11.99',
'senderCardExpiryDate' => '2015-10',
'nationalReimbursementFee' => '11.22',
);

 

result:

Array ( [url] => https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions [content_type] => application/json [http_code] => 400 [header_size] => 581 [request_size] => 322 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.34025 [namelookup_time] => 0.170714 [connect_time] => 0.457555 [pretransfer_time] => 1.045758 [size_upload] => 0 [size_download] => 141 [speed_download] => 105 [speed_upload] => 0 [download_content_length] => 141 [upload_content_length] => -1 [starttransfer_time] => 1.339944 [redirect_time] => 0 [redirect_url] => [primary_ip] => 198.241.194.217 [certinfo] => Array ( ) [primary_port] => 443 [local_ip] => 41.76.109.116 [local_port] => 39396 [http_version] => 2 [protocol] => 2 [ssl_verifyresult] => 0 [scheme] => HTTPS [appconnect_time_us] => 1045551 [connect_time_us] => 457555 [namelookup_time_us] => 170714 [pretransfer_time_us] => 1045758 [redirect_time_us] => 0 [starttransfer_time_us] => 1339944 [total_time_us] => 1340250 ) Took 1.34025 seconds to send a request to https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions

SLi
Visa Dev Moderator
Visa Dev Moderator

Re: Invalid input found, please correct the input data

Hi @mavuma_dv,

 

I just tried sending your request payload and I got a success response. Details below, please note that I have masked the PAN as I can't share PAN information on a public forum. Can you please share the X-CORRELATION-ID from the response header?

 

End Point https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions
Method POST
Request
{
"surcharge": "11.99",
"amount": "124.02",
"localTransactionDateTime": "2021-03-23T11:11:24",
"cpsAuthorizationCharacteristicsIndicator": "Y",
"riskAssessmentData": {
"traExemptionIndicator": "true",
"trustedMerchantExemptionIndicator": "true",
"scpExemptionIndicator": "true",
"delegatedAuthenticationIndicator": "true",
"lowValueExemptionIndicator": "true"
},
"colombiaNationalServiceData": {
"addValueTaxReturn": "10.00",
"taxAmountConsumption": "10.00",
"nationalNetReimbursementFeeBaseAmount": "20.00",
"addValueTaxAmount": "10.00",
"nationalNetMiscAmount": "10.00",
"countryCodeNationalService": "170",
"nationalChargebackReason": "11",
"emvTransactionIndicator": "1",
"nationalNetMiscAmountType": "A",
"nationalReimbursementFee": "20.00",
"costTransactionIndicator": "0"
},
"cardAcceptor": {
"address": {
"country": "USA",
"zipCode": "94404",
"county": "081",
"state": "CA"
},
"idCode": "ABCD1234ABCD123",
"name": "Visa Inc. USA-Foster City",
"terminalId": "ABCD1234"
},
"acquirerCountryCode": "840",
"acquiringBin": "408999",
"retrievalReferenceNumber": "330000550000",
"senderCurrencyCode": "USD",
"addressVerificationData": {
"street": "XYZ St",
"postalCode": "12345"
},
"cavv": "0000010926000071934977253000000000000000",
"systemsTraceAuditNumber": "451001",
"businessApplicationId": "AA",
"senderPrimaryAccountNumber": "489514**********",
"settlementServiceIndicator": "9",
"visaMerchantIdentifier": "73625198",
"foreignExchangeFeeTransaction": "11.99",
"senderCardExpiryDate": "2015-10",
"nationalReimbursementFee": "11.22"
}

 

Response
{
"transmissionDateTime": "2021-03-24T04:29:29.000Z",
"approvalCode": "98765X",
"cavvResultCode": "4",
"settlementFlags": {
"settlementServiceFlag": "9",
"givUpdatedFlag": "false",
"settlementResponsibilityFlag": "true",
"givPreviouslyUpdatedFlag": "true"
},
"cpsAuthorizationCharacteristicsIndicator": "3333",
"transactionIdentifier": 107485085644522,
"actionCode": "00",
"responseCode": "5"
}

 

Response Header
Status Code: 200 OK
Server : nginx
Date : Wed, 24 Mar 2021 04:29:29 GMT
Content-Type : application/json;charset=UTF-8
Content-Length : 368
Connection : keep-alive
X-SERVED-BY : l73c016
X-CORRELATION-ID : 1616560168_958_942892886_l73c016_VDP_WS
X-APP-STATUS : 200
X-APP-STATUS : 200
X-Backside-Transport : OK OK,OK OK
X-Global-Transaction-ID : 69536f0d605ac0290052291c
X-Frame-Options : SAMEORIGIN
X-XSS-Protection : 1; mode=block
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=2592000;includeSubdomains
Cache-Control : no-cache, no-store, must-revalidate
Pragma : no-cache
Expires : -1
Content-Language : en-US
X-XSS-Protection : 1; mode=block
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=15768000;includeSubdomains;always

 


Best,
Stacey

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

Re: Invalid input found, please correct the input data

Hi thank you for the respond again.. here is the info you requested:

 

Header: HTTP/1.1 400

Header: Server: nginx

Header: Date: Wed, 24 Mar 2021 09:59:45 GMT

Header: Content-Type: application/json

Header: Content-Length: 141

Header: Connection: keep-alive

Header: X-SERVED-BY: l73c012

Header: X-CORRELATION-ID: 1616579985_722_1092765046_l73c012_VDP_WS

Header: x-vdp-normalized-url: /visadirect/fundstransfer/v1/pullfundstransactions

Header: X-Frame-Options: SAMEORIGIN

Header: X-XSS-Protection: 1; mode=block

Header: X-Content-Type-Options: nosniff

Header: Strict-Transport-Security: max-age=2592000;includeSubdomains

Header: Cache-Control: no-cache, no-store, must-revalidate

Header: Pragma: no-cache

Header: Expires: -1

Header: X-APP-STATUS: 400

SLi
Visa Dev Moderator
Visa Dev Moderator

Re: Invalid input found, please correct the input data

Hi @mavuma_dv,

 

Thanks for sharing the x-correlation-id, this is helpful. We're able to check in our logs and see that there are some type of illegal characters in the HTTP headers. Can you please share what exactly you are sending in the HTTP headers?

 


Best,
Stacey

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

Re: Invalid input found, please correct the input data

my headers

curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Content-Type:application/json,application/octet-stream,'Authorization: Basic '. base64_encode('$userId:$password')"));

 

More details

$infor = json_encode(array($data));
curl_setopt($tuCurl, CURLOPT_URL, 'https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions');
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($tuCurl, CURLOPT_PORT, 443);
curl_setopt($tuCurl, CURLOPT_VERBOSE, true);
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, 2);
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 1);
curl_setopt($tuCurl, CURLOPT_SSLCERT, 'cert.pem');
curl_setopt($tuCurl, CURLOPT_SSLKEY, 'key_7b8a6dd0-0f94-4ee7-a923-2f8e86805709.pem');
curl_setopt($tuCurl, CURLOPT_CAINFO, 'cacert.pem');
//curl_setopt($tuCurl, CURLOPT_POST, 1);
curl_setopt($tuCurl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($tuCurl, CURLOPT_HEADER, true);

 

 

SLi
Visa Dev Moderator
Visa Dev Moderator

Re: Invalid input found, please correct the input data

Hi @mavuma_dv,

 

Please share the actual header value that is being sent. What is shown above is just some variables that haven't been set yet.

 

Since the API is working on our end, please check your SSL setup. Below link provides detail step-by-steps on how to setup Two-Way SSL. I also recommend using an API tool like SOAPUI or Postman to quickly test your project credentials and connections to the API first.

https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl 

 

 

 

 


Best,
Stacey

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

Re: Invalid input found, please correct the input data

Hi again thank you for your patience i decide to send the entire code.. i hope it will be more help full.

Also note that the cacert.pem file is actually  this file: VDPCA-SBX.pem. I just renamed it.

 

Code below:

 

<?php
$tuCurl = curl_init();


// login credentials //
$userId = "RL38VUFQ0JND5NY76SIU21SHLHp05dWIRiziBTQvUCm8babPo";
$password = "XL8ChC06KopjkL";
// end login

$infor = json_encode(array($data));
curl_setopt($tuCurl, CURLOPT_URL, 'https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions');
curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($tuCurl, CURLOPT_PORT, 443);
curl_setopt($tuCurl, CURLOPT_VERBOSE, true);
curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, 2);
curl_setopt($tuCurl, CURLOPT_SSLVERSION, 1);
curl_setopt($tuCurl, CURLOPT_SSLCERT, 'cert.pem');
curl_setopt($tuCurl, CURLOPT_SSLKEY, 'key_7b8a6dd0-0f94-4ee7-a923-2f8e86805709.pem');
curl_setopt($tuCurl, CURLOPT_CAINFO, 'cacert.pem');
//curl_setopt($tuCurl, CURLOPT_POST, 1);
curl_setopt($tuCurl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($tuCurl, CURLOPT_HEADER, true);
//curl_setopt($tuCurl, CURLOPT_NOBODY, 1);
curl_setopt($tuCurl, CURLOPT_POST, '{
"surcharge": "11.99",
"amount": "124.02",
"localTransactionDateTime": "2021-03-23T11:11:24",
"cpsAuthorizationCharacteristicsIndicator": "Y",
"riskAssessmentData": {
"traExemptionIndicator": "true",
"trustedMerchantExemptionIndicator": "true",
"scpExemptionIndicator": "true",
"delegatedAuthenticationIndicator": "true",
"lowValueExemptionIndicator": "true"
},
"colombiaNationalServiceData": {
"addValueTaxReturn": "10.00",
"taxAmountConsumption": "10.00",
"nationalNetReimbursementFeeBaseAmount": "20.00",
"addValueTaxAmount": "10.00",
"nationalNetMiscAmount": "10.00",
"countryCodeNationalService": "170",
"nationalChargebackReason": "11",
"emvTransactionIndicator": "1",
"nationalNetMiscAmountType": "A",
"nationalReimbursementFee": "20.00",
"costTransactionIndicator": "0"
},
"cardAcceptor": {
"address": {
"country": "USA",
"zipCode": "94404",
"county": "081",
"state": "CA"
},
"idCode": "ABCD1234ABCD123",
"name": "Visa Inc. USA-Foster City",
"terminalId": "ABCD1234"
},
"acquirerCountryCode": "840",
"acquiringBin": "408999",
"retrievalReferenceNumber": "330000550000",
"senderCurrencyCode": "USD",
"addressVerificationData": {
"street": "XYZ St",
"postalCode": "12345"
},
"cavv": "0000010926000071934977253000000000000000",
"systemsTraceAuditNumber": "451001",
"businessApplicationId": "AA",
"senderPrimaryAccountNumber": "4895142232120006",
"settlementServiceIndicator": "9",
"visaMerchantIdentifier": "73625198",
"foreignExchangeFeeTransaction": "11.99",
"senderCardExpiryDate": "2015-10",
"nationalReimbursementFee": "11.22"
}');
curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Content-Type:application/json,application/octet-stream,'Authorization: Basic '. base64_encode('$userId:$password')"));

$tuData = curl_exec($tuCurl);
$data = array();
$data = json_decode($tuData, true);
echo $data['responseStatus']['message']."<br><br>";
echo $data['responseStatus']['status']."<br><br>";
echo $data['responseStatus']['severity']."<br><br>";


if(!curl_errno($tuCurl)){
$info = curl_getinfo($tuCurl);
print_r($info);
echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
list($headers, $content) = explode("\r\n\r\n",$tuData,2);

// Print header
foreach (explode("\r\n",$headers) as $hdr)
printf('<p>Header: %s</p>', $hdr);

// Print Content
echo $content;
} else {
echo 'Curl error: ' . curl_error($tuCurl);
}

?>

 

mavuma_dv
Helper

Re: Invalid input found, please correct the input data

Also note! I did a couple test in postman and it works. now i am doing the test straight from my vps hosting.

I noticed that in postman i only put authentication(userId, password) and upload the cert.pem, key_7b8a6dd0-0f94-4ee7-a923-2f8e86805709.pem and it just works fine. on my vps hosting on the other hand when i use only authenticationauthentication(userId, password), and this two certificate cert.pem, key_7b8a6dd0-0f94-4ee7-a923-2f8e86805709.pem  it gives me the (invalid input error). So i tried using the three certificates cert.pem, key_7b8a6dd0-0f94-4ee7-a923-2f8e86805709.pem, VDPCA-SBX.pem and it gives me (self assigned certificate error).

 

Thank You