CyberSource Payments API - v2/payments sample for SoapUI?

Solved! Go to solution
neutronron
Helper

CyberSource Payments API - v2/payments sample for SoapUI?

Does anyone have a working SoapUI project sample that calls the v2/payments endpoint (process payment)?

 

I pulled one from here on the forums (attached) .... and after replacing the API Key and Shared Secret, still couldn't get past the 401, "Token validation failed" error.

 

 

8 REPLIES 8
API_Products
Visa Developer Support Specialist

Re: CyberSource Payments API - v2/payments sample for SoapUI?

Hello,

 

Thanks for helping the Visa Developer Community every time you post questions and solutions to this forum! This is an authentication error. The API assertion/token is either not provided or invalid. Please follow the steps in the “Get Started” link below to register and create a Visa Developer application.
https://developer.visa.com/vdpguide#get-started-overview
 
This guide walks you through the key steps for application creation, credentials, and connection validation.

 

Please check to make sure you are not passing an incorrect value for URI. Please check to see that the URI is defined correctly in the beginning of your code and that the URI in the middle of your code is correct and that you are using the same correct URI as in the beginning of your code. Please extend your SOAPUI project, and make sure that you can call a particular API from SOAPUI project first.

 

Thank you,

Diana




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.

neutronron
Helper

Re: CyberSource Payments API - v2/payments sample for SoapUI?

That's what I thought.  I've read the documentation of course, several times.  And I had no problem with the helloworld example.

 

Can you offer any other advice?   I was hoping someone might be willing to share an exported (working) project for SoapUI that I could try (with our own API key and shared secret) so we can rule out other issues. 

 

In SoapUI, I'm getting this invalid token error when trying to access v2/payments (but not the helloworld resource).   In our product code, we're getting "Resource not Found" when we try to access v2/payments  Plus, we've had the x-pay-token building code working for months.   It seems like there's something more than a bad API key going on here.  

 

Thanks,

Ron

neutronron
Helper

Re: CyberSource Payments API - v2/payments sample for SoapUI?

Here are some screen caps that might help to clarify the problem - I'm hoping the solution will just jump out at someone.

 

1. helloworld works ....

 

helloworld.png

 

2. The script is modified to use the URI "v2/payments" and assign the request JSON to the payload to calculate the x-pay-token correctly:

 

groovyscript.png

 

3. Then the request is updated to call ..../cybersource/v2/payments and the JSON request string is assigned to the body of the request:

request-error.png

 

Resulting in a token validation error.

 

 

 

 

daveg
Regular Visitor

Re: CyberSource Payments API - v2/payments sample for SoapUI?

I think your problem is on the JSON body. Try using a very simple body in a single line like

 

{"test" : "value"}

 

Try replacing the payload variable in the groovy script with this string, run the script and then also replace the request body with exactly the same string and send the request.

 

This body is definitely wrong but at least you will know if the problem is the generation of the token from the json body. 

If it works (not getting a 401 anymore) try using your JSON body with no carriage returns in the groovy script and the request body and let me know the result.

neutronron
Helper

Re: CyberSource Payments API - v2/payments sample for SoapUI?

Hi - 

 

Thanks for the suggestion ... I should have posted an update.   I did modify the payload and was able to get the SoapUI test to work.  No carriage returns or line feeds in the payload ... also, escaping the double quotes was a problem, so I bounded the string in single quotes and left the double quotes as is.  

 

So the SoapUI test call to v2/payments is working, but still getting "Resource not found" when making the same call from our development environment.    It's been difficult getting support on this, but I'm hopeful that we'll hear something back soon.

 

I see that others are getting this error too, so I'll follow up with any solutions we get, here on the forum.

 

Cheers,

Ron

daveg
Regular Visitor

Re: CyberSource Payments API - v2/payments sample for SoapUI?

I managed to get it working by removing all headers from the request except the x-pay-token one.

 

neutronron
Helper

Re: CyberSource Payments API - v2/payments sample for SoapUI?

Thanks Dave!

 

Removing the line:

req.setHeader('Accept','application/json');

...did the trick.   Funny thing, the previous version of the API accepted that header.

kevokevoh
Helper

Re: CyberSource Payments API - v2/payments sample for SoapUI?

Hey neutronron ,

Can you share the working soapUI testsuite?

Thanks