I created my own website with Java Servlet and JSP.
I integrated Paypal payments with the normal buttons. I want to do some actions on a database when a user completes the payment.
I think I have to create the IPN listener servlet , but I can't find anything useful.
I solved my problem. I created a servlet IPN using an example for a maven project. ( https://github.com/paypal/merchant-sdk-java ) Simply I added this dependency:
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>paypal-core</artifactId>
<version>1.7.0</version>
</dependency>
And then I created the servlet ipn with this code in doPost
Map<String,String> configMap = new HashMap<String,String>();
configMap.put("mode", "sandbox");
IPNMessage ipnlistener = new IPNMessage(request,configMap);
boolean isIpnVerified = ipnlistener.validate();
String transactionType = ipnlistener.getTransactionType();
Map<String,String> map = ipnlistener.getIpnMap();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.