%@ include file='constants.jsp' %> <%@ page import="com.paypal.sdk.profiles.EWPProfile" %> <%@ page import="com.paypal.sdk.profiles.ProfileFactory" %> <%@ page import="com.paypal.sdk.services.EWPServices" %> <%@ page language="java" %> <% String button = null; try { EWPServices ewp = new EWPServices(); /* WARNING: Do not embed plaintext credentials in your application code. Doing so is insecure and against best practices. Your API credentials must be handled securely. Please consider encrypting them for use in any production environment, and ensure that only authorized individuals may view or modify them. */ EWPProfile profile = ProfileFactory.createEWPProfile(); profile.setCertificateFile(getServletContext().getRealPath("WEB-INF/cert/sdk-ewp.p12")); profile.setPrivateKeyPassword("password"); profile.setPayPalCertificateFile(getServletContext().getRealPath("WEB-INF/cert/sandbox_cert_pem.txt")); profile.setUrl("https://www."+testEnv+".paypal.com"); ewp.setEWPProfile(profile); String buttonParams = "cmd=_xclick\nbusiness=sdk-seller@sdk.com\nitem_name=Tropical Sunset Picture\namount=1.00\ncurrency_code=USD\ncert_id=DZ6CYQFBZ8DDU\ncharset=UTF-8\ncn=Landscape"; button = ewp.encryptButton(buttonParams.getBytes("UTF-8")); } catch (Throwable e) { session.setAttribute("exception", e); response.sendRedirect("Error.jsp"); } %>
Item: | Torpical Sunset Picture |
Amount: | USD 1.00 |
Category: | Landscape |