Java Gestpay Starter Example
In this example you'll see how to call Gestpay APIs to perform a payment.
What we are using
- Tomcat, Servlets, JSP
- Java Virtual Machine
- Apache Tomcat
In case the SOAP endpoint has changed, or you get SOAP errors, you must re-generate the java classes for the model. From the project directory launch:
wsimport -keep -s src/main/java/ -p it.gestpay.wscryptdecrypt.model https://testecomm.sella.it/gestpay/GestPayWS/WsCryptDecrypt.asmx\?wsdl
This will create all model classes needed to talk to Gestpay.
What to do before running
- configure Gestpay to accept your IP address
failure_url: if your server is at
http://yourshop.com/APP_NAME/, use for both values
- for local development, you can use
http://localhost:8080/<APP_NAME>/in success url and failure url, assuming that your server answers on port
8080and the application is deployed in
- change in
com.myshop.constants.Constantsthe value of
SHOP_LOGINwith your shop code.
How to run
- launch this command:
mvn clean install
copy the WAR
target/gestpay-starter-VERSION.warin tomcat webapps
What you should know about this project
This is an example e-commerce project in Java, made for you by Gestpay. It's purpose is to explain how Gestpay can be integrated inside a Java web application.
Since it's just an example, it will allow you to only pay an item and get the response from Gestpay of successful payment. It has been deliberately realized with the easiest possible technology (Servlets, JSP).
When you start the app,
index.jsp is loaded. This page contains three items that you can buy.
After choosing one of these, you are redirected to the servlet
EncryptServlet, that will generate a payment request to
Gestpay (Note: not the actual payment).
Then the user is redirected to
pay.jsp, where he can read the details about his payment. Clicking on PAY will
transfer the user to Gestpay, to complete the payment.
Once the payment is completed, Gestpay will contact your server to acknowledge of the payment, to one of the URLs
configured before (remember
The serlvet that will answer at
DecryptServlet. it will decode the answer and redirect to the page
This is an official project by Gestpay. For bugs, doubts, support just open an issue.