Re: It work here is a solution

Solved! Go to solution
SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Invalid input found, please correct the input data

Hi @mavuma_dv,

 

If you are able to test successfully in Postman, that means your project credentials and certs are all good and the connection to Visa Network is working properly. I can't tell what is causing the error from your code, but our logs indicate that there are some type of illegal characters in the HTTP headers. Please check the headers Accept, Content-Type, Authorization are set as per the API ref docs and the base64 encoded form of username:password is identical to that generated by Postman.

 

Please also check out our Hello World Sample Code, it has coding samples in various languages. To download the sample code, please log in to your account and go to the General Assets section on the Dashboard page.

 

HelloWorldSampleCodes1.jpg

 


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

It work here is a solution

<?php
$userId = ""; /*Your user id*/
$password = ""; /*Your password*/
$postBody = array (
'surcharge' => '11.99',
'amount' => '124.02',
'localTransactionDateTime' => '2021-03-29T20:18:49',
'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' => '0700100038238906000013405823891061668252',
'systemsTraceAuditNumber' => '451001',
'businessApplicationId' => 'AA',
'senderPrimaryAccountNumber' => '4895142232120006',
'settlementServiceIndicator' => '9',
'visaMerchantIdentifier' => '73625198',
'foreignExchangeFeeTransaction' => '11.99',
'senderCardExpiryDate' => '2015-10',
'nationalReimbursementFee' => '11.22',
); /*Your POST body*/
$authString = $userId.':'.$password;
$authStringBytes = utf8_encode($authString);
$authloginString = base64_encode($authStringBytes);
$authHeader= "Authorization:Basic ".$authloginString;
$header = (array("Accept: application/json", "Content-Type: application/json", $authHeader));
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, "https://sandbox.api.visa.com/visadirect/fundstransfer/v1/pullfundstransactions");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postBody));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSLCERT, 'cert.pem');
curl_setopt($ch, CURLOPT_SSLKEY, 'key_7b8a6dd0-0f94-4ee7-a923-2f8e86805709.pem');
$results = curl_exec($ch);
curl_close($ch);
$data = array();
$data = json_decode($results, true);
echo $data['responseStatus']['message']."<br><br>";
echo $data['responseStatus']['status']."<br><br>";
echo $data['responseStatus']['severity']."<br><br>";
list($headers, $content) = explode("\r\n\r\n",$results,2);

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

// Print Content
print_r(json_decode($results));
?>

mavuma_dv
Helper

Re: It work here is a solution

The problem was in the payload i had to explicitly make an array and encode before posting it. Also the userid & password i had to assign them to a variable instead of passing them directly to the header.

 

Thank you for the support i hope this could be useful to other's struggling with the same issue.

mavuma_dv
Helper

Re: It work here is a solution

 

Header: HTTP/1.1 200 OK

Header: Server: nginx

Header: Date: Mon, 29 Mar 2021 20:51:36 GMT

Header: Content-Type: application/json;charset=UTF-8

Header: Content-Length: 368

Header: Connection: keep-alive

Header: X-SERVED-BY: l73c014

Header: X-CORRELATION-ID: 1617051095_935_1051116263_l73c014_VDP_WS

Header: X-APP-STATUS: 200

Header: X-APP-STATUS: 200

Header: X-Backside-Transport: OK OK,OK OK

Header: X-Global-Transaction-ID: 69536f0d60623dd77cd613dd

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: Content-Language: en-US

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

Header: X-Content-Type-Options: nosniff

Header: Strict-Transport-Security: max-age=15768000;includeSubdomains;always

SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: It work here is a solution

Hi @mavuma_dv,

 

Thanks for sharing your solution with the VDP community. 


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.