Re: Visa Cybersource show "Resource not found" in response body

Solved! Go to solution
ankur_trancis
Helper

Visa Cybersource show "Resource not found" in response body

I am using visa cybersource rest api for payment. Just trying to impliment visa cybersouce but stuck at some place. Please help me to intigrate cybersource.

URL : https://sandbox.api.visa.com/cybersource/v2/payments?apikey=6XNS7OT5FTPET91M1US821VSwYeGv7nxz0jt1P6Z...

Request Body : {
 "clientReferenceInformation": {
 "code": "TC50171_3"
},
"orderInformation": {
 "billTo": {
  "country": "US",
  "lastName": "VDP",
  "address1": "201 S. Division St.",
  "postalCode": "48104-2201",
  "locality": "Ann Arbor",
  "administrativeArea": "MI",
  "firstName": "RTS",
  "phoneNumber": "999999999",
  "district": "MI",
  "buildingNumber": "123",
  "company": "Visa",
  "email": "test@cybs.com"
},
"amountDetails": {
 "totalAmount": "102.21",
 "currency": "USD"
}
},
"paymentInformation": {
 "card": {
  "expirationYear": "2031",
  "number": "5555555555554444",
  "securityCode": "123",
  "expirationMonth": "12",
  "type": "002"
}
}
}

 

I have genrated x-pay-token using this string
x-pay-token string : 1521530541v2/paymentsapikey=6XNS7OT5FTPET91M1US821VSwYeGv7nxz0jt1P6Z4QhJkWyBs{"clientReferenceInformation":{"code":"TC50171_3"},"orderInformation":{"billTo":{"country":"US","lastName":"VDP","address1":"201 S. Division St.","postalCode":"48104-2201","locality":"Ann Arbor","administrativeArea":"MI","firstName":"RTS","phoneNumber":"999999999","district":"MI","buildingNumber":"123","company":"Visa","email":"test@cybs.com"},"amountDetails":{"totalAmount":"102.21","currency":"USD"}},"paymentInformation":{"card":{"expirationYear":"2031","number":"5555555555554444","securityCode":"123","expirationMonth":"12","type":"002"}}}

 

Header Send Is : 

Accept : application/json
ex-correlation-id : m6wVcc8p1Zhz_SC
x-pay-token : xv2:1521530541:a5a3db49dba74df65c25ff099ee0492104fc8c851b44d98bd6fe1a7b7bbb911b
Content-Type : application/json

 

Response Body : 

Resource not found

 

 

13 REPLIES 13
vkamboj
Community Moderator

Re: Visa Cybersource show "Resource not found" in response body

Hi Ankur, 

 

Thank you for your inquiry. Can you please verify Url is: https://sandbox.api.visa.com/cybersource/v2/payments?apikey=6XNS7OT5FTPET91M1US821VSwYeGv7nxz0jt1P6Z... and please verify http method is POST. 

 

Thank you, 

Vaibhav 

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

Re: Visa Cybersource show "Resource not found" in response body

Yes url is same and method is also post
vkamboj
Community Moderator

Re: Visa Cybersource show "Resource not found" in response body

Hi Ankur, 

 

Please test calling the API by replacing the APIkey and secret in the TestSuite custom properties with the one assigned to your project. Also, please replace the APIkey and secret in the XPAYTokenGeneration Grrovy Script as well and then execute the TestSuite. 

 

Thanks, 

Vaibhav

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

Re: Visa Cybersource show "Resource not found" in response body

Using same api and shared secret key which is provided in my sandbox credential
Apikey : 6XNS7OT5FTPET91M1US821VSwYeGv7nxz0jt1P6Z4QhJkWyBs
Shared secret : }L/Gk@S0$d6r-pFkULwjV5KrWI{{KWJXLEob5v}o

The CyberSource Payments API uses the following RESTful API concepts:

Resources: each payment function is accessed with a “resource”, such as authorizations, captures, etc. Each individual payment object, such as an authorization, can also be accessed with its unique resource id.
HTTP Verbs and Status: use HTTP GET to retrieve resource details and use HTTP POST to submit requests (for example, a payment authorization request) that change the state of the resource. The HTTP status code 200 is returned for a successful API call. Other HTTP status codes, such as 400 and 500, are returned for unsuccessful calls.
Hypermedia links for follow-on actions: CyberSource Payments API uses JSON Hypertext Application Language (HAL) to inform the follow-on actions that can be performed on a resource. For example, a payment capture can be performed on a successful payment authorization. If the HTTP Accept header is not found or has the value of “application/hal+json”, HAL links are returned in the response. If the HTTP Accept header has the value of “application/json”, plain JSON objects without HAL links are returned in the response.

Can you describe me 1 point actually I am confused to understand 1 point.
vkamboj
Community Moderator

Re: Visa Cybersource show "Resource not found" in response body

Hi Ankur, 

 

Thank you for your prompt response. I am not understanding what the questions is. Is it a question about GET vs POST or about Hypermedia links? 

 

Thank you, 

Vaibhav 

 

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

Re: Visa Cybersource show "Resource not found" in response body

I am asking about this point because the error( "Resource not found" ) i am getting i think related to this point.

"Resources: each payment function is accessed with a “resource”, such as authorizations, captures, etc. Each individual payment object, such as an authorization, can also be accessed with its unique resource id."

ankur_trancis
Helper

Re: Visa Cybersource show "Resource not found" in response body

Now my response is change and getting response

{"submitTimeUTC":"2018-03-24T09:40:25.021Z","status":"400","statusInformation":{"reason":"INVALID_DATA","message":"Invalid Json Request"}}

for same request in which i was getting response "resource noy found".

 

I am using nodejs so please give me solution in nodejs.

neutronron
Helper

Re: Visa Cybersource show "Resource not found" in response body

I'm getting the same problem.   "Resource not found"   (Status Code 404).   

 

[Update] I don't have a resolution yet, but found I was getting the invalid json error you mentioned above before I removed the carriage returns and line feeds in the json string.  I fixed that and it went back to "Resource not found".

 

If I figure that one out I'll definitely share the solution here.

 

vkamboj
Community Moderator

Re: Visa Cybersource show "Resource not found" in response body

Hi, 

 

For the Invalid Json Response using NodeJS please download the NodeJS sample code from our github repository (https://github.com/visa/SampleCode/tree/master/vdp-node/test/cybersource) and use the sample unit test in the cybersource folder

(cybersourcepaymentstest.js) as a guide to help you format the json payload. 

 

Thank you, 

Vaibhav 

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