Visa Developer Community

Highlighted
Helper

Internal Server Error on VPP API

Hello Visa developer team!

I'm going to use VPP API on my site.

I have encrypted payload body and send request.

But I'm getting internal server error.

Below is php script to call api and send request.

Please Help Me.

Best Regards.

 

$pub_key = openssl_pkey_get_public(file_get_contents(APPPATH . 'third_party/visa/server_cert.pem'));
$keyData = openssl_pkey_get_details($pub_key);
$publicKey = $keyData['key'];
$ivlen = openssl_cipher_iv_length($cipher="AES-128-GCM");
$iv = openssl_random_pseudo_bytes($ivlen);
$tag = "";
$encrypted = openssl_encrypt ($requestBodyString, $cipher, $publicKey, $options=OPENSSL_RAW_DATA, $iv,$tag);
$hmac = hash_hmac('sha256', $encrypted, $publicKey, $as_binary=true);
$encrypted = base64_encode($encrypted);
$curl = curl_init ();
$headers = (array("Accept: application/json", "Authorization: ".base64_encode("user_id:user_password")));
$absUrl = "https://sandbox.api.visa.com/acs/v1/payments/authorizations";
array_push($headers, "Content-Type: application/json");
$this->timeout = 80;
$this->connectTimeout = 30;
$method = "post";

$userId = "--user_id--";
$password = "user password";

$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();
$opts [CURLOPT_POST] = 1;
$opts [CURLOPT_POSTFIELDS] = $encrypted;
$opts [CURLOPT_URL] = $absUrl;
$opts [CURLOPT_RETURNTRANSFER] = true;
$opts [CURLOPT_CONNECTTIMEOUT] = $this->connectTimeout;
$opts [CURLOPT_TIMEOUT] = $this->timeout;
$opts [CURLOPT_HTTPHEADER] = $headers;
$opts [CURLOPT_HEADER] = 1;
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt_array ( $curl, $opts );

$response = curl_exec ( $curl );
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

15 REPLIES 15
Highlighted
Visa Dev Moderator

Re: Internal Server Error on VPP API

Hey @virsymcoin,

 

I'm happy to help you resolve the issue, please provide the following information for us to continue:

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.

 



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

Thanks,
Diana

Highlighted
Helper

Re: Internal Server Error on VPP API

Visa Payment Processing API...

End Point : https://sandbox.api.visa.com/acs/v1/payments/authorizations

 

Request Header:  "Authorization: ".base64_encode("LIUSUZOJKV3AMMWD20VA21I73zpAUxlw_soVfDnFEPaDuK134:GirIZcE93M8kgXAD0oNKABovCGx6Gds5Bx")

 

Request Body :

{
"acctInfo": {
"primryAcctNum": {
"pan": "4111111111111111",
"panExpDt": "2021-12"
}
},
"cardAcceptr": {
"clientId": "0123456789012345678901234567893"
},
"freeFormDescrptnData": "Freeformdata",
"msgIdentfctn": {
"correlatnId": "14bc567d90f23e56a8f045",
"origId": "123451234567890"
},
"msgTransprtData": "TransportData",
"transctn": {
"eComData": {
"digitalGoods": "true",
"eciCd": "5",
"xid": "EEC4567F90123A5678B0123EA67890D2345678FF"
},
"localDtTm": "2020-05-06T12:45:22",
"partialAuthInd": "true",
"posData": {
"envrnmnt": "eCom",
"panEntryMode": "OnFile",
"panSrce": "VCIND"
},
"tranAmt": {
"amt": "123.45",
"numCurrCd": "840"
},
"tranDesc": "Transactiondescription"
},
"verfctnData": {
"billngAddr": {
"addrLn": "PO Box 12345",
"postlCd": "12345"
}
},
"riskAssessmntData": {
"lowVlExmptn": "true",
"traExmptn": "true",
"trustdMerchntExmptn": "true",
"scpExmptn": "true",
"delgtdAthntctn": "true"
}
}

 

If it is possible, Please check my php code posted at first and provide me correct php code.

I need your help urgently...

Thanks for your reply.

Best Regards.

 

Highlighted
Visa Dev Moderator

Re: Internal Server Error on VPP API

Hey @virsymcoin,

 

Thanks for providing this info. I've logged INC9430391 for the engineering team to investigate and someone will get back to you soon.

 



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

Thanks,
Diana

Highlighted
Helper

Re: Internal Server Error on VPP API

Thanks for your kindness.
I am waiting for someone's help.
Highlighted
Helper

Re: Internal Server Error on VPP API

Hello DianaTran!
Thanks for your kindness.
I haven't got some's help yet.
Should I wait more?
Please help me asap...
This is urgent,,,
Highlighted
Community Manager

Re: Internal Server Error on VPP API

Hey @virsymcoin - what is the error message you get?




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

Re: Internal Server Error on VPP API

Hello ricardo_visa
Thanks for your reply.
This is error message
"The requested URL returned error: 500 Internal Server Error"
If it is possible, Please check my php script I sent first post already.
Or If you provide me php sample code, it will be very helpful.
Best Regards.
Highlighted
Community Manager

Re: Internal Server Error on VPP API

Thanks for sending. I will get back to you soon with more details. 

 

 

 




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

Re: Internal Server Error on VPP API

@virsymcoin  - can you also share the correlation ID from the error? We are also trying to view it in our logs to see what happened. 

 

 




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