Integration with Payment Gateways is one of the most common integration in business applications. In this post, I will demonstrate how you can integrate your Java (Servlet/JSP/Struts/Spring/etc.) applications with Paypal using Paypal Button and Instant Payment Notification (IPN).
For those who hate to read long documentation, I’ve tried to capture “minimum” reading material here from Paypal website that is required to understand Paypal IPN Protocal and Architecture; and which is a pre-requisite for our example below.
Besides that, you should also setup following (if not done already):
- Create Paypal Account
- Activate Paypal Developer Account by signing in with your Paypal Account credentials
- Create Paypal Payment Button
As for ‘IpnConfig.java’:
- ‘ipnUrl’ should be:
- For Production/Live - https://www.paypal.com/cgi-bin/webscr
- For Sandbox/Testing - https://www.sandbox.paypal.com/cgi-bin/webscr
- ‘receiverEmail’ should be the Paypal Account Email
- ‘paymentAmount’ should be the ‘Price’ you setup while defining Paypal Button above.
- ‘paymentCurrency’ should be the ‘Currency’ you mention while defining the Paypal Button above.