Servlet Web Application showcasing PayPal Express Checkout using raw PayPal REST APIs with Checkout.js V4
Copy the code sample on your local machine
Open Eclipse -> File -> Import -> General -> Existing projects to into workspace
Browse the location of the project - Finish the import
Add Apache Tomcat to Project Facets Runtime
commons-codec-1.7.jar (Libs for handling encoder, decoder)
json-20140107.jar (Helper for handling JSON)
okhttp-3.9.0.jar (Http request)
okio-1.13.0.jar (Http request)
The above jars are available in lib folder under WebContent -> WEB-INF -> lib
Add the above jars to your java built path (Right click the project in eclipse choose properties -> Java Build Path -> Add Jars -> Select the current project, browse to lib folder select all the jars and complete the process)
Add the appropriate Java Runtime Environment to your build path
Add Apache Tomcat to your build path
Configure Apache Tomcat on your eclipse
Right click the project Run As -> Run on Server.
Open the below URL in browser
Clicking on the yellow PayPal Checkout button will showcase the Express Checkout flow
Clicking on the blue Proceed to Checkout button will showcase the typical Guest Checkout flow
Application configuration is configured in 'application.properties' file found in WEB-INF - > application.properties file
Change the config according to your app (Client Id, Secret).
Setting 'IS_APPLICATION_IN_SANDBOX' field in application.properties file to 'true' will run the app in sandbox environment and 'false' will run in Live environment.
com.paypal.demo.dto - Holds DTO classes to generate the payload needed for create payments api call.
com.paypal.demo.helpers - Holds Helper class to map values from html to DTO and to generate random invoice no, methods to invoke API calls (post, get, getAccessToken, API invocation methods)
com.paypal.demo.servlets - Servlets to make api calls to PayPal server
Html files are placed in WebContent folder
Note: The current code uses Java 8. So, it uses TLS_v1.2 protocol by default. Upgrade to Java 8 may be necessary.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。